Problem with duplicate classes after upgrade from 1.x to 2.x version (Duplicate zip entry R.class)
rusxakep opened this issue · comments
Copying resources from program jar [E:\...\app\build\intermediates\transforms\desugar\debug\26.jar] (filtered)
Warning: Exception while processing task java.io.IOException: Can't write [E:\...\app\build\intermediates\transforms\proguard\debug\0.jar] (Can't read [E:\...\app\build\intermediates\transforms\desugar\debug\26.jar(;;;;;;**.class)] (Duplicate zip entry [26.jar:com/pushtorefresh/storio2/R.class]))
:app:transformClassesAndResourcesWithProguardForDebug FAILED
And
Copying resources from program jar [C:\Users\...\.gradle\caches\modules-2\files-2.1\com.pushtorefresh.storio2\sqlite-annotations\2.1.0\6c0ec1ade86172c340deb36827a808857e5f4256\sqlite-annotations-2.1.0.jar] (filtered)
Copying resources from program jar [C:\Users\...\.gradle\caches\modules-2\files-2.1\com.pushtorefresh.storio2\content-resolver\2.1.0\1eeaaf28979eb02406c5384549c96e5f40d2802f\content-resolver-2.1.0.jar] (filtered)
Warning: Exception while processing task java.io.IOException: Can't write [E:\Users\...\AndroidStudioProjects\Aggregatic_Tracker\app\build\intermediates\transforms\proguard\debug\0.jar] (Can't read [C:\Users\...\.gradle\caches\modules-2\files-2.1\com.pushtorefresh.storio2\content-resolver\2.1.0\1eeaaf28979eb02406c5384549c96e5f40d2802f\content-resolver-2.1.0.jar(;;;;;;**.class)] (Duplicate zip entry [content-resolver-2.1.0.jar:com/pushtorefresh/storio2/R.class]))
:app:transformClassesAndResourcesWithProguardForDebug FAILED
Hi, @rusxakep!
I met similar problems after migration app to build gradle tools 3 with other libraries, but after simple project rebuild error was gone. Did you try it?
This isn't proguard problem.
Conflict with R.class in content-resolver-2.1.0 and sqlite-2.1.0.
Removing R.class from any .jar fixes the problem.
hi, I'm confirm it
#851
Caused by: com.android.dex.DexException: Multiple dex files define Lcom/pushtorefresh/storio2/R;
at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:661)
at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:616)
at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:598)
at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171)
at com.android.dx.merge.DexMerger.merge(DexMerger.java:198)
at com.android.builder.dexing.DexArchiveMergerCallable.call(DexArchiveMergerCallable.java:61)
@rusxakep @Sar777 indeed that happens, looks like for some reason build tooling decides that packageName of every module is com.pushtorefresh.storio2
instead of module-specific one like com.pushtorefresh.storio2.sqlite
which we actually set in AndroidManifest
of every module.
For now I recommend you to try depending on aar
versions of our dependencies like this:
compile 'com.pushtorefresh.storio2:sqlite:2.0.0@aar'
Because turned out R
class doesn't get packaged into aar, but packaged into jar
@artem-zinnatullin thx!
@Sar777 did it work for you? Just want to confirm :)
yes, work fine
Great, thanks!
// If you need StorIO for SQLite
compile 'com.pushtorefresh.storio2:sqlite:2.1.0@aar'
compile 'com.pushtorefresh.storio2:sqlite-annotations:2.1.0'
annotationProcessor 'com.pushtorefresh.storio2:sqlite-annotations-processor:2.1.0'
// If you need StorIO for ContentResolver
compile 'com.pushtorefresh.storio2:content-resolver:2.1.0'
compile 'com.pushtorefresh.storio2:content-resolver-annotations:2.1.0'
annotationProcessor 'com.pushtorefresh.storio2:content-resolver-annotations-processor:2.1.0'
Workaround work fine, thanks.