Android Build Exception

I’m getting this exception when trying to run “ionic build android --stacktrace”

solitaire:gamebeacon james$ ionic build android --stacktrace
Running command: /Users/james/xdev/bucket/gamebeacon/hooks/after_prepare/010_add_platform_class.js /Users/james/xdev/bucket/gamebeacon
add to body class: platform-android
Running command: /Users/james/xdev/bucket/gamebeacon/platforms/android/cordova/build 
ANDROID_HOME=/Users/james/xdev/adt-bundle/sdk
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home
Running: /Users/james/xdev/bucket/gamebeacon/platforms/android/gradlew cdvBuildDebug -b /Users/james/xdev/bucket/gamebeacon/platforms/android/build.gradle -Dorg.gradle.daemon=true

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all dependencies for configuration ':_debugCompile'.
   > Could not find any version that matches com.android.support:support-v4:+.
     Searched in the following locations:
         https://repo1.maven.org/maven2/com/android/support/support-v4/maven-metadata.xml
         https://repo1.maven.org/maven2/com/android/support/support-v4/
     Required by:
         :android:unspecified

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 2.375 secs

/Users/james/xdev/bucket/gamebeacon/platforms/android/cordova/node_modules/q/q.js:126
                    throw e;
                          ^
Error code 1 for command: /Users/james/xdev/bucket/gamebeacon/platforms/android/gradlew with args: cdvBuildDebug,-b,/Users/james/xdev/bucket/gamebeacon/platforms/android/build.gradle,-Dorg.gradle.daemon=true
ERROR building one of the platforms: Error: /Users/james/xdev/bucket/gamebeacon/platforms/android/cordova/build: Command failed with exit code 1
You may not have the required environment or OS to build this project
Error: /Users/james/xdev/bucket/gamebeacon/platforms/android/cordova/build: Command failed with exit code 1
    at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:134:23)
    at ChildProcess.emit (events.js:110:17)
    at maybeClose (child_process.js:1015:16)
    at Process.ChildProcess._handle.onexit (child_process.js:1087:5)
solitaire:gamebeacon james$ 

I’ve tried using “cordova build android”. Same error.
I’ve tried starting the project from scratch and laboriously copying files over and reinstalling everything. Same error.

Anyone able to help?

I’m on OSX.

Your Android SDK may be not complete, you are missing some parts of it. Start the SDK manager and select for installing all the packages under Extras.

You’ll get probably more than you need but it should fix your problem.

Ah! I got the odd error, such as

    Note: /Users/james/xdev/bucket/gamebeacon/platforms/android/src/com/plugin/gcm/PushPlugin.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.

But ultimately a “BUILD SUCCESSFUL” message :smiley:
Thanks!

1 Like