1

I have developed an Android app in Android studio and have uploaded its apk in Google Play Store as well. But I had lost all the files(java+xml) of the app.

Now I only have the apk from play store and also the apk before uploading to Google Play Store (apk before performing encryption).

Now I want to get all the java files and xmls of the app for updating the app. I have tried all the steps mentioned by previous StackOverflow questions but I was not able to get the Java files properly. I was able to get the xmls properly. Java files I got was somewhat not understandable format (partially compiled/transformed)

So my question here is can I get all java files as normal java files without any compilation/transformation?

Please help guys. Thanks a ton in advance

Surya Prakash Kushawah
  • 3,185
  • 1
  • 22
  • 42
AR5
  • 41
  • 7
  • 2
    i dont think you an get them as they were, the variable names , even method names could be some random characters or just like `integer1` `string5` and so, because when they are compiled names are not stored, every thing is changed to operations and addresses , so when they are reversed back they are filled just with random characters or meaningless words. – Yazan Nov 28 '16 at 08:55
  • Just read this. you will get idea. https://www.tutorialspoint.com/tika/tika_extracting_class_file.htm – Amol Nage Nov 28 '16 at 09:13
  • Yea I was also getting some random strings in place of var name and method name. – AR5 Nov 28 '16 at 09:43
  • Thanks for the link... I wi'l try it out. – AR5 Nov 28 '16 at 09:44
  • Possible duplicate of [Is there a way to get the source code from an APK file?](https://stackoverflow.com/questions/3593420/is-there-a-way-to-get-the-source-code-from-an-apk-file) – Kamil Kiełczewski Jun 10 '17 at 14:28

2 Answers2

0

Nope, you can't. Unless going through reverse engineering process, something like dex2jar...

shanwu
  • 1,493
  • 6
  • 35
  • 45
  • Tried dex2jar and all....Even after using, the java file I am getting is having some meaningless var name/method name which makes the entire file looks strange. – AR5 Nov 28 '16 at 09:45
  • @AR5 Sorry ,buddy. I guess your apk file is also protected by the proguard... that means the source code is obfuscated. Usually, it will take days for reverse engineers to go through the reversing process... – shanwu Nov 28 '16 at 10:42
  • @AR5 Sorry ,buddy. I guess your apk file is also protected by the proguard... that means the source code is obfuscated. Usually, it will take days for reverse engineers to go through the reversing process... – shanwu Nov 28 '16 at 10:42
  • oh. can u pls guide me what is this reverse engineering process? – AR5 Nov 28 '16 at 11:01
0

The first step is to extract your APK archive and copy the file named classes.dex to some other directory. Next you need to convert your dex file into jar format.
For that you can use this library. Bear in mind that you have to build it first using gradle.
The final step is to decompile your java class files into proper java files. Use this tool.
Voila, you have your source code. That is if you haven't used Proguard to obfuscate your code.

2hamed
  • 8,719
  • 13
  • 69
  • 112