I'm trying to compile an application but I'm having no luck.
I can't even compile an untouched app, i.e., if I decompile mms.apk (no errors at all) and I tried to compile right on, it doesn't work!
I have done this before when I still used windows 7 so idk why it isn't working.
One thing I noticed is that the frameworks get installed to C:\Windows\system32\config\systemprofile\apktool\framework\1.apk
is that okay? I'm using windows 8 now if that makes any difference.
anyway, here is the output I get:
Thank you!
install the framework of your phone like this
apktool if framework-res.apk
The file that is located at C:\Windows\system32\config\systemprofile\apktool\framework\1.apk could not be read properly.
It may be due to the fact that you didn't have permission to write the file initially during the apktool if framework-res.apk command. As you can see, during decompile apktool must load the frameworks so it can properly resolve resources during decompile. The first few lines of that error indicate apktool couldn't pull that file correctly.
I would do what Cristi said above, except make sure your in a admin launched command prompt window, so that you'll have permission to read/write to all portions of the C drive.
I think you should use the updated version of APKTtool:
Download APKTool
Put all three files (aapt.exe, apktool.jar and apktool.bat) in one folder.
Then goto that folder directory using cmd and type apktool d apkname.apk.
Related
I tried the apktool, and even the online version, http://www.decompileandroid.com/
But still can't get something that works in eclipse.
I want to decompile an app called bucket drops, which was made as part of an android course. I want to look at the source code and tweak it.
When I tried decompiling the .apk file it lacked the .classpath and .project files, so I made a new project in eclipse and copied the source code into it, but for some reason eclipse shows that the app is buggy!
What do I do?
How-To: Decompile/Recompile apk's with ApkTool
Requirements:
ApkTool
Java JDK/JRE 32 bit
Basic Cmd/terminal knowledge
Download ApkTool here
ApkTool.zip
first you need to extract that zip folder to anywhere you choose, preferably on root of c/drive ie: C:/android/apktool extracting the files to 'apktool' folder
Now place the STOCK framework-res.apk & whatever other apk's you would like to modify into the 'apktool' folder
Getting to CMD directory
Open up a Cmd Prompt (terminal) and get to the 'apktool' directory ie:
Your cmd will probly look like this..
C:\users\yourname>
so type in
cd.. (yes include the '..' and press enter after you type each command)
this will get you to back directory so now you will see
C:\users>
so type again
cd..
you should now see this:
C:>
now type in:
cd 'apktoo'l/'directory'
for me it looks like:
cd android/apktool
now you should see:
C:/android/apktool>
and you are in the apktool directory :D
Click to expand...
Installing Framework
Now that you are in directory we need to install the device's framework to your system for it to compile correctly so type this:
apktool if framework-res.apk
this will install the devices framework to your system (need to do this)
Decompiling
now to decompile the apk you want to edit.. type this:
apktool d framework-res.apk framework1
or
apktool d music.apk music
music.apk is the apk your decompiling
music is the folder you're creating for the decompiled apk
now make your edits :D DO NOT Change/Edit ANY PNG's
Recompiling/Finished Product
now to recompile your new apk type this:
apktool b music music-new.apk
or
apktool b framework1 framework-res-new.apk
framework1 is the folder with your edited files
framework-res-new.apk is your new apk file :D
Now we are NOT done... we cannot use the new apk's... we have to take what we did and add it back to the original apk file to keep proper signature :D
use something like 7zip, take the 'resources.arcs' file and any other xml files you edited out of the "-new" apk and copy them into Original apk
now the apk is ready to flash with your new changes :D :D
Hope this helped some of you new themers out there!!!
Source: AndroidForums
One of my colleague has written a ruby Gem to address this problem, It can decompile an Apk and open it's code in a friendly GUI.
apkToJava is the gem name. you should try it once.
It's an easy to use tool which just take two to three commands to get an Apk decompiled.
gem install apkToJava
apkToJava setup
apkToJava /path/to/apk/file.apk
As of now its support only two operating systems Mac OS and Linux.
A friend of mine once gave me a Java project on offline browser. It contains all class file as well as Java sources but I don't know how to run it or how can I check how it works . It doesn't contain any database or applet. please help
If you want to run a java .class file, open the terminal (if you are using Unix machine) or the command line (if you are using a Windows machine) and type java filename Note: filename does not include the .class extension, just use the name of the file and do not include the extension.
If you get an error this probably means you don't have java installed.
Import it into Eclipse or NetBeans and then click "run"...
That would be the simplest solution in my mind
I need to modify an existing APK, modify the sources and then recompile it.
I can decompile it using dex2jar or apktool, it's working great
From the jar file I can obtain the java sources (using jd-gui)
Then I can modify the java files
But now I would like to know how to recompile the java files and put them back into a jar file! (the jar part should be easy, the main problem seems to be how to recompile the java files for android)
I know that an other solution is to use apktool and then modify the smali files, but it seems to be really complicated when we want to add a lot of code!
My application is a basic a HelloWorld whitout obfuscation.
Thanks to Chris Jester-Young I managed to make it work!
I think the way I managed to do it will work only on really simple projects:
With Dex2jar I obtained the Jar.
With jd-gui I convert my Jar back to Java files.
With apktool i got the android manifest and the resources files.
In Eclipse I create a new project with the same settings as the old one (checking all the information in the manifest file)
When the project is created I'm replacing all the resources and the manifest with the ones I obtained with apktool
I paste the java files I extracted from the Jar in the src folder (respecting the packages)
I modify those files with what I need
Everything is compiling!
/!\ be sure you removed the old apk from the device an error will be thrown stating that the apk signature is not the same as the old one!
I know this question is answered still, I would like to pass an information how to get source code from apk with out dexjar.
There is an online decompiler for android apks
Upload apk from local machine
Wait some moments
Download source code in zip format
I don't know how reliable is this.
#darkheir Answer is the manual way to do decompile apk. It helps us to understand different phases in Apk creation.
Once you have source code , follow the step mentioned in the accepted answer
Report so many ads on this links
Another online Apk De-compiler #Andrew Rukin : http://www.javadecompilers.com/apk
Still worth. Hats Off to creators.
The answers are already kind of outdated or not complete. This maybe works for non-protected apks (no Proguard), but nowadays nobody deploys an unprotected apk. The way I was able to modify a (my) well-protected apk (Proguard, security check which checks for "hacking tools", security check, which checks if the app is repackaged with debug mode,...) is via apktool as already mentioned by other ones here. But nobody explained, that you have to sign the app again.
apktool d app.apk
//generates a folder with smali bytecode files.
//Do something with it.
apktool b [folder name] -o modified.apk
//generates the modified apk.
//and then
jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore ~/.android/debug.keystore modified.apk androiddebugkey
//signs the app the the debug key (the password is android)
//this apk can be installed on a device.
In my test, the original release apk had no logging. After I decompiled with apktool I exchanged a full byte code file without logging by a full byte code file with logging, re-compiled and signed it and I was able to install it on my device.
Afterwards I was able to see the logs in Android Studio as I connected the app to it.
In my opinion, decompiling with dex2jar and JD-GUI is only helpful to get a better understanding what the classes are doing, just for reading purposes. But since everything is proguarded, I'm not sure that you can ever re-compile this half-baked Java code to a working apk. If so, please let me know. I think, the only way is to manipulate the byte code itself as mentioned in this example.
First download the dex2jar tool from Following link
http://code.google.com/p/dex2jar/downloads/list
Extract the file it create dex2jar folder
Now you pick your apk file and change its extension .apk to .zip after changing extension it seems to be zip file then extract this zip file you found classes.dex file
Now pick classes.dex file and put it into dex2jar folder
Now open cmd window and type the path of dex2jar folder
Now type the command dex2jar.bat classes.dex and press Enter
Now Open the dex2jar folder you found classes_dex2jar.jar file
Next you download the java decompiler tool from the following link
http://java.decompiler.free.fr/?q=jdgui
Last Step Open the file classes_dex2jar.jar in java decompiler tool now you can see apk code
I know this question has been answered and I am not trying to give better answer here. I'll just share my experience in this topic.
Once I lost my code and I had the apk file only. I decompiled it using the tool below and it made my day.
These tools MUST be used in such situation, otherwise, it is unethical and even sometimes it is illegal, (stealing somebody else's effort). So please use it wisely.
Those are my favorite tools for doing that:
javadecompilers.com
and to get the apk from google play you can google it or check out those sites:
apk-dl.com
apkpure.com
On the date of posting this answer I tested all the links and it worked perfect for me.
NOTE: Apk Decompiling is not effective in case of proguarded code. Because Proguard shrink and obfuscates the code and rename classes to nonsense names which make it fairly hard to understand the code.
Bonus:
Basic tutorial of Using Proguard:
dex2jar with jd-gui will give all the java source files but they are not exactly the same. They are almost equivalent .class files (not 100%).
So if you want to change the code for an apk file:
decompile using apktool
apktool will generate smali(Assembly version of dex) file for every java file with same name.
smali is human understandable, make changes in the relevant file,
recompile using same apktool(apktool b Nw.apk <Folder Containing Modified Files>)
I know this question is answered still and I am not trying to be smart here. I'll just want to share another method on this topic.
Download applications with apk grail
APK Grail providing the free zip file of the application.
This is a way:
Using apktool to decode:
$ apktool d -f {apkfile} -o {output folder}
Next, using JADX (at github.com/skylot/jadx)
$ jadx -d {output folder} {apkfile}
2 tools extract and decompiler to same output folder.
Easy way: Using Online APK Decompiler
https://apk.tools/tools/apk-decompiler/ (recommended)
http://www.javadecompilers.com/apk
https://www.apkdecompilers.com
We accidently got some JAVA source files deleted from the system.
This happened when We checked out a folder from repository directly as an eclipse project and then tried to copy a folder from another eclipse project into this one.Strangely all those folder files have vanished from local system (and obviously they never made it to SVN repository).
Somehow We have obtained .svn-base files for some CLASS files.Now We are trying to decompile class files to obtain the source code back. However some of the class files are giving error "invalid input file" when jd compiler is trying to process them.
Is there any other solution to this ?
From what I can tell, "jd-gui" is closed source, so you may need to contact the developer to find out what that message means. (If it was open source, we could just look at the source code to figure out what the likely problem was!)
However, one thing is clear from various questions that Google shows up, and that is that "jd-gui" doesn't understand how to decompile archives (JAR, EAR, etc). So maybe you just need to un-JAR something to make it work.
The other thing you could try (first) is to see what "javap" makes of the class files that "jd-gui" doesn't like.
Try using JAD to decompile your files.
www.varaneckas.com/jad/
You may need to unzip your jar files and then run something like the following to decompile them all
find <srcdirectory> -name *.class -exec jad -s .java -r -ff -clear -debug -d <dest directory> {} \;
I havent tested the above command but hopefully it is almost there...
I also had the error "invalid input file" with a certain class file. I was using version 0.3.6 of jd-gui. After downloading the newest version of jd-gui (which was 1.6.6 at the moment of writing this) I could decompile the class file which previously failed.
So if someone still has this problem it makes sense to check the version and upgrade if it is an older one. Here is a link to the "Latest-Release"-download page:
http://java-decompiler.github.io/
I tried to figure out how I can build a final version of fullcalendar.js from github. On github, the src files is compound of multifiles and the final version is unique...
The indication on github is the following but I didn't catch what I have to do
You must have a Java runtime environment (accessible by the java
command) for minification. Then, run make zip and check the dist/
directory for your newly created ZIP archive. To start fresh, run the
make clean command.
The github page is https://github.com/arshaw/fullcalendar. If anyone has an idea where to find a tutorial to explain how to minify for dummies I would be pleased....
I try to use the console Windows. Then to write java. Return, then write make zip Return and then I get a error message...
From the Github page it looks like the Makefile handles the minification for you. Just make sure you have a JRE installed and from the command line navigate to the repository directory and run make zip, and your zip should be in the dist/ folder.
I had to use my vmplayer running centos 6 to run this command. Appearantly we are expected to know that we have to be on linux to do the compile. I too tried to do this on Windows 7 at first but ended up on linux.