How to modify a pre-packaged apk file on client-side by user who is using my desktop application?

霸气de小男生 提交于 2019-11-30 10:39:40

I finally have ended up with this working solution, I put it here for anyone interested.

1- Extract "original.apk" (source.apk) to a temp folder (ie. TempFolder)

2- Put user-generated files in "assets" and "res\drawable" folders under TempFolder

3- generate AndroidManifest.xml and put in TempFolder

4- Run this command: aapt package -f -M "PathToManifest" -S "PathToResFolder" -I android.jar -F "NearlyFinal.apk" -A "PathToAssetsFolder"

5- copy "classes.dex" to folder where NearlyFinal.apk exists.

6- run this command: aapt add -f NearlyFinal.apk classes.dex jad.properties

7- sign apk file: jarsigner -storepass [keystorePass] -keystore KeyStoreFile.key NearlyFinal.apk [KeyStoreName]

8- zipalign apk file: zipalign 4 NearlyFinal.apk "Final.apk"

9- rename and move Final.apk according to user's pref's.

FINISH

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!