MichaelRocks / paranoid

String obfuscator for Android applications.
Apache License 2.0
671 stars 79 forks source link

build fail for AndroidTest module after apply plugin. #14

Closed eidola7 closed 6 years ago

eidola7 commented 6 years ago

I got an build Error for AndroidTest. It's only occur when run AndroidTest with module applied plugin. ( module compile has no error! )

Executing tasks: [:module:assembleDebug, :module:assembleDebugAndroidTest] ... :sdk:transformClassesWithParanoidForDebug UP-TO-DATE ... :sdk:transformClassesWithParanoidForDebugAndroidTest UP-TO-DATE :sdk:transformClassesWithDexForDebugAndroidTest FAILED

FAILURE: Build failed with an exception.

Caused by: java.lang.RuntimeException: com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.dex.DexException: Multiple dex files define Lio/michaelrocks/paranoid/Deobfuscator;

Caused by: com.android.dex.DexException: Multiple dex files define Lio/michaelrocks/paranoid/Deobfuscator; at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:584) at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:539) at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:521) at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:167) at com.android.dx.merge.DexMerger.merge(DexMerger.java:191) at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:522) at com.android.dx.command.dexer.Main.runMonoDex(Main.java:344) at com.android.dx.command.dexer.Main.run(Main.java:292) at com.android.builder.internal.compiler.DexWrapper.run(DexWrapper.java:54) at com.android.builder.core.DexByteCodeConverter.lambda$dexInProcess$0(DexByteCodeConverter.java:174)

Do you have any suggestions?

I'm using espresso-core:2.2.2 androidTestCompile "com.android.support.test.espresso:espresso-core:2.2.2", { exclude group: 'com.android.support' }

MichaelRocks commented 6 years ago

@eidola7, thank you for the report and sorry for my delayed response. Seems the plugin generates two copies of Deobfuscator: one for the main project and another one for the test project. I'm afraid there's no workaround. I'll try to fix the plugin and generate a unique file per project.

MichaelRocks commented 6 years ago

@eidola7 Should be fixed in 0.1.8.