What am I doing wrong? apktool? - Android Q&A, Help & Troubleshooting

I have been building ROMs for a while but I have been relying on other peoples bases (a big thank you to everybody for all your efforts). I have managed to edit some .apk files by opening them with WinRar and just replacing files (images etc). I now need to get a bit deeper and want to edit framework-res.apk but I just can't get it to work
Right now I have wiped and reinstalled Windows 7 Ultimate SP1 x86 on a Dell Optiplex GX270. I have let windows update do its thing and it is all up to date. I have no AV software installed. I have installed Sun JDK 6 update 32. I have installed the Android SDK and this has updated itself to Rev. 19 and installed the latest Android 4.0.3 API. I have installed the apktool using the instructions from here - http://code.google.com/p/android-apktool/. I have pulled the framework-res.apk from the phone, installed it with 'apktool if framework-res.apk' and then decompiled it with 'apktool d framework-res.apk framwork-res'. I then edited the bools.xml file using notepad++ and then recompiled with 'apktool b framework-res unsigned-framework-res.apk'. I then renamed the file and pushed it to /system/framework on the device. And its now in a boot loop
What am I doing wrong?
Andy

Use APK MULTI TOOL.
Sent from my GT-I9300 using Tapatalk 2

winrar?you can edit an app that way...but it's much better using 7zip
Sent from my MB860 using XDA

Kev_cr said:
winrar?you can edit an app that way...but it's much better using 7zip
Sent from my MB860 using XDA
Click to expand...
Click to collapse
Yes I know. My issue is with recompiling .apks though - specifically framework-res.apk and the resources.arsc it contains....
Andy

ADB100 said:
Yes I know. My issue is with recompiling .apks though - specifically framework-res.apk and the resources.arsc it contains....
Andy
Click to expand...
Click to collapse
well take everything inside from the new apk except the androidmanifest. i believe and copy it over to the old apk see if that works.
From my powered Shooter.

Easier thing to do is take the meta-info and manifest from the original apk and copy it over the new apk using an archive manager.
However I've found that if its bootlooping then I've usually missed something out.
私はローボーボブ。 Haro!!

Related

Volume Slider Color

