[Q] APKMultiTool and system APK's - Android Software/Hacking General [Developers Only]

Hello,
I'm trying to change a system application on my phone using the APKMultiTool utility but am having problems. The resulting APK will crash my phone which complains about 1,000 permissions are not understood: Unknown permission android.permission...
Steps I've taken.
- Downloaded APKMultiTool
- (9) De-compiled the system framework-res.apk
- Edited the arrays.xml file
- (10) Compiled the APK
- (11) Signed the APK
- Pushed the APK back to the device
The result is an unstable system which will just crash often. Does anyone have the correct procedure for editing system apk's using the new APKMultiTool?

1.Never sign a system apk
2. Use APK manager not apk multitool
3.After compiling, open the apk using winrar and take out resources.arsc and put it back again but with compression level set to store
And then push it to phone.

you must not compiled framework-res.apk
answer Yes to both questions
delete resources.arsc in the keep folder and done

Related

[Q] How to edit .xml files within and .apk

Im not trying to re-engineer an app, but I simply want to check out an apk to look at the placement of a certain line of code. When i open up the files within the apk though, i get a bunch of nonsense. How do I edit the files within the apk...i know theres a way, or else we wouldnt have custom roms.
Apktool (or some wrapper like Apk Manager). It's quite outdated, so you won't be able to decode some newer apks though.
Brut.all said:
Apktool (or some wrapper like Apk Manager). It's quite outdated, so you won't be able to decode some newer apks though.
Click to expand...
Click to collapse
gahh, i was hoping there would be an easier way than that xP...I experimented with apktool, but it wasnt recognizing the .apk i was typing in...i just suck with command prompt stuff
....thanks anyway though
schwartzman93 said:
gahh, i was hoping there would be an easier way than that xP...I experimented with apktool, but it wasnt recognizing the .apk i was typing in...i just suck with command prompt stuff
Click to expand...
Click to collapse
Brut.all also mentioned APK Manager in his post which is a script wrapper for his apktool that automates much of the process. It's available at the link I gave for both Windows and Linux. All you should need to do is run the script, place your apk in the appropriate folder created by the script, have the script decompile your apk, then you can find the decoded xml file(s) of interest.
thanks guys
i was having a bit of trouble with apk mananger, i couldnt get it to do anything with this one app, i would tell it an action and it just closed the script
EDIT: I figured it out
Hi guys, i'm using APK Manager and i was able to change the xml without having any trouble by decompressing the apk. I'm wondering what i need to do in order to resign the APK. I have already tried to compress the apk and then sign it, but streight away after I installed the apk i got in boot looping.
The file i'm talking about is the framework-res.apk
Any suggestion?
Thanks in advance.
Edit/
Solved.
Basically i was trying to sign framework-res.apk, instead i have found the solution in this forum that actually worked fine for me:
Code:
1. Place your original "framework-res.apk" into "\place-apk-here-for-modding\" folder
2. Run "script.bat"
3. Set Project (22) and choose the "framework-res.apk" (1)
4. Decompile (9)
5. Place or overwrite new Xmls and PNGs in "\projects\framework-res.apk\res\drawable or drawable-hdpi"
5. Recompile (11)
6. Answer "Yes" when it asks wheter it is system file
7. Answer "Yes" when it asks "would you like to copy over any additional files...?"
8. Script is paused => (don't press a key)
9. Go to the "keep" folder (it's in the same folder than "script.bat")
10. In this "Keep" Folder,
- delete "resources.arsc" file
- delete originals "stat_sys_battery.xml" and "stat_sys_battery_charge.xml" from the "keep\res\drawable" folder
- delete all originals PNGs that were meant to be edited
11. Go back to "script.bat" and press a key to let him finish the job
12. Your new "framework-res.apk" has been created in the "\place-apk-here-for-modding\" folder. It's called "unsignedframework-res.apk".. but he's not working yet.
13. Unzip all the content of the "unsignedframework-res.apk". You should have 5 objects (3 folders, 2 files).
14. Zip these files with Winrar/Winzip (whatever) but you must choose "No compression" method to zip it.
15. Rename this zip into "framework-res.apk".
15. Put it into an update.zip and it should be OK to flash trough the recovery mode.
Thanks anyway!

Making Widget Skins Transparent Tutorial (for all android phones)

"How To Make Widget Skins Transparent"
TOOLS needed: 7zip or Winrar and ApkManager v4.9* by Daneshm90 of xda
1. Transfer the apk from your phone to your computer. It's probably in a place like data/app or data/data or the like
2. Open the apk with 7zip (or Winrar). Do not extract the whole thing, just open it. Inside you'll see a folder called "res"; transfer that somewhere on your computer.
3. Inside the res folder you'll see a bunch of folders. The images you want to edit are usually in a folder labeled "drawable", but you may have to look elsewhere
4. Find the background image you want to edit. It might be labeled widget_bg or something helpful like that.
5. Edit it how you want. In the case of transparency, you want to delete the background and make it entirely transparent. Save it in the same format and do not change the name. (Note- if your file has .9.png in it, you're dealing with something else. I can't really help you on this)
6. Drag the res folder with your modified images back into the archive, using 7zip. You might want to use a duplicate of the apk, just to have the original on hand in case something goes wrong.
8. Place the modified apk into the place-apk-here-for-modding folder in the APK Manager folder
9. Open up script.bat. Select your project using option 22.
10. Do the following things- Extract APK (1), Zip APK (3), zip as regular apk (2), sign apk (4)
At this point you should have a signed version of the apk in the place-apk-here-for-modding folder. You can transfer it to your phone now and install it. Or install it directly onto your phone through apk manager if you have ADB enabled.
*Apk Manager 4.9 - Modifying Ur Apk
Features:
- Extract, Zip apk's.
- Optimize pngs (ignores .9.pngs)
- Zipalign apks
- Sign apks
- Push to specific location on phone
- Incorporates brut.all's apktool
- Pull apk from phone into modding environment.
- Batch optimize apk (Zipalign,optipng,or both)
- Quick sign an apk (Batch mode supported)
- Batch Ogg optimization
- Compression level selector (monitor status above menu)
- Batch install apk from script (option 16)
- Logging on/off has been removed. Instead a log.txt is created which logs the activities of the script organized using time/date headers
- User can change the max java heap size (only use if certain large apks get stuck when decompiling/compiling apks) (Option 19)
- Improved syntax of questions/answers
- Error detection. Checks if error occured anytime u perform a task, and reports it
- Read log (Option 20)
- U can now set this script as ur default application for apks. When u do, if u double click any apk it will install it for u.
- Supports batch installation, so if u drag multiple apks into the script (not while its running) it will install them all for u. U can ofcourse drag a single apk as well
- Added framework dependent decompiling (For non propietary rom apks). (Option 10). Checks whether the dependee apk u selected is correct.
- Allows multiple projects to be modified, switch to and from.
Instructions (Windows):
- Place apk in appropriate folder (Any filename will work, if running for first time folders will not be there, you must run and then the folders will be created)
- Run script
- Minimize the script
- Edit files inside the project folder
- Maximize the script
- Allows to modify system apk's using apktool but ensures maximum compatibility in terms of signature / manifest.xml
Orignally created by Ilangoadigal from other forum
LINK FOR DOWNLOAD
http://www.megaupload.com/?d=ZJTFFLI7
http://depositfiles.com/en/files/x33e5g04v
http://www.zshare.net/download/801778048c8cfcab/
http://uploading.com/files/d3mm5616/apk_manager_4.9.zip/
For those who have problem downloading from filesharing sites
Whole thread dedicated to this forum.xda-developers.com/showthread.php?t=990014
Sorry mate if its allready been posted but the link you gave dosn't open

[Q] Issue decompiling apk with apk manager

I have apk manager 5.02 which I can de-compile framework and recompile with out any issues.
I downloaded the stock 2.08 sense 3.5 rom and used explore2fs to extract the contents of the system.img file. From there I then put htcdialer.apk file into apk manager to decompile it and I get the following errors:
See attached log file as it is too big to put into the forum.
Any ideas why the apk file is not decompiling?
I dont hink that apkmanager can correctly decompile sense 3.5 apks, I could be wrong but i could never get them to work properly
If APK Manager and Tool cant extract even GB ROM apks is there a way of extracting and editing xml files? I tried 7zip and I can edit images but XML's do not extract correctly
Really interested to see how to edit XML files if APK Manager and APK Tool cant decode the APK's.
Found out what I was doing wrong!! When decompiling the apk file I wasn't adding the dependancy. So for example when I was decompiling the systemui.apk, I was simply using option 9 to decompile which is not right!
What you need to do is copy the systemui.apk file in to place-apk-here-for-modding
Then find the dependency framework so for example the systemui.apk depends on com.htc.recources.apk. So pull this from your phone on to the desktop and then use option 10 to decompile. It will then prompt you for the dependancy apk file. Drag that on to the command window and press enter and it decompiles! It is easy when you know how
Also when you recompile you will probably get errors...You need to take the newly created classes.dex and drop it into the original apk then push to your phone
Where can I find the dependency file??
I got the same problem when I try to Decompile any system app, like "SystemUI.apk" or "Settings.apk" ...etc
Now I understand from you that I need a dependency file, Where can I get it??
I use Samsung Galaxy SL (I9003), Rooted and Deodxed
i use samsung galaxy mini. can i use apkmanager to decompile any apk for my device......by pressing 9 directly.....? i want to decompile settings.apk....thnx in advance......

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.

How to delete lib directories from apk

Hi .. i'm new of this forum ...(i'm not a java programmer, but i programmed with other languages)
Env : Windows 7 - Apk editor studio 1.4.0 - apktool 2.5.0
Usually i'm doing this simple steps ..
1) Open the package with apk editor studio
2) Opens the lib directory and delete what do not belongs to my android amreabi-v7
3) Save the apk : Apk editor calls apktool to rebuild, the optimize zip ,and sign ...
This works with all packages except with two very huge apk packages ....
When i rebuid i get errors, each apk issue a different error, so I' immagined programmers inserted a trap or somethig like to forbid reverse engeenering
I do not want to hack, but only to reduce storage usage....
is there a way to "unzip - delete libs - zip to apk - sign" without using apktool ?
Thanks in advance for the support

Categories

Resources