bmlct / android-test-kit

Automatically exported from code.google.com/p/android-test-kit
0 stars 0 forks source link

Getting DexException when running assembleDebugAndroidTest goal second time #152

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Run assembleDebugAndroidTest goal
2. Make changes to test code
3. Run assembleDebugAndroidTest goal again

What is the expected output? What do you see instead?
Successful build is expected.
However build fails with the following message:
com.android.dex.DexException: Multiple dex files define 
Landroid/app/BuildConfig;

What version of the product are you using? On what operating system?
Mac OS X 10.10.3
Java 7
Gradle 2.2.1
Android Gradle plugin 1.2.3
Android SDK 21
Android Build Tools 22.0.1
Test Runner 0.2
Espresso Core 2.1

Please provide any additional information below.
It does not fail when I execute clean goal before assembleDebugAndroidTest.
The only dependency that contains offending file is 
'exposed-instrumentation-api-publish'

Original issue reported on code.google.com by deadmoto on 13 May 2015 at 11:38

GoogleCodeExporter commented 8 years ago
I get this running "connectedCheck" as well.

OS X 10.10.3

Gradle 2.4
Rules 0.3
Runner 0.3
Espresso-Core 2.2

Running a clean first prevents the issue. 

UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexException: Multiple dex files define 
Landroid/app/BuildConfig;
    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:454)
    at com.android.dx.command.dexer.Main.runMonoDex(Main.java:303)
    at com.android.dx.command.dexer.Main.run(Main.java:246)
    at com.android.dx.command.dexer.Main.main(Main.java:215)
    at com.android.dx.command.Main.main(Main.java:106)

:app:dexDevDebugAndroidTest FAILED

Original comment by matthew....@gmail.com on 8 Jun 2015 at 5:50

GoogleCodeExporter commented 8 years ago
I think that I was able to fix my issue by removing productFlavors which reset 
my applicationId. 

Previously we had no default applicationId, and two flavors that each set their 
own applicationId. I changed that to setting a default value, and then an 
applicationIdSuffix for our dev builds - and the problem went away. 

Original comment by matthew....@gmail.com on 8 Jun 2015 at 10:27

GoogleCodeExporter commented 8 years ago
This seems like a Gradle issue, does a ./gradlew clean fix it when this error 
occurs?

Original comment by slinz...@google.com on 9 Jun 2015 at 2:49

GoogleCodeExporter commented 8 years ago
Yes. A clean fixes it until the next time you try to run the tests.

Original comment by matthew....@gmail.com on 9 Jun 2015 at 3:08

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
I'm having this issue when using both product flavors and multidex (the issue 
doesn't mention multidex)

Original comment by michael....@hungrymachine.com on 28 Jul 2015 at 9:11

GoogleCodeExporter commented 8 years ago

Original comment by slinz...@google.com on 15 Sep 2015 at 10:58