ClaudiuGeorgiu / Obfuscapk

An automatic obfuscation tool for Android apps that works in a black-box fashion, supports advanced obfuscation features and has a modular architecture easily extensible with new techniques
MIT License
1.09k stars 285 forks source link

Failed install obfuscated apk. #167

Closed cissusnar closed 1 year ago

cissusnar commented 1 year ago

I use the following command being a test on my apk(apk is download from google play console and without obfuscat), docker run --rm -it -u $(id -u):$(id -g) -v "${PWD}":"/workdir" obfuscapk -p -o Rebuild -o NewAlignment -o NewSignature my.apk

then install with : adb install my_obfuscated.apk

it will failed with: Performing Streamed Install adb: failed to install my_obfuscated.apk: Failure [INSTALL_FAILED_INVALID_APK: INSTALL_FAILED_INVALID_APK: Failed to extract native libraries, res=-2]

how can i fix this problem?

ClaudiuGeorgiu commented 1 year ago

Hi, that command just rebuilds the apk without any obfuscation, since it already fails at this step maybe your app is using some protection against repackaging or there is some issue with apktool (the underlying tool used to decompile and rebuild the apk, maybe this issue is somehow related to the problem).

cissusnar commented 1 year ago

Thanks for your reply : ) I build a custom docker image with the latest apktool(2.8.1), it still failed. I'll try build a new apk. thank you again : )

cissusnar commented 1 year ago

Finally I successfully installed the apk, obfuscation and encryption were successful, but I manually used zipalign for 4kb alignment, and manually signed the apk with apksigner.

But the app can't run, prompting Unknown Source error, this is a typical Proguard error, I don't use Android's Proguard for obfuscate because it needs to manually set the rules, it is easy to cause Unknown Source and crash, so I hope find A tool that does not need to manually set rules and automatically obfuscate.

it seems that Obfuscapk still needs to manually specify exclusion rules, which is contrary to my original intention : (

But still thanks to your work : )

ClaudiuGeorgiu commented 1 year ago

Thank you for trying Obfuscapk and reporting your findings 👍🏻