Decompile the APK, modify an activity to recompile the APK
I’m trying to do something simple. I have an APK file and I want to change a variable value in an activity and then recompile it back into the APK so I can use it on my android device.
It’s been days since I started using it and I can’t find any solution.
I tried these methods :
- Decompile with APKtool.
- Open it with Android studio.
- Change the value you want.
- It cannot be recompiled into an APK.
- Decompile it with APKtool/Open the APK using 7-Zip.
- Use dex2jar to convert
classes.dex
to jar. - Open the jar file using luyten or jadx (jd-gui got an “internal error”).
- The file cannot be edited.
In another method, I don’t remember how I did it, I was able to get the activity file but couldn’t understand how to recompile it into an APK.
Please let me know if you have any ideas on how to edit classes
and activities. I’ve read a lot about SO issues and googled many times, but I can’t find any solutions. Thanks!
Solution
With the Android apk tool, you can only decompile existing APKs. You can’t recompile it. An error will be reported
If you want to convert a dex file to a JAR file
and then convert a JAR file to a dex file, this will not work in most cases.
But there is a solution available ..” DexPatcher”。 I tried this but got stuck due to lack of knowledge… You can try the “Dexpatcher tool” and it will be good. If you have any ideas, please let me know…
Have a nice day