I think I am doing something wrong, and curious anyone know which specific versions of apktool will compile and decompile ICS and where might I be able to find them?
Thanks
I've had success with apk manager 5.0.2, as long as you register framework and system ui with your computer. My only issue so far is it doesn't like decompiling with dependencies, as it keeps telling me it isn't the right one, when it clearly is. I'm open to a better option too, if anybody has one.
When you say register you mean copy the framework, and systemui.apk file from the rom you are working on and do this command?
Code:
apktool.jar if framework-res.apk
What I did is download apktool one for decompile and one for compile bases on this thread:
http://forum.xda-developers.com/showthread.php?t=1427959
OK so this is what I did, I download apktools 1.4.2 and apktools 1.4.3. I am using 1.4.2 to decompile, and 1.4.3 to recomple.
So I created a folder called c:\apktools and put both apktool.jar in there but and renamed apktools.1.4.2 to apktools
and ran the following commands:
Code:
java -jar apktool-decompile.jar if framework-res.apk
then
Code:
java -jar apktool-decompile.jar d SystemUI.apk
then decompiled email.apk
Code:
java -jar apktool-decompile.jar d Email.apk
That all worked fine, now I wanted to see if I can recompile without even making a change before I started making changes, and ran this command after I renamed apktool to apktool1.4.2 and the 1.4.3 version to apktool.jar:
Code:
java -jar apktool-recompile.jar b Email
And it starts to build but then gets a ton of errors:
Code:
at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.jav
a:193)
at brut.androlib.Androlib.buildResourcesFull(Androlib.java:301)
at brut.androlib.Androlib.buildResources(Androlib.java:248)
at brut.androlib.Androlib.build(Androlib.java:171)
at brut.androlib.Androlib.build(Androlib.java:154)
at brut.apktool.Main.cmdBuild(Main.java:182)
at brut.apktool.Main.main(Main.java:67)
Caused by: brut.common.BrutException: could not exec command: [aapt, p, -F, C:\U
C:\Downloads\nexus\apktools\Email\AndroidManifest.xml]
at brut.util.OS.exec(OS.java:83)
at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.jav
a:191)
... 6 more
I would love to know what I am doing wrong.
Thanks
OK here is an update I was able to decompile and recompile framework-res, and SystemUI, using the method of decompile with 1.4.2, and then recompile with 1.4.3
I was able to decompile and recompile other apk using 1.4.3, for example Calculator.apk, But for some reason Email.apk will not recompile using same method.
Here is what I did so far that works:
1) install framework with apktool 1.4.2 - rename apktool.jar.1.4.2 to apktool.jar
Code:
java -jar apktool if framework-res.apk
2) decompile framework-res with apktool 1.4.2
Code:
java -jar apktool.jar d framework-res.apk
3) recompile framework-res with apktool 1.4.3 - rename apktool.jar to apktool.jar.1.4.2, then rename apktool.jar.1.4.3 to apktool.jar
Code:
java -jar apktool.jar b framework-res
I did the same eact thing with SystemUI, first decompile with 1.4.2 then recompile with 1.4.3 and it worked. Also as a test I was able to decompile and recompile SystemUI with 1.4.3.
I was able to decompile and recompile Calculator.apk using 1.4.3, but for some reason Email.apk will decompile but not recompile with either 1.4.2 or 1.4.3
If anyone has any ideas that be great.
Thanks!
Try to decompile with this apktool version and then recompile with 1.43
http://dl.dropbox.com/u/348210/apktool.zip
Here you go fellas, I saw this thread ages ago and only just stumbled across it again now. I have been using the apktool for a while now along with dsixda's kitchen as an extra add in.
Basically you will need to use the combination of tools attached in the zips.
Install the new aapt.exe in the windows directory (it comes from SDK16) and that will enable across all environment variables.
Then use the batch script called apktool to run install of framework
Code:
apktool if framework-res.apk
Once you have done that you can decompile any of the system apps with either apktool1
apktool2
or
apktool3
eg:
(and this IS only an example...I am not 100% sure what combination I DID use at the time?)
Code:
apktool1 d -f Mms.apk
then to rebuild
Code:
apktool2 b -f Mms
Use your ^ arrow or v arrow to shuffle through repeated scripts. like for example above if I didn't get a clean build I will push ^ and then try
Code:
apktool1 b -f Mms
Note: always call the -f force variable as it will induce the apktool to overwrite what is written to the directory and will not interferr with the next succession of build attempt.
if it fails again....then ^ and change 1 for the remaining number which is 3 like.. so
Code:
apktool3 b -f Mms
There is no consistency between ICS apps on the rebuild but almost all apps decompile with apktool3 in my scripts. In some instances widgets need to decompile with another one when you get a magic numbers errors, but essentially all will work with a combination of 1,2 or 3
There are 2 others in there also and they are for decompiling and recompiling the framework-res and SystemUI that people have had issues with.
it will be apktook-d-frame.bat
where "-d-" stands for Decompile
and obviously...
"-r-" stands for Recompile
All of these will work from the same directory. as in no getting confused wich jar you renamed to what cause they all look the same when you rename them to apktool.jar LOL (I kept the version number suffix appended for a reason haha) - You don't want to be checking MD5 # against on the website at midnight now do you?
And a working example so no one is confused
Code:
cd\apktool
now at C:\apktool\
At the start I would always do this:
tip
dir *.bat for my listings
use ^ to scroll up and check for reverence
now...where was I? oh yes example....here you go
Code:
apktool if framework-res.apk
(installs)
Code:
apktool-d-frame d -f framework-res.apk
go into windows explorer and fiddle round a bit throw a few pngs here and there and everywhere, make a big mess of a theme .....AND
Code:
apktool-r-frame b -f framework-res
and it will rebuild perfect as!
Now we want the to reuse the META-INF from the original apks unless you want to resign, but the rule of thumb is never resign the system apps unless you want to resign all system apps with the same signature. It is much easier to open "apkoriginal" in 7zip and then open "apkthemed" in the other zip (hint this is located inside the <dist> folder in the apk folder tree from the apk you just broke down) and then drag META-INF from orig over to new.
Push with adb back to phone, or in my case I really like to see a visual of what I am doing (that and I can see an update on apk size attributes on the fly) using Android Commander or Droid Explorer (either are great tools) you can reset the permissions on the file and reboot from the interface using either of these two tools.
Pros and Cons
Pro
Droid Explorer looks more pollished and fancier.
Droid Explorer has a much better representation of symlinks in system
Con
Droid Explorer sometimes does not get root permissions even though it claims that it has? Doing the visual check on the file attributes (i.e. file size) and you will see that the push of the apk file did not happen?
Droid Explorer does not have a good gui for file permissions compared to commander.
Pro
Android Commander will usually almost everytime push the file that you want where you want it every time.
Android Commander has a great gui for permissions (makes up for where it suffers everywhere else compared to droid explorer
Con
Android Commander is hard to tell what is symlinked and what isn't visually...I have looked a systemdump just to be certain sometimes lol
Android Commander sometimes just will not initiate what so ever...it will sit pending and pending and pending and it will **** you to tears....I have no idea what is worse? A windows app like Android Commander not executing or a windows app like Droid Explorer executing and lying about what it did? haha
Lastly to note. Neither of these apps perform complete system locks so when you pull and push apps do not remote the app if it is a system app i.e. delete it. even if you have it pulled to your desktop ready to theme...when you are at max capacity on your system partition. You will quickly learn that apps are greedy and take up space when they are allowed to breath (like a fat chick lycra that **** is not getting back in there!) what happens is you go to push your app back and all of a sudden WTF? There is no room? How can that be?.....hmmmm ok I will remove a couple more apps seeming I think framework-res.apk is of somewhat higher priority compared to say calculator n ****......oops well 3 or 4 apps later I decided to do a system restore and flash my new framework from recovery instead
So hopefully this gives a comprehensive run down on what you need to do and can or cant do. Good luck. Hit thanks if this has helped....it took me a lil while to pull together for you all.
James
ignore the bit about small system partition...just realised this is Galaxy Nexus not Nexus S (like Galaxy S) you guys should for AFAIK have plenty of system space.
PS: Sorry about the the visual of the fat chick in lycra, I am almost certain that did not entertain, but I do hope that the rest of the post was worth that pain. Goodbye
---------- Post added at 05:10 AM ---------- Previous post was at 05:07 AM ----------
PPS: The install of my apktool with the upgraded aapt SHOULD allow Android Commander and/or Droid Explorer apps to now function using your devices. Ignore Droid Explorers image of what ever it places as the phone to sync to.....LOL I would like to know what that is seeming your Galnex users
Related
Hello,
I have been reading up and followed some instructions to make a transparent notification background.
I used ADB to pull framework-res.apk and services.jar from my phone (running MCR R9) and replaced the status_bar_background.png in the framework-res.apk (I didn't extract, just dragged the replacement png in to the "zip") and then I followed the following instructions to edit the services.jar:
It's not really hard to do it on your own:
First download smali.jar and baksmali.jar from here http://code.google.com/p/smali/
Open the services.jar file for example with winzip, 7z, winRar, or whatever.
Unzip the classes.dex file to your sdk/tools/ folder and place the baksmali and smali file there too. After that open a new commandbox an run following line:
java -jar baksmali.jar -o out/ classes.dex
You'll have a new folder now called "out". Browse to "out/com/android/server/status" and open the file called StatusBarService.smali with a text editor like notepad.
Search for ".line 1773" and you'll find also "const/4 v5, 0x2"
Just change this to "const/4 v5, -0x3" and save the file.
Open again a new commandbox and run this:
java -Xmx512M -jar smali.jar out/ -o edited-classes.dex
Now you'll have a new dex file called "edited-classes.dex".
Delete the old file an rename the new in "classes.dex".
Open again the services.jar file with any zip tool and overwrite the classes.dex file with the one just created.
-------------
I then used update packager to create a signed update.zip of both the framework-res.apk and services jar (they were in a subfolder called framework and the script was set to copy the folder to SYSTEM) but I just get a bootloop and a whole load of force closes.
Can someone who is making themes please help me out and tell me what I am doing wrong?
Many thanks in advance
David p
Tried again following the instructions on this thread http://forum.xda-developers.com/showthread.php?t=732370 and using xUltimate-TP.exe but still ended up with a bootloop. Thank goodness for Nandroid!
I would still appreciate a helping hand though if any themers care to assist.
Thanks
David P
Ok everyone, this is my first tutorial that I am ever putting out and I will try to be as thorough as possible. This tut is not so much for the people that dont know much about android, it is more for the people that understand most of it already. But as always feel free to read through it and start learning as most of us around here have! So without further a do lets get started!!
FIrst you need 7-zip!!! So go install it!!
So first, the first thing you need to do is go to this link and download the apktools and aapt that are in the zip:http://www.mediafire.com/?acrgcd0w850q0gj
After you extract this zip you will have a folder with all the tools we will need to do this!!!! Now, if you are doing this then you probably already have done it on Ice Cream Sandwich or Gingerbread. So the next thing we need to do is remove your "Environmental Variables". Environmental Variables are basically the commands that you can run in command prompt from any folder on the computer. If you have the android sdk or previously have tried to decompile and compile Apk's chances are you have the setups in the Environmental Variables.
Remove Unneeded Environmental :
1)Hit the start menu on the bottom left hand corner of Windows
2)Right-Click on Computer and select Properties
3)On the top left-hand corner select Advanced System Settings
4)A window comes up and select the button that says "Environmental Variables"
5)In the window that comes up there is two boxes. We are going to edit the bottom one labed "System Variables". Now grab the scroll bar and look for the variable Path. It should be under OS and above PATHEXT. Double-Click "Path" Variable
NOTE: Each path ends in a ";"
6) So now you will need remove every instance that would point to anything android related. For example one is "C:\SDK\platform-tools\;" If it has this then apktools will run the aapt.exe from that platform-tools folder instead of the one that is provided in the zip.
ALTERNATIVE: An alternative would be to delete the aapt that you have in your folder that you have in your Path System Variable.
I know this was not very clear but I again this is for the users a bit more advanced.
-------------------------------
DECOMPILE/COMPILE SystemUI.apk and other Apk's. EXCEPT framework-res.apk
Ok, you can do this however you want but for this tut I am going to extract apktools.zip and place the folder on my desktop. So we're going to open the folder and then place the APK we want to edit along with a JELLYBEAN framework-res.apk into the folder. For example if you want to edit a CM10 "SystemUI.apk" then you will pull the framework-res.apk from /system/framework/ folder nd place it in your desktop JBapktools folder.
Once you have both SystemUI.apk and framework-res.apk inside the JBapktools folder we are ready to start. First rename either one of these files "apktool149.jar" "apktool142.jar" "apktool144.jar" to just apktool.jar. REMEMBER only rename ONE cus we need to keep track of the versions of the apktools.
Next, bring up the folder window and anywhere on the white space hold SHIFT and Right-Click. Then youre going to choose open command window here.
The first command is going to be: java -jar apktool.jar if framework-res.apk
This is going to install the framework.
Now close out the window.
Next go back to the folder and make sure you rename the jar file you renamed earlier back to its original name. For example if you have apktool144.jar and apktool149.jar in the folder then you must rename apktool.jar to apktool142.jar because that is its original and actual version number.
To decompile and recompile SystemUI.apk you need apktool149.jar so once all three are named to their real names then rename apktool149.jar to apktool.jar.
Now,YOU ARE READY!!! Finally.
Again, In the folder SHIFT +Right-Click and select open command window here.
the command to decompile is: java -jar apktool.jar d SystemUI.apk
---------------------------------------------------------------------------------------
Then hit enter you should see something like this:I: Baksmaling...
testI: Loading resource table...
I: Loaded.
I: Loading resource table from file: C:\Users\Jose\apktool\framework\1.apk
I: Loaded.
I: Decoding file-resources...
I: Decoding values*/* XMLs...
I: Done.
I: Copying assets and libs...
---------------------------------------------------------------------------------------
Of course it wont say Jose but it will say your User Accounts name.
Now in the folder you should see another folder in there called SystemUI. Now its DECOMPILED!!!!! WHOOOOO!!!!!!
You can make your edits and edit the pngs and xmls or the smali or whatever your guru-self wants to do.
Now to RECOMPILE!!!!!
To recompile we will still be using apktool149.jar so no need to rename anything back or whatever.
The first thing you should do is open the SystemUI.apk in 7-zip. You can right-click SystemUI.apk and in there, there should be a META-INF folder and a AndroidManifest.xml file. Select both of these be selecting one first(should be highlighted blue) the holding down Cntrl button and selecting the other file. Now that they are both selected click and drag out to apktools folder. We will need these files in a little bit.
Next in the command prompt window, or if you closed it, the reopen by SHIFT+Right-Click and selecting open command window here. The command to decompile is:
java -jar apktool.jar b SystemUI
NOTE:Make sure you use the letter "b" and dont add .apk to the end of it as we are recompiling the FOLDER and not an actual apk file like we do when decompiling.
It should say something like this:
I: Checking whether sources has changed...
I: Smaling
I: Checking whether resources has changed...
I: Building resources...
I: Building apk file...
Sounds very sexy when reading it I know but we aren't done yet. Remember the META-INF Folder and the AndroidManifest.xml file we pulled out earlier. Ok from the apktools folder select both files again by using Ctrl button. Now type Ctrl C. This will COPY these files to the clipboard. Now that we have the files copied go into SystemUI FOLDER and then go into build folder and then into apk folder. To make it look more neat navigate to /Desktop/apktools/SystemUI/build/apk/ . Now that you are in the apk folder hit Ctrl V. This will PASTE the META-INF and AndroidManifest.xml file into the folder. If a window comes up just choose COPY AND REPLACE.
Last thing to do before we can compile is to go into /SystemUI/dist/ and delete the apk file that is there. The recompiling process is almost complete!!! Go back to command prompt window and just push the ARROW UP on the keyboard. This should bring up the last command you typed in. If its not there then just type it in again:
java -jar apktool.jar b SystemUI
The final apk file should be in SystemUI/dist/ folder!!!!
If you are having any aapt problems then you probably still have a path in Environment Variables that has an aapt.exe in it. Other than that askk and I'm sure myself or someone else can help!!
I will be putting up the how to decompile/recompile framework-res.apk in 2nd post tomorrow or soon because I dont have time right now. The process is different. Have fun themeing and doing whatever it is you do!!!
Added a donate link guys. I'm only 16 so I can't say buy me a beer! So how bout half a gallon of gas? That would be great. Let me know if you donated to I can thank you and put you in my posts!! I have a passion for doing these things so I do not expect any donations from anyone. I do it because I love it and can't get enough of it!! Thanks everyone for being supportive
Donations: Marcismo55
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=GL7RKF2EGCH68
FUERRER!!!
1 more just in case
nice
Sent from my Axiom Infekted Razr Maxx using Xparent ICS Blue Tapatalk
Hey man, nice write up. Always good to see people share information.
However, you made it WAY more complicated than it needs to be.
+1 either way. Get you some gas.
_Burst_ said:
Hey man, nice write up. Always good to see people share information.
However, you made it WAY more complicated than it needs to be.
+1 either way. Get you some gas.
Click to expand...
Click to collapse
Sorry man I tried my best :b. And thanks!
Sent from my SPH-L710 using XDA App
Hi,
I was just wondering if the is anyway to decompile the framework-res.apk
I have been trying for ages, but it always gives me errors.
Thanks in advance
Cheers
Corey
fishingfon said:
Hi,
I was just wondering if the is anyway to decompile the framework-res.apk
I have been trying for ages, but it always gives me errors.
Thanks in advance
Cheers
Corey
Click to expand...
Click to collapse
Grab an ICS framework-res apk. Replace manifest resources.arsc and res from the ICS apk with the one from jb apk. Then dexompile with apktool142.jar and then edit. Then recompile with apktoll144.jar. then open the apk that recompiled and take out manifest resources.arsc and res and place back in jb framework sorry if its to confusing. But just a quick write up
Sent from my SPH-L710 using XDA App
monstaX said:
Ok everyone, this is my first tutorial that I am ever putting out and I will try to be as thorough as possible. This tut is not so much for the people that dont know much about android, it is more for the people that understand most of it already. But as always feel free to read through it and start learning as most of us around here have! So without further a do lets get started!!
FIrst you need 7-zip!!! So go install it!!
So first, the first thing you need to do is go to this link and download the apktools and aapt that are in the zip:http://www.mediafire.com/?acrgcd0w850q0gj
After you extract this zip you will have a folder with all the tools we will need to do this!!!! Now, if you are doing this then you probably already have done it on Ice Cream Sandwich or Gingerbread. So the next thing we need to do is remove your "Environmental Variables". Environmental Variables are basically the commands that you can run in command prompt from any folder on the computer. If you have the android sdk or previously have tried to decompile and compile Apk's chances are you have the setups in the Environmental Variables.
Remove Unneeded Environmental :
1)Hit the start menu on the bottom left hand corner of Windows
2)Right-Click on Computer and select Properties
3)On the top left-hand corner select Advanced System Settings
4)A window comes up and select the button that says "Environmental Variables"
5)In the window that comes up there is two boxes. We are going to edit the bottom one labed "System Variables". Now grab the scroll bar and look for the variable Path. It should be under OS and above PATHEXT. Double-Click "Path" Variable
NOTE: Each path ends in a ";"
6) So now you will need remove every instance that would point to anything android related. For example one is "C:\SDK\platform-tools\;" If it has this then apktools will run the aapt.exe from that platform-tools folder instead of the one that is provided in the zip.
ALTERNATIVE: An alternative would be to delete the aapt that you have in your folder that you have in your Path System Variable.
I know this was not very clear but I again this is for the users a bit more advanced.
-------------------------------
DECOMPILE/COMPILE SystemUI.apk and other Apk's. EXCEPT framework-res.apk
Ok, you can do this however you want but for this tut I am going to extract apktools.zip and place the folder on my desktop. So we're going to open the folder and then place the APK we want to edit along with a JELLYBEAN framework-res.apk into the folder. For example if you want to edit a CM10 "SystemUI.apk" then you will pull the framework-res.apk from /system/framework/ folder nd place it in your desktop JBapktools folder.
Once you have both SystemUI.apk and framework-res.apk inside the JBapktools folder we are ready to start. First rename either one of these files "apktool149.jar" "apktool142.jar" "apktool144.jar" to just apktool.jar. REMEMBER only rename ONE cus we need to keep track of the versions of the apktools.
Next, bring up the folder window and anywhere on the white space hold SHIFT and Right-Click. Then youre going to choose open command window here.
The first command is going to be: java -jar apktool.jar if framework-res.apk
This is going to install the framework.
Now close out the window.
Next go back to the folder and make sure you rename the jar file you renamed earlier back to its original name. For example if you have apktool144.jar and apktool149.jar in the folder then you must rename apktool.jar to apktool142.jar because that is its original and actual version number.
To decompile and recompile SystemUI.apk you need apktool149.jar so once all three are named to their real names then rename apktool149.jar to apktool.jar.
Now,YOU ARE READY!!! Finally.
Again, In the folder SHIFT +Right-Click and select open command window here.
the command to decompile is: java -jar apktool.jar d SystemUI.apk
---------------------------------------------------------------------------------------
Then hit enter you should see something like this:I: Baksmaling...
testI: Loading resource table...
I: Loaded.
I: Loading resource table from file: C:\Users\Jose\apktool\framework\1.apk
I: Loaded.
I: Decoding file-resources...
I: Decoding values*/* XMLs...
I: Done.
I: Copying assets and libs...
---------------------------------------------------------------------------------------
Of course it wont say Jose but it will say your User Accounts name.
Now in the folder you should see another folder in there called SystemUI. Now its DECOMPILED!!!!! WHOOOOO!!!!!!
You can make your edits and edit the pngs and xmls or the smali or whatever your guru-self wants to do.
Now to RECOMPILE!!!!!
To recompile we will still be using apktool149.jar so no need to rename anything back or whatever.
The first thing you should do is open the SystemUI.apk in 7-zip. You can right-click SystemUI.apk and in there, there should be a META-INF folder and a AndroidManifest.xml file. Select both of these be selecting one first(should be highlighted blue) the holding down Cntrl button and selecting the other file. Now that they are both selected click and drag out to apktools folder. We will need these files in a little bit.
Next in the command prompt window, or if you closed it, the reopen by SHIFT+Right-Click and selecting open command window here. The command to decompile is:
java -jar apktool.jar b SystemUI
NOTE:Make sure you use the letter "b" and dont add .apk to the end of it as we are recompiling the FOLDER and not an actual apk file like we do when decompiling.
It should say something like this:
I: Checking whether sources has changed...
I: Smaling
I: Checking whether resources has changed...
I: Building resources...
I: Building apk file...
Sounds very sexy when reading it I know but we aren't done yet. Remember the META-INF Folder and the AndroidManifest.xml file we pulled out earlier. Ok from the apktools folder select both files again by using Ctrl button. Now type Ctrl C. This will COPY these files to the clipboard. Now that we have the files copied go into SystemUI FOLDER and then go into build folder and then into apk folder. To make it look more neat navigate to /Desktop/apktools/SystemUI/build/apk/ . Now that you are in the apk folder hit Ctrl V. This will PASTE the META-INF and AndroidManifest.xml file into the folder. If a window comes up just choose COPY AND REPLACE.
Last thing to do before we can compile is to go into /SystemUI/dist/ and delete the apk file that is there. The recompiling process is almost complete!!! Go back to command prompt window and just push the ARROW UP on the keyboard. This should bring up the last command you typed in. If its not there then just type it in again:
java -jar apktool.jar b SystemUI
The final apk file should be in SystemUI/dist/ folder!!!!
If you are having any aapt problems then you probably still have a path in Environment Variables that has an aapt.exe in it. Other than that askk and I'm sure myself or someone else can help!!
I will be putting up the how to decompile/recompile framework-res.apk in 2nd post tomorrow or soon because I dont have time right now. The process is different. Have fun themeing and doing whatever it is you do!!!
Added a donate link guys. I'm only 16 so I can't say buy me a beer! So how bout half a gallon of gas? That would be great. Let me know if you donated to I can thank you and put you in my posts!! I have a passion for doing these things so I do not expect any donations from anyone. I do it because I love it and can't get enough of it!! Thanks everyone for being supportive
Donations: Marcismo55
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=GL7RKF2EGCH68
Click to expand...
Click to collapse
Can you edit Contacts.apk?
I am trying to modifying Jelly Bean Contacts.apk. The original Contacts.apk is from Helly Bean. Using apktool that has been used for ICS and other Jelly Bean apks, I can decompile and then recomplie it without any error. However, the recompiled Contacts.apk would not work in cell phone, showing a message "Unfortunately, Contacts has stopped!".
To simplify the problem, I simply do decompiling and then recompiling without any modifications. I found that the size of resources.arsc has been changed from 1480 KB to 1525 KB. The new Contacts.apk causes FC!
Note: Files in smali folder can still be modified. After editing, use apktool to recompile and create a new apk. Then use WinRAR or 7zp to drag the newly created classes.dex into the original Contacts.apk. Such a "modified" Contacts.apk works properly. Note here that we did not modify resources.arsc.
This problem is only related to resources.arsc!!!!!!!
SunnyOKOK said:
Can you edit Contacts.apk?
I am trying to modifying Jelly Bean Contacts.apk. The original Contacts.apk is from Helly Bean. Using apktool that has been used for ICS and other Jelly Bean apks, I can decompile and then recomplie it without any error. However, the recompiled Contacts.apk would not work in cell phone, showing a message "Unfortunately, Contacts has stopped!".
To simplify the problem, I simply do decompiling and then recompiling without any modifications. I found that the size of resources.arsc has been changed from 1480 KB to 1525 KB. The new Contacts.apk causes FC!
Note: Files in smali folder can still be modified. After editing, use apktool to recompile and create a new apk. Then use WinRAR or 7zp to drag the newly created classes.dex into the original Contacts.apk. Such a "modified" Contacts.apk works properly. Note here that we did not modify resources.arsc.
This problem is only related to resources.arsc!!!!!!!
Click to expand...
Click to collapse
Not to sure bud. But try the Tut I put up before your post. If not it might need to be compiled from source so nothing will be broken
Sent from my SPH-L710 using XDA App
Thank you. Can I use Eclipse to edit the source code? Any ideas?
SunnyOK said:
Thank you. Can I use Eclipse to edit the source code? Any ideas?
Click to expand...
Click to collapse
Not to sure on that either man. Sorry
Sent from my SPH-L710 using XDA App
I get errors on installing framework!
Any ideas?
i am getting error is there any way to solve.... check attachment image
I'm gonna try this guide. It seems like the last step is something I haven't done in my current journey with recompiling apks.
tapatalked² from cowsquadGnex®
---------- Post added at 08:49 AM ---------- Previous post was at 08:48 AM ----------
sahil001 said:
i am getting error is there any way to solve.... check attachment image
Click to expand...
Click to collapse
Do you have java installed on your system?
tapatalked² from cowsquadGnex®
cowsquad said:
I'm gonna try this guide. It seems like the last step is something I haven't done in my current journey with recompiling apks.
tapatalked² from cowsquadGnex®
---------- Post added at 08:49 AM ---------- Previous post was at 08:48 AM ----------
Do you have java installed on your system?
tapatalked² from cowsquadGnex®
Click to expand...
Click to collapse
i haved installed but which particular version do you recommend me and if possible please share downloading link
sahil001 said:
i haved installed but which particular version do you recommend me and if possible please share downloading link
Click to expand...
Click to collapse
Just Google how to install java jdk in windows. There are plenty tutorials. You need java JDK
Edited:
Make sure your java is in your windows system variables. Step 6 on this guide
tapatalked² from cowsquadGnex®
cowsquad said:
Just Google how to install java jdk in windows. There are plenty tutorials. You need java JDK
Edited:
Make sure your java is in your windows system variables. Step 6 on this guide
tapatalked² from cowsquadGnex®
Click to expand...
Click to collapse
Ok ill try and let u know if it works or not
Ѕєит fяσм ๓ұ gαℓαχу S2®
sahil001 said:
Ok ill try and let u know if it works or not
Ѕєит fяσм ๓ұ gαℓαχу S2®
Click to expand...
Click to collapse
Did it work man?
tapatalked² from cowsquadGnex®
cowsquad said:
Did it work man?
tapatalked² from cowsquadGnex®
Click to expand...
Click to collapse
No
Ѕєит fяσм ๓ұ gαℓαχу S2®
I am trying to edit the smali code in the systemui.apk for a couple mods in the development section. I am having some difficulties. I am trying to use smali/baksmali.
Anyone have a guide or able to provide some steps.
Thanks
First, if you don't have apktool set up Google "How to set up apktool on Windows(or Linux or Mac etc)"
Once set up use this modified apktool and aapt.exe found here. Make sure you select the appropriate aapt.exe depending on you OS
http://forum.xda-developers.com/showthread.php?t=1755243
Rename that modified apktool jar to just apktool.jar and place the jar and exe in your C:\apktool\ directory
Next, get the framework-res.apk and twframework-res.apk (found in /system/framework/). Place them in your apktool directory
CD your apktool folder and type
apktool if framework-res.apk
apktool if twframework-res.apk
Place your SystemUI.apk in your apktool directory and type
apktool d SystemUI.apk
It'll decompile, complete your mods then recompile
apktool b SystemUI
The apk will be in the SystemUI\dist\
Sent from my SPH-L710 using Tapatalk 2
For me the easiest way is baksmali and smali.
For smali its easy. Just extract the classes.dex and run the decompile command. Simple. You will need java installed.
To recompile just run the recompile command and done. You get a new .dex that you pop I the apk you are editing and delete the old one. Name it the same, push the apk and done.
BTW, the command isent actually "decompile" and "recompile"
You will need a little more java experience to know what the commands are.
fergie716 said:
First, if you don't have apktool set up Google "How to set up apktool on Windows(or Linux or Mac etc)"
Once set up use this modified apktool and aapt.exe found here. Make sure you select the appropriate aapt.exe depending on you OS
http://forum.xda-developers.com/showthread.php?t=1755243
Rename that modified apktool jar to just apktool.jar and place the jar and exe in your C:\apktool\ directory
Next, get the framework-res.apk and twframework-res.apk (found in /system/framework/). Place them in your apktool directory
CD your apktool folder and type
apktool if framework-res.apk
apktool if twframework-res.apk
Place your SystemUI.apk in your apktool directory and type
apktool d SystemUI.apk
It'll decompile, complete your mods then recompile
apktool b SystemUI
The apk will be in the SystemUI\dist\
Sent from my SPH-L710 using Tapatalk 2
Click to expand...
Click to collapse
+1
...and don't forget to use 7-zip and grab the META-INF & androidmanifest
XML files, then put them in build/apk and run recompile command again.
"apktool b SystemUI"
Ok I have tried both methods listed above. Maybe I am not understanding something about each way. What I am doing is using root explorer to copy the SystemUI.apk from system/app and the framework-res.apk from system/framework/
When I use apktook, it decompiles but I dont find any smali code i there. I get a list of 2 folders and 2 files (assets, res, androidmanifest, apktool.yml) there are subfolders but still no luck finding smali code in there.
I tried the smali/baksmali method but i cant seem to find any classes.dex (as I understand it, its located in the SystemUI.apk). Am I looking in the wrong place. I used 7zip to view the SystemUIapk, it shows the same folders I mentioned above minus the apktool.yml and additionally a meta-inf folder and resources.arsc.
Am I looking at the wrong place? It is the stock rom. There is a file systemui.odex should I be doing something with that instead?
The editing that I am trying to do is mentioned here in case it helps. http://forum.xda-developers.com/showthread.php?t=1848611
Thanks
deepsix_69 said:
Ok I have tried both methods listed above. Maybe I am not understanding something about each way. What I am doing is using root explorer to copy the SystemUI.apk from system/app and the framework-res.apk from system/framework/
When I use apktook, it decompiles but I dont find any smali code i there. I get a list of 2 folders and 2 files (assets, res, androidmanifest, apktool.yml) there are subfolders but still no luck finding smali code in there.
I tried the smali/baksmali method but i cant seem to find any classes.dex (as I understand it, its located in the SystemUI.apk). Am I looking in the wrong place. I used 7zip to view the SystemUIapk, it shows the same folders I mentioned above minus the apktool.yml and additionally a meta-inf folder and resources.arsc.
Am I looking at the wrong place? It is the stock rom. There is a file systemui.odex should I be doing something with that instead?
The editing that I am trying to do is mentioned here in case it helps. http://forum.xda-developers.com/showthread.php?t=1848611
Thanks
Click to expand...
Click to collapse
Deodex first then use the apk.
I installed a deodexed version of the stock rom, and then used the apktool directions above. They appear to have worked.
Thanks for the help.
I'm using Xperia arc s at stock rom 4.1.B.0.587 and locked bootloader.
I'm using few mods, and also custom systemui *Colored icons systemui
Few days ago I am starting curious how to add on screen button at my own, and I still cannot do it successfully (got bootloop after xperia title).
After trial and error I found the solution, I don't add original META-INF framework.apk to my modified framework.apk.
Now I'm only curious how to add crt off animation. *I found out that original framework.apk already has the setting to show crt animation. Anyone has an idea what to do??
How I successfully add on screen button:
What I do: (following the tutorial from http://forum.xda-developers.com/showthread.php?t=1364757, and http://forum.xda-developers.com/showpost.php?p=9126643#post9126643 to mod the apk)
1. extract framework-res.apk from my system [framework-res.apk]
2. decompile it with 1.4.10 apktool by this command: java -jar apktool.jar d framework-res.apk framework-res
3. edit bools.xml to change show navigation bar to true
4. edit dimens.xml to change navigation bar height to (21.0dip)
5. rebuild the apk with this command: java -jar apktool.jar b framework-res out\framework-res.apk
6. <from this part I dont really understand> From the output apk [The name is outframework-res.apk] from apktool 1.4.10 (At first I use 1.4.3 and it always failed to compile, but It compiled successfully with 1.4.10), I add the extension to 7z [outframework-res.apk.7z], and unpack it. (i.e: it become outframework-res folder)
7. With 7zip app (actually I use total commander, with zero compression), I replace all files from outframework folder back to outframework.apk.7z
8. I also add resources.arsc from the outframework-res folder and also add it to the outframework-res.apk.7z. *The file size is the same before and after I put the resources.arsc.
9. I downloaded ics_sysbar.zip, then with total commander (7zip like program), I add those files to SystemUI.apk (/res/drawable-hdpi/) using 7-zip or other program. (replace original PNGs to these files).
10. I rename the outframework-res.apk.7z to framework-res.apk then push it to my device along with the SystemUI.apk.
Click to expand...
Click to collapse
Adding "qemu.hw.mainkeys=0" to build.prop enables soft-keys in AOSP/CM10.. I don't use stock ICS so can't confirm this. Wait for few more replies from other users.
soumya_digi said:
Adding "qemu.hw.mainkeys=0" to build.prop enables soft-keys in AOSP/CM10.. I don't use stock ICS so can't confirm this. Wait for few more replies from other users.
Click to expand...
Click to collapse
Thanks for your reply.
By the way, I actually found what is my problem, from analyze other working on screen button.
It turns out the compiled framework don't add META-INF.
After I add that folder to my compiled framework, *with total commander, It works.
And editing the SystemUI turns out unnecessary.
What I still wonder is how to add menu button (the right key, beside back and home button), and also make holding home button show the ics style recent app (the one that you can swipe to remove it from recent app).
Welcome back everyone
For those who are not familiar with the series, I recommend checking out part I and then part II to get caught up on our continued efforts to modify a ROM to your every whim and need.
We will be utilizing some really cool tools today. They come at a price of patience and perseverance, you know, kind of like what Valve expects from all of their loyal customers, and the worst part is....they could release the HL3 in 10 years, and I would still throw money at my screen.
I digress again.
Today we learn how to decompile those sneaky APK's and the necessary Framework files. They are located in the 2 most important folders:
MD4_Version_1/system/app
MD4_Version_1/system/framework
We need to start at the beginning of this topic.
To begin, let us test your ability to use JAVA....Wait STOP! Java? Programming? We do not need to be experts at programming at all, in fact, implementing mods is really a copy and paste procedure for us noobs, but if you know how to JAVA, maybe you can create your own mods that you can share with the community. Also, I am not a programmer, but I do know how to use logic to trial and error the crap out of the mods until they work.
To test if you have JAVA installed, open up a command prompt in Windows (because if you have Linux, you are not going to even be on this beginner's tutorial now are you?)
type in:
Code:
java
You should see
Code:
C:\>java
Usage: java [-options] class [args...]
(to execute a class)
or java [-options] -jar jarfile [args...]
(to execute a jar file)
where options include:
-server to select the "server" VM
-hotspot is a synonym for the "server" VM [deprecated]
The default VM is server.
-cp <class search path of directories and zip/jar files>
-classpath <class search path of directories and zip/jar files>
A ; separated list of directories, JAR archives,
and ZIP archives to search for class files.
-D<name>=<value>
set a system property
-verbose[:class|gc|jni]
enable verbose output
-version print product version and exit
-version:<value>
require the specified version to run
-showversion print product version and continue
-jre-restrict-search | -jre-no-restrict-search
include/exclude user private JREs in the version search
-? -help print this help message
-X print help on non-standard options
-ea[:<packagename>...|:<classname>]
-enableassertions[:<packagename>...|:<classname>]
enable assertions
-da[:<packagename>...|:<classname>]
-disableassertions[:<packagename>...|:<classname>]
disable assertions
-esa | -enablesystemassertions
enable system assertions
-dsa | -disablesystemassertions
disable system assertions
-agentlib:<libname>[=<options>]
load native agent library <libname>, e.g. -agentlib:hprof
see also, -agentlib:jdwp=help and -agentlib:hprof=help
-agentpath:<pathname>[=<options>]
load native agent library by full pathname
-javaagent:<jarpath>[=<options>]
load Java programming language agent, see java.lang.instrument
-splash:<imagepath>
show splash screen with specified image
Wait, you did not see this did you? Well it happens, you probably got an Unknown Command or some shenanigans that doesn't look similar to the above?
Do not worry, we will need to add JAVA to the environment variables. First head over to JAVA and download the Java Runtime Environment (JRE). Install as you would by clicking next next next next and next and next.
When it installs, it goes to a specific location. The problem is, sometimes Windows does not recognize that path, which is why when you execute the JAVA command in a command prompt it tells you unknown command. We have to tell Windows to search in the java installation folder that you just installed for the JAVA.exe program so Windows can add it to the list of areas to search when you execute a command.
To do this, we will need to add the path in the environmental variables, java explains that sometimes this should not be necessary. But use this for more information and an understand of how to do this to different operating systems.
My path was the default "PATH" for java
Code:
C:\Program Files (x86)\Java\jre7\bin
Once that has been added to the environmental variables, test out the java code and see if it looks like what I have from above.
After this is done, we will need to install the Android SDK, this can be found here
The SDK, is a software development kit. It will allow for a user to create software for your android phone. This tutorial will not be doing that because that is a very heavy order. It will require the release of the Kraken. I do not recommend releasing the Kraken. Unless it is harmless Cthulhu. He's so adorable.
Anyway, this will install platform tools for us to push files to our phone and allow us to to execute these commands.
Remember, we can add the tools of the SDK to our PATH variable so we can execute these tools in any command prompt and at any location.
If you are having trouble at this point, let me know in the comments below and we can try and address this issue.
Now that we have the basic tools down, we need to understand what the heck that APKTOOL, SMALI and BAKSMALI do.
These tools are used to decompile the our APK and JAR files.
Keep this in mind at all times
APKTOOL will decompile and combile APK FILES
SMALI compiles DEX FILES
BAKSMALI decompiles DEX FILES
Do you know what any of these 3 are? Maybe you do, maybe you don't.
The APK stands for Android application package. It is basically the app. In windows, it would be equivalent to the program. The APK is unique in the sense that all the files in the app are actually zipped inside an APK file.
That logic only deduces, we can open almost any APK file with 7-zip. This is good news until we realize, the APK files are actually encoded in a way. We cannot make serious mods until we de-scramble the code hidden in the APK.
This is where APKTOOL comes into play. The APKTOOL can de-compile the encoded files and put it into a folder for us to work with. We can then make our mods, recompile and then put it into our ROM.
After explaining Smali and Baksmali, we will begin a basic mod.
Smali and Baksmali are actually java archive files. They contain instructions to take a DEX file and de-compile them into very interesting SMALI code. DEX is an EXE file for our Android system. We can only de-compile a classes.dex file for now, for it contains the majority of the rest of the tweaks. As a result, doing this is important and very difficult unless you understand what is going on. We will definitely have examples so do not fret, did I mention a half life reference yet...I don't think so.
So back to APKTOOL, we are going to need to understand what it does before we begin. I am assuming you got your APKTOOL downloaded from here, go to your C: drive and create a folder in there called APKTOOL in there, unzip the downloaded file, there will be a file Setup.bat, execute that file and a command prompt window with Green text will appear, I recommend selection 1 first to ensure you have the latest version, but we do not need to do this.
We will need to press option 2, but it says we must place some files in the other folder first. The files needed are actually the framework files, basically, the way our rom interprets the files are needed for this APKTOOL to operate.We will need to go to our ROM's
MD4_Version_1/system/framework/ folder and copy 2 files
Code:
framework-res.apk
tw-frameworkres.apk
These files will be copied into
Code:
C:\APKTOOL\other
This needs to be done before you select option 2.
Once the files are copied, press 2, then we need to install the first two options, so go one by one and install both.
Then when you are back to the main menu, press 3 and setup the directories for your need.
Personally, I took the
Code:
C:\APKTOOL\other
folder and moved into my own working directory. Assume that the locations will be selected by you for organization. I will use the following folder for reference:
Code:
C:\other
This will have all of the tools I need, while you are at it, create a new folder in their called Smali and copy the Smali.jar and BakSmali.jar files in there, they will of course be named something else like smali-1.4.2.jar and baksmali-1.4.2.jar
Rename the files to make life easier
Code:
from
smali-1.4.2.jar
to
smali.jar
and
baksmali-1.4.2.jar
to
baksmali.jar
Back to APKTOOL, now back to me, Now back to APKTOOL, now back to me.
We will be victimizing a specific APK to get modding started.
Before we get started, this is where we start version controlling more seriously. As each mod you add could cause a freeze, hang, bootloop or whatever, so go to the folder of your ROM, select the four files
META-INF
system
boot.img
installbusybox
right click them and "Add to Archive". Zip file only remember, compression level( Normal to no compression is fine)
Now
Lets grab a copy of SecPhone.APK located in the system/app folder
And put it into
Code:
C:\other
Open a command prompt and navigate to that location of the APKTOOL
Execute the following command
Code:
apktool d SecPhone.apk SecPhone
If done successfully, you will something like
Code:
C:\other>apktool d SecPhone.apk Secphone
I: Baksmaling...
I: Loading resource table...
I: Loaded.
I: Decoding AndroidManifest.xml with resources...
I: Loading resource table from file: C:\Users\<Your User Name>\apktool\framework\1.apk
I: Loaded.
I: Regular manifest package...
I: Decoding file-resources...
I: Decoding values */* XMLs...
I: Done.
I: Copying assets and libs...
C:\other>
This means it successfully decoded the file. We will have a folder called SecPhone that has a bunch of folders.
Navigate to the following folder:
Code:
C:\other\Secphone\res\raw
There are 2 .ogg files. Well well well, I thought we took care of these, hmm, guess we need to change these to whatever you need to. Let's assume you did this already and have replaced them. We will need to stop the "mods" for now, for we are learning a process not a mod per se.
So we are done "modding" the file, I know it is not a BIG mod but we are trying to learn how to do this now so we can do the heavy stuff later. Now we can continue to recompile the file.
Go back to command prompt and direct yourself to
C:\other>
Click to expand...
Click to collapse
The put in the following command:
Code:
C:\other>apktool b SecPhone new-SecPhone.apk
Notice we changed 3 things, the d became a b, the second option is the folder we are recompiling, the third is the name of the new file
You should then see something that might be worrisome:
Code:
I: Checking whether sources has changed...
I: Smaling...
I: Checking whether resources has changed...
I: Building resources...
aapt: warning: string 'reject_cause_location_reg_fail' has no default translatio
n in C:\other\SecPhone\res; found: es pt
aapt: warning: string 'reject_cause_location_registering' has no default transla
tion in C:\other\SecPhone\res; found: es pt
aapt: warning: string 'stms_version' has no default translation in C:\other\SecP
hone\res; found: ja
I: Building apk file...
C:\other>
The warnings will be acceptable for the time being as they are related to a different language setting. If you are in English, you will be fine. If you are not, then that is a different tutorial altogether. Also, there is a very particular code bug that occurred the very first time I ran these commands and caused a catastrophic failure, more than any Movie-to-Game adaptation could ever be,
But you think you are done here, well that is not true. You see,
We have compiled the new APK file but unfortunately, it is a system file, we cannot sign this file to tell Android it is legit, we will have to cheat at this point, just like Valve did by creating any other project except Half Life 3 after number 2, you know they have enough funding for it, they are making it, and if I get kidnapped, I will probably be in a basement at Valve which I won't mind if they give me a grav gun. On a side note, while Brian Cranston would make a great Gordon Freeman, I still think Hugh Laurie would do a good job, just saying.
So back to our dilemma. We have created a new file called new-SecPhone.apk, open it with 7-zip, do not do anything yet, open the SecPhone.apk file you should have, it is the original file in the C:\other folder, we will need to drag two files for signature's sake
Copy the
Code:
Meta-INF Folder
AndroidManifest.xml
directly into the new-SecPhone.apk file. This can be done by dragging the files.
This will allow Android to think the file is signed and legit.
Take the new-SecPhone.apk file and copy it to your desktop and rename it to SecPhone.apk
Then place it into your ROM's system/app folder.
Your "first Mod" is ready to go, pretty easy actually but I really think the method is what many of us lack and this centralizes the effort. When you want to mod any System file, this process has to be done.
Its not a crazy mod, that will be after we explain how to modify files with Smali and BakSmali.
That will be in the next part of this set of series. These keep getting longer, I know, but we have a boat ton to cover. I think a central place to go-to for this information is important instead of jumping around to so many places for information. Eventually, the plan is to stick them as one big post I hope so we can integrate the vast amount of knowledge flowing.
Let me know what you think in the comments below, feedback is important, I felt this is so far the most complicated of the series and it will only get crazier. Luckily we can ask questions and keep this series going with an understanding for ROM building and see how much effort goes into someone else's effort modifying one of these ROM's out there, this is just a stock ROM mod tutorial, imagine something like CyanogenMod or any crazy ROM with a boat ton of features. It is time consuming and they deserve mad props for their amazing work.
Again great stuff. Can't wait for the next tutorial!
Sent from my SPH-L710 using xda app-developers app
bigpappags3 said:
Again great stuff. Can't wait for the next tutorial!
Sent from my SPH-L710 using xda app-developers app
Click to expand...
Click to collapse
He is very informative, and puts it in ways I can understand!
------------------------
Sprint Galaxy S3
Need Help? PM
Hit the "Thanks" button if I helped!
I'm stuck
I've downloaded the APKTOOL zip, and there is no setup.bat file in the unzipped package. There are only two files in the package and nothing else. One is an application called aapt, the other is a batch file called apktool. Both of which when executed briefly open a command prompt window that closes before I can read what they say. I've followed every direction to a "T" thus far, and can't figure out what to do. I thought that perhaps I had a bad download, but I've re-downloaded the file several times without success. Any suggestions would be incredibly helpful.
Might have a solution
balcoresbane said:
I've downloaded the APKTOOL zip, and there is no setup.bat file in the unzipped package. There are only two files in the package and nothing else. One is an application called aapt, the other is a batch file called apktool. Both of which when executed briefly open a command prompt window that closes before I can read what they say. I've followed every direction to a "T" thus far, and can't figure out what to do. I thought that perhaps I had a bad download, but I've re-downloaded the file several times without success. Any suggestions would be incredibly helpful.
Click to expand...
Click to collapse
Well it seems they have changed up quite a few things on the Wiki page, the version I was using was 1.5.2, the package has moved around and it seems these instructions are as obsolete as they are dependent on a website to not change things around.
They still offer the 1.5.2 of course but in the archives, suppose it was my fault linking to a constantly changing website than to link to the files directly that I used which I was considering.
This is the link
https://code.google.com/p/android-apktool/
zalooa said:
Well it seems they have changed up quite a few things on the Wiki page, the version I was using was 1.5.2, the package has moved around and it seems these instructions are as obsolete as they are dependent on a website to not change things around.
They still offer the 1.5.2 of course but in the archives, suppose it was my fault linking to a constantly changing website than to link to the files directly that I used which I was considering.
This is the link
https://code.google.com/p/android-apktool/
Click to expand...
Click to collapse
Thanks @zalooa. I'll give it a go tonight for sure. I appreciate you getting back to me!