Error happened when build the android project(develop branch)


(snowdream) #1

When i checkout out the develop branch of the following android project. https://github.com/snowdream/android-gradle-template/tree/develop

and build it with. gradle build --info

i get erros as follows,but i do not know why it happens: Anybody can help me?

‘’'gradle * What went wrong: Execution failed for task ‘:app:dexDebug’. > com.android.ide.common.internal.LoggedErrorException: Failed to run command:

/home/snowdream/bin/android-sdk-linux/build-tools/19.0.1/dx --dex --output /home/snowdream/workspace/git/android-gradle-template/app/build/dex/debug /home/snowdream/workspace/git/android-gradle-template/app/build/classes/debug /home/snowdream/workspace/git/android-gradle-template/app/build/dependency-cache/debug /home/snowdream/workspace/git/android-gradle-template/app/build/pre-dexed/debug/classes-e7be28ed16ac82f2505a9f405d68713889e5d992.jar /home/snowdream/workspace/git/android-gradle-template/app/build/pre-dexed/debug/classes-9f75b9654310a8ea1644e148db7b13946c74c065.jar /home/snowdream/workspace/git/android-gradle-template/app/build/pre-dexed/debug/support-v4-19.0.1-9c1697abe98ce4f65cbb62d24d7c5b811a2c6c12.jar

Error Code:

2

Output:

UNEXPECTED TOP-LEVEL EXCEPTION:

com.android.dex.DexException: Multiple dex files define Lcom/github/snowdream/android/template/library/R$drawable;

at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:594)

at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:552)

at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:533)

at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:170)

at com.android.dx.merge.DexMerger.merge(DexMerger.java:188)

at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:439)

at com.android.dx.command.dexer.Main.runMonoDex(Main.java:287)

at com.android.dx.command.dexer.Main.run(Main.java:230)

at com.android.dx.command.dexer.Main.main(Main.java:199)

at com.android.dx.command.Main.main(Main.java:103)

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

‘’’


(Radim Kubacki) #2

It can be a problem with pre-dex’ing and having two copies of the same resources on an input path for dex utility. I suppose you’ve tried clean build. You can find better answer on ADT-dev mailing list - http://groups.google.com/group/adt-dev


(snowdream) #3

Thank You