App Recovery - Decompiling Android Project Classes From APK - android

I am currently working on an android app but my hard drive unfortunately crashed and I lost all the data on it... I am trying to recover my source code from the debug APK I had installed on my phone (using dex2jar and jd-gui) however, it seems like the classes are not present in the classes.dex and classes2.dex (both files are tiny and do not contain any of the classes in my code, see photo).
I used apk extractor to get the apk from my installed app and I cant seem to get anything close to my original classes... I am wondering if I am doing something wrong to get the APK from the installed app; any help would be greatly appreciated.
Thanks.

For de-compiling your APK to Java classes you can go to this site -
http://www.javadecompilers.com/apk
Just upload your apk and click on decompile. It should work for you !

Related

How do I replace resource file in foreign .APK?

today I tried to replace default sounds for the TickTick app with custom ones, but I failed miserably. I tried apktool to decompile the app, replace the sound files in resources, compile it back, but this is the end for me, because apktool doesn't work with my setup (Ubuntu 21.10), not even if I run apktool d base.apk; then immediately apktool d base. It just crashes with this error.
So I tried directly modifying .apk file, replacing sounds, zipaligning result and signing the app (tried apksigner, jarsigner); also tried deleting whole META-INF, not deleting it, deleting only .SF, .RSA files.
When I use the combination of not deleting META-INF, modifying the sound files, zipaligning/not zipaligning before signing, then signing the app it can be installed, but when I try to run it, only black screen gets displayed.
Logcat gives me below information.
04-15 19:09:29.442 E/AndroidRuntime(26166): at com.ticktick.task.TickTickApplicationBase.initKernelManager(TickTickApplicationBase.java:2)
04-15 19:09:29.442 E/AndroidRuntime(26166): at com.ticktick.task.TickTickApplicationBase.onCreate(TickTickApplicationBase.java:19)
04-15 19:09:29.442 E/AndroidRuntime(26166): at com.ticktick.task.TickTickApplication.onCreate(TickTickApplication.java:1)
Since I cannot turn on debug mode, because apktool doesn't work for me I am lost. Is there anyone with more knowledge on this subject than me, who would be willing to help?
Thanks for reading this far.
So it turns out apktool currently has a bug, so once I used workaround from user Gourov, I was able to use apktool. I encountered another problem however - APK exported from my mobile wouldn't start once altered, so I went to apkmirror.com to retrieve APK for the app, decoded it using apktool, replaced audio files with mine, built it using apktool, signed it with apksigner, installed it on my phone using adb install and it just works :)

How to extract source code from installed app?

I was developing an Android app for more than a month, but my computer crashed and I lost all the code from it. I have a compiled app installed on a test phone and tablet. Is there any way to extract source code from it?
I followed some guide for game modders (they are probably doing something similar), and I have extracted .apk with an app called Total Commander. Now the guide states that I should extract it with the apktool. But all files are still in binary (when I opened them I got random chars). Now, is there any tool (for Linux) that can decompile .apk back to source code, or maybe some feature of apktool I miss?
Note: I also tried this answer from 10 but also without success.
EDIT: javadecompileonline also did not decompile binaries correctly,
so this should be .json file:
<m*/��%kي%jTƴ���69/�t��
č �Cx���Q�đš?������i�
ć���/��i�JRᙱg�.�s
First you go to Android studio's welcome page there is a option to extract source code from APKs.
Another way is to install this apk extractor application from play store then you can extract source code from APKs Link : https://play.google.com/store/apps/details?id=com.ext.ui

Android Apk to Pure Java files

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
Nope, you can't. Unless going through reverse engineering process, something like dex2jar...
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.

Where do I find Androidmanifest.xml on my device?

I'm trying to modify the Androidmanifest.xml for the browser on my device so that I can execute an app by loading a URI in the browser.
I've been running around the file system in ADB SHELL all day, but can't seem to find it. Plus there is no FIND, nor LOCATE command on the system.
You can theoretically find the Androidmanifest.xml file in the APK.
Every APK contains the compiled source code of the application. There is no useable decompiler for APKs at the moment so it is not possible to change the content of one.
In addition to the compiled code and the other resources of the application, an APK also contains a signature from the developer, which will become invalid when the content is changed to verify the source of an APK. An Android system won't install an APK with an invalid signature, so even if you could change the content of the APK, you still couldn't use it.
The conclusion: You cannot do what you are trying to do.
Android Studio on Windows 10/11, it’s in: app/src/main.

Export apk from phone?

I compiled and ran a project on my phone through eclipse which is still install there currently. While doing some directory cleaning I accidentally deleted the source code so the only remaining version of the code is in the apk installed on my phone. Is there anyway to export the app back to my computer?? It isn't signed or anything either.
Thanks!
You can set up to be able to copy files on/off your phone via the USB connection - heres where you can look to find it:
Does Android keep the .apk files? if so where?
Then after you get the .apk off look at these questions for decompiling:
Is it possible to decompile an Android .apk file?
decompiling DEX into Java sourcecode
You CAN pull the APK off of the phone, but it's going to be Java Bytecode, not your source code (regardless of whether or not it's signed). You would have to reverse-engineer the classes to retrieve your code. If it's not a VERY large app, I'd say your time would best be spent simply re-creating it.

Categories

Resources