I am currently modding an app.I am beginner till now.I want to ask is there any way to convert smali file to java for editing and vice versa. I searched the whole internet,even xda forum could not give me accurate answer. There are dozen of methods though but none of them is convenient.
Asked
Active
Viewed 2.1k times
1 Answers
6
You can use Apktool to decompile/decode an APK and rebuilt it.
Generated files are in smali format.
To make it easier to understand/find the code you want to change, you can generate Java source code from APK file using JD GUI.
Generated Java files (most of the times) are not complete and can't be used to recompile the apk!
On Android Studio and IntelliJ you can use Java2Smali plugin to convert Java/Kotlin code to smali.

amarildo.xyz
- 932
- 1
- 13
- 21
-
I have already been using JD gui but we can only view in that ..I need something for editting the code in java not in smali and then recompile the apk . – Shiraz Ahmad Jun 29 '19 at 20:32
-
@ShirazAhmad you can save your code from JD Gui, to view and edit it from your preferred IDE, but you CAN NOT create an APK from it since its not a complete java source code. You can edit your *smali* code, and create an APK from it. If it would be that easy, we would crack any app/game in playstore :P – amarildo.xyz Jun 30 '19 at 07:15
-
Hahaha...I was also wondering that it couldn't be so simple , although there could be alternative way of doing...My last question to you , like i am doing this is as carefully understanding the java code and then finding same exact code in smali file and then editing.Is this the way all app modder's Do? BTW Thanks :) – Shiraz Ahmad Jul 01 '19 at 13:03
-
@ShirazAhmad that's the mos efficient way, if the app you are editing is not obfuscated (with pro guard or another app) and JD Gui can fully open the files you need to modify. If you have bad luck with obfuscation + no java source code (like the app i'm currently personalizing) you have to carefully follow Activities, identify the method, than edit the source you want. IntelliJ + Android Studio have great search functions + regex to help you find the source you need. – amarildo.xyz Jul 01 '19 at 13:50