How to change an asset (not a classes.dex file) in an Android APK

- You will need to have root on your phone (this is easy to find online).
- Don't expect me to tell you how to modify the classes.dex file. That's also easy to find.
- You'll need the Java JDK (not JRE)!

1. Extract the APK [Tools: WinRAR].
2. Change/Add the asset you want. In my case it was a .NET dll which I 'adjusted' to give unlimited search tool & energy [Tools: Reflector + Reflexil]
3. Open the original APK, and change the asset.
4. Go to META-INF in the APK file, and delete all *.RSA, *.SF files (1 file left: manifest.mf).
5. Get a key:
"C:\Program Files (x86)\Java\jdk1.8.0_91\bin\keytool" -genkey -v -keystore my-release-key.keystore -alias alias_name -keyalg RSA -keysize 2048 -validity 10000

6. Sign the APK:
"C:\Program Files\Java\jdk1.8.0_91\bin\jarsigner" -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore my-release-key.keystore com.wooga.pearlsperil-1.apk alias_name

7. Upload it to your phone somehow
8. Log in via SSH (find out online how to do that)
9. su - [to really get root]
10. pm install

Tadaaa :-).

No comments: