[Q] Modifying APK files. Why won't "apktool" recompile? - General Questions and Answers

Modifying Mms.apk. I installed Java, and used the following command to decompile the .apk:
apktool.jar d Mms.apk
I then made my changes, and am trying to recompile with the command:
apktool.jar b Mms Mms.apk
The guides I'm following say this will create a "dist" folder within the Mms folder, containing the new (but unsigned) .apk file. This doesn't happen.
No output is given in Command Prompt.
A "build" folder is created, however. Inside is an "apk" folder. Inside of that is a "classes.dex" file.
Why won't apktool create the dist folder?
How can I get the recompiled apk file?

Mellowmarrow said:
Modifying Mms.apk. I installed Java, and used the following command to decompile the .apk:
apktool.jar d Mms.apk
I then made my changes, and am trying to recompile with the command:
apktool.jar b Mms Mms.apk
The guides I'm following say this will create a "dist" folder within the Mms folder, containing the new (but unsigned) .apk file. This doesn't happen.
No output is given in Command Prompt.
A "build" folder is created, however. Inside is an "apk" folder. Inside of that is a "classes.dex" file.
Why won't apktool create the dist folder?
How can I get the recompiled apk file?
Click to expand...
Click to collapse
Alternatively, if we can't figure out why it's not working, can someone compile it? I've attached the files.

Mellowmarrow said:
Alternatively, if we can't figure out why it's not working, can someone compile it? I've attached the files.
Click to expand...
Click to collapse
uhmm when building the apk you don't include the ".apk"
For example if I want to decompile app.apk, I type this:
apktool d app.apk
If I want to recompile, I type this:
apktool b app
YOU DON'T TYPE THE ".apk" AT THE END.
As for your Mms.apk:
1. "apktool d Mms.apk" > Correct
2. "apktool b Mms Mms.apk" > Incorrect
3. apktool b Mms > Correct
This is how it works:
1. If I have an app.apk in the APKTOOL directory, I decompile it by using the command apktool d app.apk
2. This will create a folder named app
3. If I recompile by using the command apktool b app, a new apk will be created inside the dist folder....inside the "app" folder

Related

Apktool Decompile/Recompile App Crashes

I am attempting to use apktool to decompile modify and recompile a app, but the app crashes as soon as it opens.
I have done the following.
I decompile the apk with:
apktool d sound.apk
without changing any code i recompile with:
apktool b sound
I then go into the sound/build/apk
and copy the contents into the original apk with winrar
I then sign with apk sign with:
signapk.jar certificate.pem key.pk8 sound.apk final.apk
The app install fine but crashes with "app crashed unexpectedly"
i did load the framework-res.apk which I pulled from my galaxy s 4g
Any Ideas?
corradokng said:
I am attempting to use apktool to decompile modify and recompile a app, but the app crashes as soon as it opens.
I have done the following.
I decompile the apk with:
apktool d sound.apk
without changing any code i recompile with:
apktool b sound
I then go into the sound/build/apk
and copy the contents into the original apk with winrar
I then sign with apk sign with:
signapk.jar certificate.pem key.pk8 sound.apk final.apk
The app install fine but crashes with "app crashed unexpectedly"
i did load the framework-res.apk which I pulled from my galaxy s 4g
Any Ideas?
Click to expand...
Click to collapse
Moved to proper forum.
wrong post

Re-Compile Framework-res.apk = Bootloop

Helo, sry for noobish thread but i can's solve my problem. This method allways work for me using Zte blade. But now on Xperia Arc it doesn't.
Im trying to change somethink in framework (values) , but first i try to re-compile framework to check. And what ? i got bootloop.
Im using
ApkMultiTool 1.0.6
ApkManager 5.0.2
apktool.jar
signapk.jar
First i decompile this clean stock framework (o errors), then i try to compile (0 errors, no changes inside framework) and i got bootloop.I sign new framework and put it in my rom zip file. Then i try to make it manualy, so i run ms command line :
java -jar apktool.jar d framework-res.apk
java -jar apktool.jar b framework-res.apk
Then Sign manualy :
java -jar signapk.jar certificate.pem key.pk8 framework-res.apk signedframewok-res.apk
AND ? BOOTLOOP :////////////////////
same prob
OmenHTX said:
Helo, sry for noobish thread but i can's solve my problem. This method allways work for me using Zte blade. But now on Xperia Arc it doesn't.
Im trying to change somethink in framework (values) , but first i try to re-compile framework to check. And what ? i got bootloop.
Im using
ApkMultiTool 1.0.6
ApkManager 5.0.2
apktool.jar
signapk.jar
First i decompile this clean stock framework (o errors), then i try to compile (0 errors, no changes inside framework) and i got bootloop.I sign new framework and put it in my rom zip file. Then i try to make it manualy, so i run ms command line :
java -jar apktool.jar d framework-res.apk
java -jar apktool.jar b framework-res.apk
Then Sign manualy :
java -jar signapk.jar certificate.pem key.pk8 framework-res.apk signedframewok-res.apk
AND ? BOOTLOOP :////////////////////
Click to expand...
Click to collapse
same prob here too happening.....i cant able to change theme....!!
Before decompiling you mmust install the .apk use this command:
Cd C:/.. navigate to your framework-res.apk
Once you in the folder where it is located use this command to 1)install:
Apktool if framework-res.apk
2)Decompile:
Apktool d framework-res.apk
3)Recompile:
Apktool b framework-res
4) new .apk is in .../framework-res/dist/
I think you forgot to install the .apk
Sent from my GT-I9001 using xda app-developers app
Diablob555 said:
Before decompiling you mmust install the .apk use this command:
Cd C:/.. navigate to your framework-res.apk
Once you in the folder where it is located use this command to 1)install:
Apktool if framework-res.apk
2)Decompile:
Apktool d framework-res.apk
3)Recompile:
Apktool b framework-res
4) new .apk is in .../framework-res/dist/
I think you forgot to install the .apk
Sent from my GT-I9001 using xda app-developers app
Click to expand...
Click to collapse
If he didn't install the apk, he wouldn't be able to not even decompile correctly.
OP: I also have this problem, but from what I read, after you recompile, you need to open the new and the old apk with WinRar or 7-Zip, copy the resources.src (or something like that) from the original framework-res.apk to the modified framework-res.apk. I read that this should do the job. I'm going to try that myself later when I get home. Good luck for you.
Sent from my LT26i with Tapatalk 2
You shouldn't sign any system apks, instead just copy over the META-INF folder and AndroidManifest.xml from original framework-res.apk to the newly compiled one.
kong said:
You shouldn't sign any system apks, instead just copy over the META-INF folder and AndroidManifest.xml from original framework-res.apk to the newly compiled one.
Click to expand...
Click to collapse
This simple comment of yours gave peace to my soul... THANK YOU SO MUCH!!!!!!
:laugh::laugh::laugh::laugh::victory::victory::good::good::good:
Great solution !!!!
kong said:
You shouldn't sign any system apks, instead just copy over the META-INF folder and AndroidManifest.xml from original framework-res.apk to the newly compiled one.
Click to expand...
Click to collapse
sorry for a 6 month later post, but i'm having the same problem and this solution isn't making sense to me..
edit: holy **** it worked
i compile first, I just drag them into the newly compiled apk
thank you!
eris72 said:
sorry for a 6 month later post, but i'm having the same problem and this solution isn't making sense to me..
edit: holy **** it worked
i compile first, I just drag them into the newly compiled apk
thank you!
Click to expand...
Click to collapse
For me it is not working. My phone keeps looping after rebooting it.
I tried with 7zip and winrar and it is not working.
1.- Decompile with apktool1.4.2
2.- Compile with apktool1.4.3 (in this step i was editing eri.xml I need to edit this file, but also without editing this file I have the same result)
3.- Drag the META-INF and AndroidManifest.xml from the original apk to the newly created one with 7zip(also tried with winrar)
4.- push the file to the phone (system/framework)
Actually right after pushing it I get an error message saying Unfortunately, C has stopped.
What am I missing?
Did you fix permissions before pushing back to system/framework
dutchmaster18 said:
Did you fix permissions before pushing back to system/framework
Click to expand...
Click to collapse
I decompiled and compiled, both processes with the latest version and that solved my problem
kong said:
You shouldn't sign any system apks, instead just copy over the META-INF folder and AndroidManifest.xml from original framework-res.apk to the newly compiled one.
Click to expand...
Click to collapse
really thank you worked for me!!!!
Helped........
kong said:
You shouldn't sign any system apks, instead just copy over the META-INF folder and AndroidManifest.xml from original framework-res.apk to the newly compiled one.
Click to expand...
Click to collapse
Thank you...it helped me to overcome a problem i was unable to solve....thank u very much...:good::good::good::good::good::good:
kong said:
You shouldn't sign any system apks, instead just copy over the META-INF folder and AndroidManifest.xml from original framework-res.apk to the newly compiled one.
Click to expand...
Click to collapse
Four years later and you're still saving frustrated XDA'ers.
Thank you!
Five hours of Googling and I finally have success.
Anyone know of a quicker workaround?
framework-res re/compile, push to phone
Hi have the problem with bootloop after overwrite framework-res.apk to /system/framework
use apktool2.2.2
phone note 3 with phronesis rom
I made
1.apktool if framework-res.apk (0 error)
2. decompile apktool d framework-res.apk (0 errors)
3. changed color.xml and styles.xml (only changed color text)
4. from orginal framework-res.apk drag resources.arsc to decompiled folder
5.make re-compile (apktool b framework-res) (0 errors) after this, program created new folder BUILD and DIST, in /build/apk/is META-INF, android manifest,RES folder and resources.arsc
Now i tried ( with tutorials ) drag from orginal framework-res.apk, folder META-INF, AndroidManifest.xml to BUILD folder and recompile second time (0 errors) then, from DIST folder i took framework-res.apk and overwrite to phone/system/framework and reboot = bootloop
Also trying after 1st re-compile, drag META-INF and androidmanifest.xml from orginal framework-res to newly recomplied framework-res.apk in DIST folder, again overwrite in phone/system/framework but still bootloop
before overwrite make permission rw-r--r- the same permisson of orginal framework-res.apk
then overwrited my apps example touchwiz, google play has stopped, reboot but unfortunately booloop
Any solution? ^^ thx
DrMalaN said:
framework-res re/compile, push to phone
Hi have the problem with bootloop after overwrite framework-res.apk to /system/framework
use apktool2.2.2
phone note 3 with phronesis rom
I made
1.apktool if framework-res.apk (0 error)
2. decompile apktool d framework-res.apk (0 errors)
3. changed color.xml and styles.xml (only changed color text)
4. from orginal framework-res.apk drag resources.arsc to decompiled folder
5.make re-compile (apktool b framework-res) (0 errors) after this, program created new folder BUILD and DIST, in /build/apk/is META-INF, android manifest,RES folder and resources.arsc
Now i tried ( with tutorials ) drag from orginal framework-res.apk, folder META-INF, AndroidManifest.xml to BUILD folder and recompile second time (0 errors) then, from DIST folder i took framework-res.apk and overwrite to phone/system/framework and reboot = bootloop
Also trying after 1st re-compile, drag META-INF and androidmanifest.xml from orginal framework-res to newly recomplied framework-res.apk in DIST folder, again overwrite in phone/system/framework but still bootloop
before overwrite make permission rw-r--r- the same permisson of orginal framework-res.apk
then overwrited my apps example touchwiz, google play has stopped, reboot but unfortunately booloop
Any solution? ^^ thx
Click to expand...
Click to collapse
1. apktool if framework-res.apk
2. decompile apktool d framework-res.apk
3. change color.xml and styles.xml
4. apktool b framework-res
5. drag from the NEW (dist folder) framework-res.apk this files (with zip editor): -res folder, -resources.arsc, -classes.dex (if you edited the smali too) to the OLD framework-res.apk
6. Now you can use the 'old' framework-res.apk with your phone, but now with your modifications.
I hope its help you. Sorry for the long time delay, but i just find now this therad
Make sure that you put the original manifest and meta folder back into the apk before pushing it. There's no need to resign unless you modify the manifest, all you should have to do is open the newly compiled app with winrar and add the contents of the originals folder. (Which is the manifest and meta folder)
Sent from my KYOCERA-C6745 using Tapatalk
kong said:
You shouldn't sign any system apks, instead just copy over the META-INF folder and AndroidManifest.xml from original framework-res.apk to the newly compiled one.
Click to expand...
Click to collapse
THANK YOU!!!
kong said:
You shouldn't sign any system apks, instead just copy over the META-INF folder and AndroidManifest.xml from original framework-res.apk to the newly compiled one.
Click to expand...
Click to collapse
Thanks... Your suggestion worked for me :good::good:
RealWelder said:
Make sure that you put the original manifest and meta folder back into the apk before pushing it. There's no need to resign unless you modify the manifest, all you should have to do is open the newly compiled app with winrar and add the contents of the originals folder. (Which is the manifest and meta folder)
Sent from my KYOCERA-C6745 using Tapatalk
Click to expand...
Click to collapse
Well that didn't work for me , im still getting bootloop

[Q] Different method to edit an Apk: differences?

Hi to all! What are the differences between this:
Rename the *.apk to *.zip
Extract the *.zip file
Edit whatever you want
Compress all files again
Rename the *.zip to *.apk
and this:
Download ApkTool and "install" it
Using CMD navigate to the *.apk folder
Use this command "apktool d app_u_want_edit.apk"
Edit whatever you want
Use this command "apktool b app_u_want_edit"
???
Thanks in advance.
apktool
Francoiky said:
Use this command "apktool d app_u_want_edit.apk"
Edit whatever you want
Use this command "apktool b app_u_want_edit"
Click to expand...
Click to collapse
.
Using apktool be more change.
Normally you do not make changes to the file classes.dex and resources.arsc included in the APK files.
.
ze7zez said:
.
Using apktool be more change.
Normally you do not make changes to the file classes.dex and resources.arsc included in the APK files.
.
Click to expand...
Click to collapse
So, if I would change graphics only I could simply unzip and zip again, right?
As long as they are not .9.pngs then this will work but it will only work for images. I would advice learning apktool as this is the proper way to do it and you have less chances of messing something up. Alot of images are indexed and if not done properly can lead you to a boot loop
Sent from the Bat Cave

How to guide decompiling/compiling systemUI.apk

If you are not having problems compiling SystemUI.apk with no problems then this is not for you
WARNING:
You should not attempt to do this on a device that does not have a recovery, because if something goes wrong you may have to reinstall your rom (not very likely though). You should probably back up SystemUI.apk You should also have some experience modding and some experience using Apktool and Linux.
INTRO:
If your having problems modding SystemUI.apk on JB then this thread is just for you. I recently found out how to mod the Jelly Bean SystemUI. Jelly Bean has made it very difficult to mod. Yes it is still easy to replace images, but if you want to do some major changes to the UI such as a 100 percent battery mod or changing the status bar color then you will need to know exactly how to do it. For example, if you get the UI decompiled without errors and you recompile it without errors YOUR RECOMPILED SystemUI.apk WILL NOT WORK and your status bar will disappear etc... There is a special way to get everything working and I will show you how.
STEP 1:
LINUX>>
Before we start I recommend that you have File Roller: one of the most popular archive managers for Linux (Ubuntu comes with it). If your distribution uses a Debian package manager (most popular ones do) then all you have to do is go into the terminal and type:
Code:
sudo apt-get install file-roller
Now you will have File Roller. You also will need java installed. Check if you have java by typing:
Code:
java
in the terminal. If you dont have java and your using a Debian package manager then type:
Code:
sudo apt-get install openjdk-6-jre
or download from the java website and install it.
WINDOWS>>
Before we start, you will need 7zip and java. Just search and you will find the programs to install
STEP 2:
Now we will install APKTOOL. You may already have it installed BUT your version will probably not work. I have ran around the internet for a modified apktool that wont give you errors (If you follow my directions). I came across a great thread. check it out and download all the tools their (dont forget aapt) http://forum.xda-developers.com/show....php?t=1755243. If you are in Linux rename the jar file to apktool.jar and move the the jar plus aapt to /usr/local/bin. You will need root. If you are in Windows rename the jar to apktool.jar and move it and aapt to your WINDOWS directory. You also need zipalign http://powerpoint45.webs.com/android/zipalign(I think this one is only for linux so if ur on windows either test this one or get zipalign from android sdk)move it to your WINDOWS dir/bin dir. You need one more thing. It is from the apktool websitehttp://code.google.com/p/android-apktool/. According to your os download either apktool-install-linux-r04-brut1.tar.bz2 or apktool-install-windows-r04-brut1.tar.bz2. Extract the contents. You only need one file from the archive. In linux move apktool (not apktool.jar) to /usr/local/bin. In Windows move apktool.bat to your WINDOWS directory. Dont jump ahead and say "Now that I got apktool set up, I know what to do", because it gets a lot more difficult than you are used to using apktool.
STEP 3:
Now that you have apktool set up, you need to know how to mod SystemUI.apk. Get SystemUI.apk from /system/app within your device onto the computer. Now make a backup of SystemUI.apk on your computer because we will NEED it later. So you need two SystemUI.apk files on your computer. You could name one “backup” if you'd like. So now now we need to decompile the apk. Go into the terminal/cmd and cd/chdir into the directory you have SystemUI.apk. Now type
Code:
apktool if SystemUI.apk
It will then install frameworkneeded.Then type:
Code:
apktool d SystemUI.apk
It will decompile the apk. It will take a bit of time for it to fully decompile. The decompiled code will be in a folder in your current directory called SystemUI. If It had errors decompiling, (IT WILL FOR MOST NEXTUS 7 ROMS) you will need to install framework manually. Download framework here:http://db.tt/Rpc6zskQ and place the two APK files into apktool framework folder (replace the old framework files). In Linux it is located at /home/yourusername/apktool/framework and in windows it is something like C:\\Documents And Settings\yourusername\apktool\framework. After that delete the SystemUI folder that was made by the bad decompiling proccess and repeat the decompile command.
STEP 4:
This is the part where you start modding. You can make many customizations to the UI this way as you probably know. I will just show you how to make a 100 percent battery mod. You need to go into the decompile folder (SystemUI) using a file manager, Then from SystemUI, go delete res/drawable/stat_sys_battery.xml and replace it with http://powerpoint45.webs.com/android...ys_battery.xml (to download that file right click on link and click something like "save link as"). Now you need to move to a new directory: /res. In that folder you need to look through all the directories that start with the word drawable. For example drawable-mdpi. There is one directory that your device uses for images but you may not know which one. Your device might be MDPI but use drawable-sw600dp from the UI instead of drawable-mdpi. So if you dont know or you want to be safe then search through the drawable folders and if their are any battery icons then remember you will need to add 100 battery icons to each one of the folders with battery icons. The battery icons are the ones named something like stat_sys_battery_0.png. So if you need to add 100 icons they need to be named in numerical order from stat_sys_battery_0.png to stat_sys_battery_100.png. Dont worry though, you wont need to rename 100 icons. Their ar many battery mods online that you can get them from, but I have some images you can download: http://powerpoint45.webs.com/android...RY_BLUE.tar.gz. Download it, extract it and copy all the images into all the drawable folders that contain battery icons. Now your ready for compiling; The step that is different than how we have always done it before Jelly Bean existed. keep in mind that some images can not be changed or edited at all durring this step because it will result with many errors durring compiling. You would have to add images to the archive after its compiled
STEP 5:
Like I said at the end of step 4, this step will be different than you have seen before. This is also the step where you will be using File Roller/7zip. To build the apk make sure you are in the terminal in the directory where SystemUI exists and type:
Code:
apktool b SystemUI almostdone.apk
almostdone.apk is the output file. Once it is done building you need to open the backup apk you made at the beginning with File Roller /7zip. Also open almostdone.apk with File Roller/7zip. From inside the backup.apk drag meta-inf folder & androidmanifest.xml to allmostdone.apk. Now all you need to do is zipalign the apk. Lets say your backup apk is named backup.apk. Go into the terminal at the directory you are working
in and type
Code:
zipalign -v 4 allmostdone.apk done.apk
This will optimize the apk. The output is done.apk.
STEP6:
Now you install the apk. Their are many meathods of installing the apk, here are a couple. Transfer done.apk to your device and rename it to SystemUI.apk. Now use a root browser or terminal app to replace the other SystemUI.apk on your system at /system/app. And make sure you give it the same permissions as all the other apk's in the system/app directory. Then reboot. Or you could make a flashable zip to install it.

[guide]how to decompile/recompile .jar files from your android phone

*ALWAYS HAVE A BACK~UP
DONT BLAME ME IF YOU MESS UP*
things needed
apktool mobile
root explorer
zarchiver
920 text editor
first
copy the .jar file to the apktool folder where you decompile and recompile things
next
using zarchiver...
go to the .jar file in the apktool folder
VIEW the files inside
*IMPORTANT*
VIEW ONLY ....DON'T EXTRACT
when you get inside the .jar file you will see two files inside
~Meta-inf
~classes.dex
copy classes.dex
paste it in the apktool folder
now
using apktool..
decompile classes.dex
you will get classes_dex folder as result
delete classes.dex file that you have in the apktool mobile
edit necessary files using 920 text editor
after editing desired files
recompile the classes_dex
if successful.
you will get classes.dex file
using zarchiver again
view .jar files inside
this time delete the classes.dex file inside
then add the NEW classes.dex you have compiled
finally push the new .jar file to your system/framework using root explorer
DONE

Categories

Resources