I made my android project and run the app on my phone. I got the apk file and also app but accidentally deleted app. Can anyone Help me out please.
If your apk not obfuscated by proguard or other third party also not build by signed. Probably you can use an software like Dex2Jar. But i am not really sure about this, you can try it. There are tutorial here
Reverse engineering your app is theoretically possible but hard.
1) Use the Apktool which would help generate a little code and the resource files.
2) Use the jadx tool which helps to produce Java source code from Android Dex and Apk files.
Next is to open a new Android Studio project, copy the manifest file generated by the Apktool into the manifest of the new project, Copy the resource files generated by Apktool to the res section of your new project, Copy the java files generated by jadx and place them in the src folder of your new project.
Try to build the app but you'll definitely run into several errors. Try following the messages to fix them.
Reverse engineering your app is very tedious and you still might not be able to build the app.
Goodluck :)
Added 24th November 2019
Just found this awesome article on how to go about Reverse Engineering an Apk.
Related
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.
I'm building phonegap app using phonegap-build.
I need to make some changes to the manifest of the android apk.
After i download the apk of my phonegap build, i rename it to .zip file to see the contents of the file.
When i open it, there i see the xml file there, and when i open that one, it has encoding problem.
This is what i see:
I understand it's a binary, but i need to see the content in plain english, if possible.
1) How can i encode it to see what is the content of this file properly?
2) After a change that i do on it, can i "decode" it back to binary?
So from what you wrote you wrote, you want to edit the AndroidManifest.xml from an APK file AFTER you built it, which is quite complicated. I suggest you editing the source AndroidManifest.xml and then re-building the APK. If you can't do this then please do the following.
(1) First, download and install Apktool. It is a free Android tool for decompiling and recompiling apps quickly. It provides access to .class files, resources and XML's. Here's a tutorial on how to install Apktool.
(2) Then you want to decompile your APK file (tutorial).
(3) Edit the AndroidManifest.xml file.
(4) Re-build the application (tutorial).
(5) Finally, you will have your APK file but it will be mostly useless as it is un-signed. You can't install un-signed apps as you will get an error (it may be possible to force-install it using root or adb tho) and you can't publish them. To sign it you can check out this link.
IMPORTANT INFORMATION: Your app will have to be signed with the same certificate with which it was signed the first time, otherwise it will be considered a different app. Not completely tho, you will have to un-install previous versions in order to install this one.
And yes, I know it's a very long and time-taking process but it is supposed to be, only if you have the source you should be able to edit the app.
As mentioned above, the tool you are looking for is Apktool.
You need to use --force-manifest flag when you decompile to decode AndroidmManifest.xml.
So im making a C# application which I want to be like a small configuration GUI where the user can input his own parameters and select some features, and according to those a xml file will be made and put in a prebuilt ready-to-build android project (in the asset folder). Now i'm struggling with the part where the C# application should compile the project and make a final apk. I tried to use ant but fail hard at understanding how to use it. Any help would be appreciated, but please be detailed im new to this kind of stuff.
This is a rather old question, but I'm going to answer it with my final solution.
I created a builder in C# by including the free apktool (and required files) in my project, which could decompile and compile an apk.
So what I did was after making my app, decompile it with apk tool, and then include the decompiled project with my c# project. The user generated a config file using the C# application, and it was deployed in the /assets/ folder of my app since my app expected it to be there.
Then I builded it again with apktool and signed using a debug keystore. (debug keystore is default if the user has no idea what that is, another keystore can be selected)
Keep in mind that, for this to work, the end user has to have java SE installed, I listed these 2 as "required" in my application (PC restart after installation recommended):
http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html
http://www.oracle.com/technetwork/java/javase/downloads/jre7-downloads-1880261.html
Hope this helps anyone finding this, rather old, post!
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.
I am facing problem in creating the .apk file using the ant script . The generated .apk named as _unaligned.apk instead of .apk and on installing the _unaligned.apk file to the device I get force-close showing the java.lang.VerifyError exception, but the same apk generated using IDE works fine. I am struck on this for a long time. Can you share the build.xml file that generates the .apk file?
this Bloq entry explains all necessary steps. Especially if you want to customize your build script.
If your are looking for the actual build script, just look into your Android SDK folder platforms/android-X/templates. There should be a file called android_rules.xml.
I customized my build script to clean, build, sign and distributing the apk to an attached device. If you like, I can provide you with my script. Just contact me!
You'll need to use zipalign & sign your apk with some key; as long as you're testing the app you can simply use the debug key with ant debug
At least that's what I understand from this page which you may want to read carefully.
What ant command are you running at the command / terminal prompt?
I have been having different problems with manually running ant (Repackage apk file to contain custom assets what build tool to use) and there might be some info on that thread to help you.
Alternatively, remember that one needs to sign the apk file before deploying it (see Joubarc's link).