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 merger fails while adding no resources #14

Closed Unbrick closed 5 years ago

Unbrick commented 7 years ago

Sorry to annoy you again but i encountered another issue: (in a different project than last time)

My Project setup is the following: I'm trying to patch a normal apk without any additional resources patched in, all resources are taken from the :source project.

While doing a gradle build, gradle throws me the following error:

:patched:mergeDebugResources C:\Users\Admin\StudioProjects\Patched\patched\build\intermediates\exploded-aar\Patched\source\unspecified\res\values\ids.xml: Error: ' ' is not a valid resource name character :patched:mergeDebugResources FAILED

(too long for here, migrated it to hastebin) https://hastebin.com/ovirexewek.vbs

Til now i tried several different gradle options but none of them worked. I'm inviting you to a private repo in case you want to try at the project itself.

Thanks for your efforts!

Lanchon commented 7 years ago

maybe the resource names were mangled by some obfuscator. check that the decompiled resources in the .apk.aar APK library produced by ':source' are valid. see: http://stackoverflow.com/questions/35240635/error-is-not-a-valid-resource-name-character

also, could this maybe be a bug in build tools? check this one: https://code.google.com/p/android/issues/detail?id=195443

Unbrick commented 7 years ago

Checked the source resource names for invalid characters like colons or spacing, they are all fine and valid. Additionally Gradle reports a space as invalid resource identifier which doesn't make any sense at all. Looks to me like a Gradle error.

Lanchon commented 7 years ago

i'm sorry i've no time to investigate, but sure looks intriguing. you can try downgrading build-tools maybe and see what happens.

Unbrick commented 7 years ago

Just thought a little bit about it...apktool is using a framework-res.apk do decompile resources afaik. Maybe we just could replace the one you are shipping and try another one. But i can't find it in your modified apktool version, could you give me a hand?

Lanchon commented 7 years ago

i'm not shipping a modded apktool. apktool provides its own framework which is based on AOSP and should work for all independent apps.

it is not enough when you want to process an app that came embedded in a OEM rom and uses the rom's private api extensions. for example: an OEM's stock FM radio app that uses a proprietary radio API designed and implemented by the OEM on their android.

dxp fully supports your frameworks:

Lanchon commented 5 years ago

UPDATE: solution here