Ionic build android error on OS X Yosemite


#1

I’m having some issues building my project to android. I’m getting various errors that I have not been able to resolve by reinstalling the sdk tools etc, etc. If anyone has a quick solution that be great, if not I can move to create a github issue.

        UNEXPECTED TOP-LEVEL EXCEPTION:
    com.android.dex.DexException: Multiple dex files define Landroid/support/annotation/AnimRes;
    	at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:596)
    	at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:554)
    	at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:535)
    	at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171)
    	at com.android.dx.merge.DexMerger.merge(DexMerger.java:189)
    	at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:502)
    	at com.android.dx.command.dexer.Main.runMonoDex(Main.java:334)
    	at com.android.dx.command.dexer.Main.run(Main.java:277)
    	at com.android.dx.command.dexer.Main.main(Main.java:245)
    	at com.android.dx.command.Main.main(Main.java:106)

     FAILED

    FAILURE: Build failed with an exception.

    * What went wrong:
    Execution failed for task ':dexDebug'.
    > com.android.ide.common.internal.LoggedErrorException: Failed to run command:
      	/Users/Zeskerr/Library/Android/sdk/build-tools/23.0.1/dx --dex --no-optimize --output              /Users/Zeskerr/Documents/mobilityphone/platforms/android/build/intermediates/dex/debug --input-list=/Users/Zeskerr/Documents/mobilityphone/platforms/android/build/intermediates/tmp/dex/debug/inputList.txt
      Error Code:
      	2
      Output:
      	
      	UNEXPECTED TOP-LEVEL EXCEPTION:
      	com.android.dex.DexException: Multiple dex files define Landroid/support/annotation/AnimRes;
      		at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:596)
      		at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:554)
      		at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:535)
      		at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171)
      		at com.android.dx.merge.DexMerger.merge(DexMerger.java:189)
      		at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:502)
      		at com.android.dx.command.dexer.Main.runMonoDex(Main.java:334)
      		at com.android.dx.command.dexer.Main.run(Main.java:277)
      		at com.android.dx.command.dexer.Main.main(Main.java:245)
      		at com.android.dx.command.Main.main(Main.java:106)
      	


    * 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: 5.954 secs

    /Users/Zeskerr/Documents/mobilityphone/platforms/android/cordova/node_modules/q/q.js:126
                        throw e;
                              ^
    Error code 1 for command: /Users/Zeskerr/Documents/mobilityphone/platforms/android/gradlew with args: cdvBuildDebug,-b,/Users/Zeskerr/Documents/mobilityphone/platforms/android/build.gradle,-Dorg.gradle.daemon=true
    ERROR building one of the platforms: Error: /Users/Zeskerr/Documents/mobilityphone/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/Zeskerr/Documents/mobilityphone/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:139: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)

End of error.