0
votes

So, after a few Github hijinx (moving the repo to a new directory by accident, and then recloning in the original directory), my builds no longer work.

I'm not sure what the process is supposed to be to trace down the problem when a build fails, the output is not particularly transparent.

Anyway, here's my output from "cordova build -d":

cordova library for "android" already exists. No need to download. Continuing. Generating config.xml from defaults for platform "android" Calling plugman.prepare for platform "android" Preparing android project Processing configuration changes for plugins. Iterating over installed plugins: [ 'org.apache.cordova.camera',
'org.apache.cordova.device', 'org.apache.cordova.media',
'org.apache.cordova.file', 'org.apache.cordova.media-capture',
'org.apache.cordova.geolocation' ] Writing out cordova_plugins.js... Ensuring plugin "org.apache.cordova.camera" is installed correctly... Plugin "org.apache.cordova.camera" is good to go. Ensuring plugin "org.apache.cordova.device" is installed correctly... Plugin "org.apache.cordova.device" is good to go. Ensuring plugin "org.apache.cordova.file" is installed correctly... Plugin "org.apache.cordova.file" is good to go. Ensuring plugin "org.apache.cordova.geolocation" is installed correctly... Plugin "org.apache.cordova.geolocation" is good to go. Ensuring plugin "org.apache.cordova.media" is installed correctly... Plugin "org.apache.cordova.media" is good to go. Ensuring plugin "org.apache.cordova.media-capture" is installed correctly... Plugin "org.apache.cordova.media-capture" is good to go. Wrote out Android application name to "S,T,L." Wrote out Android package name to "com.snap_tag_love.test" Compiling app on platform "android" via command "cmd" /c C:\Users\Marc\Documents\Cordova\hello\platforms\android\cordova\build exec: ant clean -f "C:\Users\Marc\Documents\Cordova\hello\platforms\android\build.xml"

[ 'ant clean -f "C:\Users\Marc\Documents\Cordova\hello\platforms\android\build.xml"', { [Error: Command failed: BUILD FAILED
C:\Users\Marc\Documents\Cordova\hello\platforms\android\build.xml:90: Cannot find C:\adt\tools\ant\build.xml imported from C:\Users\Marc\Documents\Cordova\hello\platforms\android\build.xml Total time: 0 seconds ] killed: false, code: 1, signal: null }, 'Buildfile: C:\Users\Marc\Documents\Cordova\hello\platforms\android\build.xml\r\n', '\r\nBUILD FAILED\r\nC:\Users\Marc\Documents\Cordova\hello\platforms\android\build.xml:90: Cannot find C:\adt\tools\ant\build.xml imported from C:\Users\Marc\Documents\Cordova\hello\platforms\android\build.xml\r\n\r\nTotal time: 0 seconds\r\n' ]

Error executing "ant clean -f "C:\Users\Marc\Documents\Cordova\hello\platforms\android\build.xml"": BUILD FAILED C:\Users\Marc\Documents\Cordova\hello\platforms\android\build.xml:90: Cannot find C:\adt\tools\ant\build.xml imported from C:\Users\Marc\Documents\Cordova\hello\platforms\android\build.xml

Total time: 0 seconds

child_process.spawn(cmd,[/c, C:\Users\Marc\Documents\Cordova\hello\platforms\android\cordova\build]) = 2

2

2 Answers

3
votes

I faced the same problem, it's caused by two files called local.properties, located in platforms/android/ and platforms/android/CordovaLib. They are generated automatically and contain the path to your Android SDK. Because you pulled it from Github, it has the wrong path in it. Ant reads the file and is pointed to a non-existing SDK and thus fails to build. Just delete them. I used:

find . -name "local.properties" -exec rm -rf {} \;

The content of the files is:

# This file is automatically generated by Android Tools.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must *NOT* be checked into Version Control Systems,
# as it contains information specific to your local configuration.

# location of the SDK. This is only used by Ant
# For customization when using a Version Control System, please read the
# header note.
sdk.dir=/PATH/TO/SDK

As it states, local.properties files should be ignored. If you use git add it to .gitignore.

0
votes

I think the project got borked by my git shenanigans. The way I solved the problem:

1) Create new Cordova project. Install android platform, plugins. This worked on a clean project. 2) Copy relevant www files into new project. 3) Migrate .git folder and files into new project directory.
4) Commit to github, sync.

Voila, everything works again.