I'm wanting to change the color of the slider when you turn your volume up and down from yellow to another color. I'm running CM7 fascinatemtd ROM by JT, I know which folder it's in and how to do it. My question is, I use Apk Manager to decomplie my framework-res.apk which was pulled from the ROM using 7zip, I've decompiled the apk, edited the XML file, when I went to recompile the framework-res apk using option 11, a error pop up and told me to read the log, I hit enter, answered yes to system question, then went to keep folder and deleted the resources file as instructed, and hit enter, I was left with an unsigned framework-res.apk file, renamed it to framework-res.apk, and pushed it back into ROM with 7zip, rebooted recovery, cleared caches, and installed ROM, but phone wouldn't boot up. So what am I doing wrong...
Obviously not
Sent from my SCH-I500 using XDA App
What color do you want the slider man
Sent from my SCH-I500 using XDA App
Blue would match my theme the HEX code is 11114b...
Sent from my SCH-I500 using XDA Premium App
If apkmanager errors common logic would dictate to read the log and see what is going wrong
Trying to flash a broken apk won't work obviously
I've gotten it to decompile and recompile bit the problem now os the changes I've made don't show up I'm not getting any errors before I was ising a ROM that I themed so I went back and used the original ROM how do I get the changes to stay...
Sent from my SCH-I500 using XDA Premium App
And you're trying to edit progress_horizontal.xml? And changing code to ff11114b leaving the "f's" in?
good day.
Yes
Sent from my SCH-I500 using XDA Premium App
I should rename unsigned framework.res to framework.res right...
Sent from my SCH-I500 using XDA Premium App
And during the compile process, you hit y for "system apk" and hit y for "would you like to copy over any files..............." and from the keep folder delete resources.arsc and continue to compile. And yes rename back to framework-res.apk.
good day.
Answered yes to system app and no to copy over files, didn't delete arsc and changes stayed, but if I install will I get boot loop since I didn't delete arsc....
Sent from my SCH-I500 using XDA Premium App
If I hit y to copy over files the changes don't stay only if I hit n
Sent from my SCH-I500 using XDA Premium App
it worked, by not copying over the files and not deleting the resources arsc file, does anyone know what the XML file name is for the download progress bar color is...and thanks for your help guys...
Here's what I would do if I was on Windows!
Download apktool & dependencies:
http://android-apktool.googlecode.com/files/apktool1.4.1.tar.bz2
http://android-apktool.googlecode.com/files/apktool-install-windows-r04-brut1.tar.bz2
Unpack both archives to your Windows folder. This will make apktool accessible through cmd anywhere.
CD in cmd window to the location of your apk, If you haven't already done so and install the resources by copying or pulling (framework-res.apk, twframework-res.apk for touchwiz) or (framework-res.apk, SystemUI.apk for GB). Once copied to the folder you are cd'd too...
Install the resources
apktool if framework-res.apk
apktool if twframework-res.apk
apktool if SystemUI.apk
Decompile and make your changes..
apktool d framework-res.apk
Recompile when done
apktool b framework-res
If it built succesfully, then make a copy of your framework-res.apk. Then navigate to framework-res/build/apk! Open your copied apk with 7zip and drag n drop res & resources.arsc from framework-res/build/apk inside! Close it up..
Push and test.. On windows you may need to navigate to your sdk directory if not properly setup!
adb push "your_copied_file"/system/framework/framework-res.apk
If you get a failed to write to system, run this first.
adb shell su -c rw
YES got all progress bar colors changed to blue now my CM7 Fascinatemdt ROM is themed all of my drawable hdpi and XML files are complete I might post this as a theme, thank you for your help...
Sent from my SCH-I500 using XDA Premium App
notta said:
Here's what I would do if I was on Windows!
Download apktool & dependencies:
http://android-apktool.googlecode.com/files/apktool1.4.1.tar.bz2
http://android-apktool.googlecode.com/files/apktool-install-windows-r04-brut1.tar.bz2
Unpack both archives to your Windows folder. This will make apktool accessible through cmd anywhere.
CD in cmd window to the location of your apk, If you haven't already done so and install the resources by copying or pulling (framework-res.apk, twframework-res.apk for touchwiz) or (framework-res.apk, SystemUI.apk for GB). Once copied to the folder you are cd'd too...
Install the resources
apktool if framework-res.apk
apktool if twframework-res.apk
apktool if SystemUI.apk
Decompile and make your changes..
apktool d framework-res.apk
Recompile when done
apktool b framework-res
If it built succesfully, then make a copy of your framework-res.apk. Then navigate to framework-res/build/apk! Open your copied apk with 7zip and drag n drop res & resources.arsc from framework-res/build/apk inside! Close it up..
Push and test.. On windows you may need to navigate to your sdk directory if not properly setup!
adb push "your_copied_file"/system/framework/framework-res.apk
If you get a failed to write to system, run this first.
adb shell su -c rw
Click to expand...
Click to collapse
will this work also when trying to decompile/recompile a non system app, like one from the market, that has dependencies
adude247 said:
will this work also when trying to decompile/recompile a non system app, like one from the market, that has dependencies
Click to expand...
Click to collapse
It will work with anything provided you have the resources. Some apk's are picky by means of what you can replace.
The method above is using apktool the way it is supposed to be used. That apkmanager thing sounded crazy with the delete this after that, hit y or n before this. Seems like alot of un-needed steps and confusion!
On linux it's even easier, pretty much fully auto!
notta said:
It will work with anything provided you have the resources. Some apk's are picky by means of what you can replace.
The method above is using apktool the way it is supposed to be used. That apkmanager thing sounded crazy with the delete this after that, hit y or n before this. Seems like alot of un-needed steps and confusion!
On linux it's even easier, pretty much fully auto!
Click to expand...
Click to collapse
yeah, I didn't delete anything just decompiled, edited the XML, and recompiled, that was the only way I could get the changes to stay. Any suggestions on what to use if the above resources don't work to get the apk to decompile, an example of an apk that I want to edit but cant get it to recompile after decompiling and editing the XMLs is....
adude247 said:
yeah, I didn't delete anything just decompiled, edited the XML, and recompiled, that was the only way I could get the changes to stay. Any suggestions on what to use if the above resources don't work to get the apk to decompile, an example of an apk that I want to edit but cant get it to recompile after decompiling and editing the XMLs is....
Click to expand...
Click to collapse
I can't and won't explain getting resources for market apps or generally someone else's work. However there are several ways to approach non-building apk's.
For example aapt has the capability to recompile standalone 9's as well as xml's, which can then be injected into the apk with the 7zip method. Especially useful for minor changes.
Another example for stubborn apk's would be the Eclipse or similar project. This is where you would partially build the files you wanted to change.
Thanks for the advice...
Sent from my SCH-I500 using XDA Premium App

