DexPatcher / dexpatcher-gradle

Modify Android applications at source-level in Android Studio
https://dexpatcher.github.io/
GNU General Public License v3.0
83 stars 17 forks source link

Resources merge error - Duplicate drawable #11

Closed gurt-il closed 9 years ago

gurt-il commented 9 years ago

When i try to add images to the patch folder to override the original, the build failed with this error: _\app\build\intermediates\res\debug\drawable-hdpi-v4\abc_ab_share_pack_mtrl_alpha.9.png: error: Duplicate file. _\app\build\intermediates\res\debug\drawable-hdpi\abc_ab_share_pack_mtrl_alpha.9.png: Original is here. The version qualifier may be implied.

Lanchon commented 9 years ago

hi, thanks for trying DxP and reporting!!

this is not a DexPatcher bug.

"this doesn't mean your resources should never overlap those in the library: there are a lot of legit reasons to override a lib's resources with your own (e.g. changing the looks of a library-provided activity) and [android] gradle plugin's resource merging logic does allow this, on purpose."

you are encountering a bug in the android build system. and you didn't report on your setup and versions, so no way of knowing. read here for more info: http://stackoverflow.com/questions/29965398/gradle-finished-with-non-zero-exit-value-1-ic-launcher-png-error-duplicate-fi

there are several usable workarounds discussed there, one of which is changing the version of android plugin used. also, "aaptOptions.cruncherEnabled = false" might work, i read elsewhere.

closing the issue, please reopen if you still consider it is a DxP bug.

NOTE: the problem can sometimes be traced to different versions of android plugin being used to create and the use AAR files. when using the DxP plugins, you produce an AAR (the APK library file is a modification of AAR). but the android plugin is NOT used to build the APK library (ie: the AAR) at all; instead, apktool is used. if apktool produces a resource tree with an outdated format that the newer aapt can't fully understand, then that is an apktool bug. (especially given that apktool invokes aapt to repack the application.)