I have developed an application before and Now I can't find my application source code.
I want to make some changes to my application.
Now I just have my keystore(jks file) which I have use it to sign my application before.
I use online Apk Decompiler to decompile my application but It does not give my desired result.
I need it to edit my codes and give it to the customer but It gives me code preview like below with Incomprehensible class and method names.
My decompiled APK folders directory
My Code Preview
I know that this problem is for setting minify enabled to true for release mode in gradle .
Is there any way to revert decompiled code to understandable code or revert it with keystore or decompile application apk file with understandable source code?
I really need to decompile this apk and do some changes on it .
Specially application source files.
Any help will be appreciated :)
Seems to me you're trying to do some reverse engineering.
That's one of the points of proguard, to make this more difficult.
If you are the developer, see if you saved the mappings.txt file when you did the build. It's will show to what the obfuscated names refer to. Otherwise, no, there is no way to know what the names were before obfuscation without that file.
Related
I'm trying to do something simple. I have an APK file, I want to change a certain variable value in a certain activity, and then recompile it back to APK so I can use it on my android device.
It's been days since I started with it and I can't find any solution for it.
I tried these approaches:
Decompile it with APKtool.
Open it with Android studio.
Change the value you want.
Couldn't recompile it to APK.
Decompile it with APKtool / Open the APK with 7-Zip.
Convert classes.dex to jar using dex2jar.
Open the jar file using luyten or jadx (jd-gui had an "internal error").
Couldn't edit the files.
On a different approach I can't remember how I did it, I was able to get to the activity files, but couldn't understand how to recompile it to APK again.
Please, if you have any idea of how do edit the classes and the activity, let me know. I have read lots of SO questions and google it so many times but I couldn't find any solution for it. Thanks!
Using Android apk tool you can able to decompile the existing APK only. You can't recompile it. It will throw error
If you are going to convert dex file to JAR file and JAR file to dex file that also won't work most of the times.
But one solution is available.. "DexPatcher". I tried this one but got stuck in between do to lack of knowledge... You can try "Dexpatcher tool" it will be good. If u got any idea please let me know..
Have a good day
I suggest you to use APK Studio. You can decompile/recompile apk using it. However, you cannot edit the source in Java. It decompiles in language called smali. If you need to just change a value, I guess this tool can solve your problem.
Use apk-editor.
Apk-editor is app in android
That decompile and recompile apk
apkeditor
I came across a situation where i have to put some debug logs inside some code methods of PackageInstaller.java in my stock ROM.
https://android.googlesource.com/platform/frameworks/base/+/refs/heads/master/core/java/android/content/pm/PackageInstaller.java
I found that file is deodexed in classes.dex file inside frameworks.java of system folder in the ROM folder. I came across that decompilation will give me the java files (not completely 100% accuracy in code content). So I expects= that these incomplete code base will make blocking in my stock ROM functionality.
So i thought of grabbing a seperate module from this will give me a 100% code base.
https://github.com/android/platform_frameworks_base
So the question is how can I make this git repo to build a new frameworks.jar file?
Compile the repo into a jar file, using usual compilation methods in terminal (CLI).
Or you could even try the docs part in the repo link. The HTML files in the docs folder will surely help you execute the repo.
I decompiled a Java .jar file, after editing the problem i'm having with it, its not compiling again. So, i had to opt-in to using 7-zip to just bring out the class file and, now i've used 5 different Class Editors, all can't show me the codes like i can understand...
I used CE(Classeditor.sourceforege.net), dirtyjoe, javaeditor(javaeditor.org), Jad and JD-GUi(Seems not to do its work at all)
I imported the .jar file into Eclipse as a Project Reference Library and the most painful thing is i can see all of the class codes, but i can't edit it...It won't edit. But, it can run.
What can i do to Eclipse to be able to make it allow editing the .class files attached to it.
EDIT: I want A Class Editor That Shows in Codes Format, not bytecodes.
I have the source as well in .java format.
This Example is Eclipse Class Viewer(I want same, but not only viewer).
Eclipse Class Viewer Image, I want something similar
It sounds like you want to be able to edit class files directly. The Eclipse class viewer only works because it finds (in your project folder or online) a source code version of the jar that you're viewing. It's not actually looking at the class files and decompiling them, AFAIK. So, if you can view the source in Eclipse, your best bet may be to find the source version of the jar (on your machine or on maven, possibly, if you're using maven), and then edit it and build it yourself according to that project's build instructions. How hard that is depends on the library.
As far as being able to decompile, edit, and recompile, I'm not sure. I know that decompilers are not foolproof, and I've only used them as a last-ditch, read-only tool. It seems like it should work both ways, but I wouldn't be surprised to hear it doesn't.
I am new to both java and eclipse, I have been trying to debug an android app on a device. It is a small project with a jar file reference. I read similar questions but they didn't help.
What I need is to be able to debug the source codes of the jar file so I attached the source codes ( which I obtained using a decompiler ) and I am able to go into source codes of the library so I thought I did that correctly. But I can not succeed in debugging into these source codes; in debug mode it skipps breakpoints (only the ones in the source files which are attached to jar file) and when I try to 'step into code' it goes to random lines skips lines when debugging.
I am using the latest versions of eclipse, android sdk and jdk. I don't know what causes this problem and I'd like to know.
Thanks in advance, I hope I explained sufficiently.
The problem is, that you can't decompile the class files to debug it. Because the lines of the decompiled files will differ to the original Java source code lines (imagine: the real source code has some comments and other things which will not be compiled into class files)!
So, if your Eclipse shows you the current debug line 42, then it only tells you, that the debugger will present you the 42th line of code in the class file. This won't match your decompiled java source file.
However, you could decompile the class files with the option add line numbers as comments. These line numbers in comments you can compare to the actual stacktrace line numbers. This could help you a little bit to imagine the issue.
edit: as Laurent B recommended, you will be able to realign the code with JD-Eclipse, see: http://mchr3k.github.io/jdeclipse-realign/
+1 for the comment! :)
edit2: You won't be able to decompile with line numbers if the class files are compiled with the flag -g:none:
-g:none
Do not generate any debugging information.
So if this is the case: try to find the original source code of your jar file!
Its shows that the source file and Jar is not same. Try to get the right version of Source.
A decompiler will not get the exact source code but will try to recreate it from the generated bytecode.
This is an entropic process so Decompile(Compile(Source)) will not output Source (you loose information) such as line number. That is why you will need the original source code. If you don't have it, you will have to use your immagination to be able to follow the code :)
EDIT : apparently some decompiler tools can do that for you as stated by bobbel.
see jdeclipse plugin.
Try debugging your code line by line by pressing F6
Decompiled source code sometimes acts like that. Unfortunately, the only solution for you is to stop debugging the jar and search the web for the source code and add it to your project.
Okay, so my programming teacher sent me an app that I should look at and modify. I downloaded the APK file, and turned it into a source code following these instructions: how to extract code of apk file.
I have the java (src) files, the resources files, and the XML files. I have the Manifest file too.
I imported them successfully on eclipse, but now it has like 2000 errors.
I really don't know what to do. The apk works fine on my phone.
Why is it doing this?
If anyone needs the apk, I'll upload it.
If someone can be so generous to convert it into a working eclipse workspace for me, I'll be more than grateful.
You can never get the exact source code from the .apk file. The .apk file is generated from the compiled classes which doesnt have all information like actual variable names, actual method names. so you cannot retrieve back 100% original source code.
Basically everything will be obfuscated. so when obfuscated, multiple classes may have same name.
eg: two classes may have name 'a'. Hence the Errors in Eclipse.
As far I know re-compiling apk file will not give you exact results except the images and xml resources. Some free tools available that cannot provide 100% accurate code. here's a tutorial you can check How To Retrieve The Source Code From A Compiled Android .Apk