[Q] How to properly recompile the framework-res.apk?

I have tried using the APK Manager,
Problem: If I recompile the framework-res.apk, it always gives me loops...
Even if I make a very small change!
(I don't sign it!)
Images can be replaced by opening it in 7-zip but xml files can't be changed that way.
I'm 100% sure that I follow correct steps....
What I'm trying to do:
Power menu: http://forum.xda-developers.com/showthread.php?t=1169443
and
ICS transitions: http://forum.xda-developers.com/showthread.php?t=1343350
I have followed more then 10 threads with same problem but still didn't get a solution.
Sorry if I missed something.
Any help?
*BUMP*
Why don't u sign it?
Sent from my SCH-I400 using xda premium
AFAIK, we don't have to sign a system apk using APK Manager (specially the framework-res.apk)
P.S. The guide (http://forum.xda-developers.com/showthread.php?t=1169443) also states so...
Try to use APKTool, I used to compile it and decompile it with this application and it works fine
Oic. I've always signed my frameworks. Ill not from now on.
Sent from my SCH-I400 using xda premium
Apktool has worked for me in past, haven't tried for a couple of months though so not sure what Rom I was playing with... Oh and unsigned for me
Sent from my Desire HD using xda premium
Use apktool....put the frameowrk-res.apk in the same folder as the apktool u unpacked....then open command prompt and navigate to that folder....type "apktool if framework-res.apk"...that will install the framework...then when that finishes type " apktool d framework-res.apk ./out"...that will decompile the apk into the out folder you just created....make your changes then type..."apktool d -f -b framework-res out" that will recompile....when your finished you have to copy the original metainf folder into the newly recompiled apk....then copy the new classes.dex file into the new apk...done...hope that helped
Sent from my SAMSUNG-SGH-I997 using xda premium

Recompling an apk questions

Trying to modify contacts.apk to make the dialer multi-dpi compatible. Did that and it works.
My issue is recompiling the apk. Everytime I recompile the apk with apktool it looses over a megabyte in size. In my case went from 4.49MB to 3.19MB after rebuilding. Only file modified was dialer_app.xml and it's size stayed about the same.
I've brought framework-res.apk and twframework.apk into apktool. After copying the resulting contacts.apk back to the device it is not recognized.
I've also tried copying the META-INF directory from the original apk over to the new one. Still no luck. I'm new to this and if anyone has some help for me it would be greatly appreciated!
Did you sign your new apk after recompiling it ?
Do you have classes.dex and resources.arsc files in your new apk ?
since its a system apk I've read it shouldn't be signed. Only thing I did was copy the META-INF folder to the new apk. In the new apk I do see classes.dex and resources.arsc. All the files appear to be there but the apk has shrunken in size.
I'm guessing I'm missing something simple here. But I'm new to this. Been at it for a few hours haven't had any luck.
I am new in development field. I have two questions 1. Is there same meaning for building and recompiling using apk tool? 2. I know framework-res.apk is needed for apktool d com, but where and the what is the use of twframework.apk file. Please explain anyone .
Recompiled apks will be quite a bit smaller as they will have more compression applied, this is normal, just be careful as if the tool compresses it to much you will get fc's. But it should work fine.
idhbar said:
I am new in development field. I have two questions 1. Is there same meaning for building and recompiling using apk tool? 2. I know framework-res.apk is needed for apktool d com, but where and the what is the use of twframework.apk file. Please explain anyone .
Click to expand...
Click to collapse
Read the apktool website for info about framework files, as far as which one to use, if you are decompiling a la2 or la4 base use a kl2 or kk5 framework without jkays built in as the laX frameworks are kinda buggy.
Sent from my GT-I9100 using Tapatalk

Systemui.apk

Is it necassary to sign systemui.apk? I made some changes to the file and now when i flash the ROM I get systemui force closes
Sent from my PG86100 using xda app-developers app
kevin130 said:
Is it necassary to sign systemui.apk? I made some changes to the file and now when i flash the ROM I get systemui force closes
Sent from my PG86100 using xda app-developers app
Click to expand...
Click to collapse
No, you don't ever want to sign system apps. Are you sure the permissions are correct? and what changes did you make?
I didn't put any permissions. How do I set them in the zip? And I change the 3g icon to 4g because I have virgin mobile so I can't get 4g but I want it to say 4g lol.
Sent from my PG86100 using xda app-developers app
Well if you are installing it with a zip permissions are probably correct. I'm assuming you decompiled the apk changed the icon and compiled it again? If all you want to do is change an icon, just open the apk with 7zip or similar and replace the icon, no need to decompile. That should solve it. Let me know
Okay. I'll try that and if I do decompile it, how do I set the permissions? Cuz i decompiled settings.apk and made a XML change.
Sent from my PG86100 using xda app-developers app
kevin130 said:
Okay. I'll try that and if I do decompile it, how do I set the permissions? Cuz i decompiled settings.apk and made a XML change.
Sent from my PG86100 using xda app-developers app
Click to expand...
Click to collapse
You would set permissions if you are just pushing the apk to your phone. Better question, how exactly are you installing the apk after you made the changes?
I just replace the old apk in the zip file and flash the ROM.
Sent from my PG86100 using xda app-developers app
ok, then the updater-script in the zip is handling the permissions for you, so you don't need to worry about that.
So there is no need to sign anything at all? Awesome.
Sent from my PG86100 using xda app-developers app
Apps in /system/app/ never get singed, apps in /data/app/ however have to be signed.
Alright. Thanks.
Sent from my PG86100 using xda app-developers app
Android commander... http://androidcommander.com/
great tool you should use when first dealing with androids..
you can delete/pull/push files to your phone there also apk backup which backs up your apps from the play store.. just a great program to have in your PC.
no problem, let me know if you still need help or get it working
Hi I'm also trying to learn modifying systemUI.apk through smali edits
So as a start I just decompiled my systemUI.apk with apktool v1.5.2 with no errors. Then directly recompiled it. No modifications made. The resulting apk didnt have any META-INF folder and thus I suppose is unsigned. But pushing this apk to /system/app doesn't install it.. As a result after reboot I have no installed systemUI.apk
What am I doing wrong? BTW I'm on Sony xperia live with walkman. But I suppose this is a general thing. And yes I have installed all framework files and as a result no errors while de/recompiling
havocgb said:
Hi I'm also trying to learn modifying systemUI.apk through smali edits
So as a start I just decompiled my systemUI.apk with apktool v1.5.2 with no errors. Then directly recompiled it. No modifications made. The resulting apk didnt have any META-INF folder and thus I suppose is unsigned. But pushing this apk to /system/app doesn't install it.. As a result after reboot I have no installed systemUI.apk
What am I doing wrong? BTW I'm on Sony xperia live with walkman. But I suppose this is a general thing. And yes I have installed all framework files and as a result no errors while de/recompiling
Click to expand...
Click to collapse
The best way in case of small edits is to open both your stock and your modified SystemUI.apk with 7-zip, then copy the META-INF and AndroidManifest.xml from the stock to the modded one.
Close both and push back your modded one to the phone.
Guess that work.
pquinqu said:
The best way in case of small edits is to open both your stock and your modified SystemUI.apk with 7-zip, then copy the META-INF and AndroidManifest.xml from the stock to the modded one.
Close both and push back your modded one to the phone.
Guess that work.
Click to expand...
Click to collapse
Well now I use APK Multi-Tool and it works great. From what I have understood it keeps the same signatures as in the original SystemUI.apk and there is no need of any resigning.

[Q] Zip to APK issue

I just download MMOJ game, and wanted to make some changes for fun. I changed file extension from .APK to .Zip, unzip the file, modfied a .lua file, zip the files, and changed the extension back to .apk. Then, I tried to install the game, and then I receive "Parsing Error". What did I do wrong? As you can tell, I don't have a good programming skill, so when providing answers, please be as detail as possible, so any new comers can understand the explanation and solutions.
Thank you.
You need to find a program to properly de/recompile for you, search out apktool as one of many options, there will surely be instructions as well in you searches
Sent from my Nexus 4 using Tapatalk 2
demkantor said:
You need to find a program to properly de/recompile for you, search out apktool as one of many options, there will surely be instructions as well in you searches
Sent from my Nexus 4 using Tapatalk 2
Click to expand...
Click to collapse
Thanks for the reply. Because many people said that I can change .apk to zip and back to .apk, I thought de/recompile program was unnecessary. I will try a program. Any recommendation? Preferably free?
Depending on what you do yes you can unzip do somethings then rezip, but for most changes it needs to be decompiled, I usually use apktool, initially made by brut.all but has been updated by others, right now I believe version 3 is the latest
Sent from my Nexus 4 using Tapatalk 2
demkantor said:
Depending on what you do yes you can unzip do somethings then rezip, but for most changes it needs to be decompiled, I usually use apktool, initially made by brut.all but has been updated by others, right now I believe version 3 is the latest
Sent from my Nexus 4 using Tapatalk 2
Click to expand...
Click to collapse
I tried apktool, but after extracting the folder AndroidApktool in C:\ and put the .apk file I want to modify along with framework-res.apk, AndroidApktool.exe does not start. It gives an error. Is my PC language setting as Korean a problem, do you think?
Once changed from a zip to an apk after being modified.the apk usually needs to be resigned before attempting to reinstall again.
Sent from my SGH-T889 using Tapatalk 4
Um, did you open cmd/terminal and tell it to decompile?
apktool d xxx.apk
Or what do you mean by it doesn't start?
Sent from my Nexus 4 using Tapatalk 2
hasbrobot said:
Once changed from a zip to an apk after being modified.the apk usually needs to be resigned before attempting to reinstall again.
Sent from my SGH-T889 using Tapatalk 4
Click to expand...
Click to collapse
Does that mean if I can get a program that re-signs the .apk, I can install the modified .apk?
demkantor said:
Um, did you open cmd/terminal and tell it to decompile?
apktool d xxx.apk
Or what do you mean by it doesn't start?
Sent from my Nexus 4 using Tapatalk 2
Click to expand...
Click to collapse
No, I did not use the command line apktool d xxx.apk. I may have to read how-to.txt to understand how to execute the file. Because apktool was an executable file, I thought double clicking would start the program with graphical user interface waiting for further input from the user.
u can unzip apk to .zip, but not rebuild file .zip to apk if you're not use tool. It'll not compiler.

Categories

Resources