So i have written a simple script to ease the process of editing apks. Got a lot of downloads so thought its in demand
Whether you're doing basic image editing or editing the smali or xml files, on average u have to use (Brut.all or JF's smali/baksmali) awesome tool to extract the apk, edit it, then sign the apk and then adb push/install it. This process is quite tiresome if you are testing a method that needs fine tweaking.
This script should make the process a LOT smoother.
Theres an option of compiling/signing/installing all in one step
Thanks:
Goes to Brut.all for his awesome tool.
Goes to JF for ofcourse, smali/baksmali
Goes to farmatito for porting this script to linux
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.
- Allows to modify system apk's using apktool but ensures maximum compatibility in terms of signature / manifest.xml
- Stuff i forgot i guess
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
Instructions (Linux):
- 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)
- Open terminal and change-directory to apkmanager (Easiest way is to type "cd ")
- Chmod 755 Script.sh
- Chmod 755 all files apps inside other folder (thanks for the tip bkmo )
- Run script by typing ./Script.sh
- Minimize the script
- Edit files inside the out folder
- Maximize the script
Requirements:
Java
Adb
Future Improvements:
- Manage multiple simultaneous apk edits (choose which apk to extract/build)
- Option to optimize the apks
- Option to adb push to user defined location
- Other stuff i dont know yet
Got problems ?
1. Make sure your path has no spaces
2. Your filename has no wierd characters
3. Java/adb are in your path
4. It's not a proprietary rom's apk (aka Sense,Motorola,Samsung) (If u are, then use option 11 and drag the required framework, eg com.htc.resources, twframework-res...etc)
5. It's not a themed apk (if it is, expect .9 png errors, use as close to stock as possible)
6. Look at the log to know whats happening
7. If all else fails, post as much info as possible and we will try to assist you.
MOD EDIT:
New DL link from this post
http://apkmultitool.com
Nice
As you probably know, I want to add signing and installing functionality to apktool. But I don't plan to make any kind of GUI for it, so such wrapper is a very good thing for many users, thanks
What is "Option to optimize the apks"?
I was thinking of incorporating the script "apkopt" it was basically using optipng to optimize the png's and then used zip align on the apks. Thanks btw, this tool wudnt exist without ur awesome script
I just did this so ppl would stop asking questions like "How do i change this/that in an app"
Here this is wht im talking about Link
Very nice
Thanks dude...
once again you manage to make modding easier with your scripts!
Does your apkopt avoid .9.png files? Because those have been a pain in the behind.
Re: Apk Manager 1.0 - Makes Modifying Ur Apk A Breeze
my script currently does not optimize apks. it will be in the upcoming updates and yea prolly when ill implement itll avoid .9.pngs lol
I have already incorporated "adb push" into the script.
Aside from adding an option to optimize the apks, is there anything else you guys think would make this script easier to use ?
Im really targetting those ppl who overcomplicate the simple process of editing apks. Any tips would be appreciated.
I posted a video attached to the main post.
New version out, features added are
Zipalign apks
Optimize pngs, ignores .9.pngs
allows to adb push to phone through script.
Great script man, it works flawlessly. You may just wanna edit your post #1 rather than continuously bumping with new posts for every update. I'm sure a mod won't be too pleased with that
I'm getting the
'java' is not recognized as an internal or external command, operable program or batch filemessage when I attempt to sign an apk. I tried switching the PATH in Environment Variables so that it's pointing to my Java bin folder, but then I just end up with
java.io.FileNotFoundException: ..\place-apk-here\repackaged-unsigned.apk <The system cannot find the file specified>
at java.util.zip.ZipFile.open<Native Method>
at java.util.zip.ZipFile.<init><Unknown Source>
at java.util.zip.ZipFile.<init><Unknown Source>
at java.util.zip.ZipFile.<init><Unknown Source>
at com.android.signapk.SignApk.main<SignApk.java:320>
Could Not Find C:\ApkManager2.0\place-apk-here\../place-apk-here/repackaged-unsigned.apkHelp? :]
What app are you trying to edit ? also are you editing pngs only or code editing ?
Hop on Here im helping someone out so ill help u 2
There's a lot of things in /system that benefit from the optimized .pngs. Vending.apk, for instance, shrunk to half the size and runs a bit quicker and smoother now. Even framework-res.apk enjoyed the optimization. Paid apps, on the other hand, don't seem to fare so well; perhaps they check the md5sum of the app or something.
Yea png optimization works for almost all apks, zipalign on the other hand as i recall doesnt work on certain system apks such as settings.apk. Im prolly gonna incorporate apkopt's script into this which would allow to optimize a folder full of apks. As for paid apps not being optimized, a lot of dev already do their part on making the apk as small as possible, so perhaps thats the case.
hmm, after trying a couple of unpaid apps, it seems that perhaps the testkeys aren't compatible with my build. For any signed app, I get an error "Failure [INSTALL_FAILED_UPDATE_INCOMPATIBLE]"
Yes when u modify a non system apk, they need to be resigned, and you cannot resign it with same key as dev cuz u dont know it hence anytime u modify an app, u must uninstall it, install the modded version, and from then on any change u make u dont have to uninstall as the keys will match
ahhh thanks. My mistake was just removing the package rather than uninstalling it.
Getting this on a zipalign. The file is there but it is repackaged-unsigned.apk and throws this error:
Please make your decision: 5
Unable to open 'E:\ApkManager\place-apk-here\repackaged-signed.apk' as zip archi
ve
Could Not Find E:\ApkManager\place-apk-here\repackaged-signed.apk
The system cannot find the file specified.
Nevermind....looks like it is by design that it tries both signed and unsigned and throws the error on the file that does not exist. It's just I did not see any zipalign output
having an issue that when I go to resign an apk the file deletes after running the script.. am I missing something here?
Hi everyone,
Imagine that you are updating two or more themes for roms like OpenDesire/Defrost/CyanogenMod (I'm pretty sure that this updater works for every AOSP rom but I didn't try), that in one week can be updated at least 4 times. Don't get me wrong, the updates are appreciated, but updating all the themes for all the new versions gets old in no time.
So, I made myself two scripts, one that runs on Windows (this is the first one so is no so updated, but if I see that people use this I'll be willing to create a C# version) and another for linux (bash script), that do this work for me.
This scripts, decompile, copy the modded file (for the status battery), compile the framework again and then add the new images to the framework. After all that it generates the update.zip file for each mod so they can be flash using the recovery (Clockworkmod/Amon Ra/even the default recovery).
Windows Version 1.0
Linux Version 1.0
In the second post, I'll put instructions explaining how to configure the scripts.
Credits :
Brut.all for APKTool.
Daneshm90 for the APKManager (It give me the basic knowledge to create the first versions of the scripts).
Instructions :
Windows.-
If you want to update more than one mod at the same time, you need to edit the script.bat file and modify the "start:" seccion like this :
Code:
:Start
if "%jumpmod%"=="0" set mod=MOD1
if "%jumpmod%"=="1" set mod=MOD2
if "%jumpmod%"=="2" set mod=MOD3
if "%jumpmod%"=="3" set mod=MOD4
if "%jumpmod%"=="4" goto end
set jump=0
goto Create
In order for this to work you need to put the original framework-res.apk in the folder "original"
The mod files have to be in MOD/Images (images you add) and MOD/Xml (xml to recompile). Right now the script is only prepare to recompile the xml for the status battery.
If you add more than one mod, the folders name must be the same as in the start seccion (MOD1, MOD2, MOD3...)
You must have installed Java JRE
Once you configure the script, run it, wait for it to be done. Then go to the result folder and you will find the update.zip file/s.
Linux.-
If you want to update more than one mod at the same time, you need to add as much folders as mods you want in the mods folder. The new folders must have the same structure as the default one.
The mod folders contains one folder to put the images to add after the framework have been recompile (MODNAME/add/drawable-hdpi) and one folder for the file that are used to make the mod (MODNAME/mod/drawable for the XML and MODNAME/mod/drawable-hdpi for the necessary images).
In order for this to work you need to put the original framework-res.apk in the folder "original" or you can download the original Rom by using the script (it extracts the framework-res.apk from /system/framework/).
YOU MUST configure the variables within the script.sh to set the initial path of the script and the path to copy the resulting update.zip files.
In order for this to work you must be ROOT (This is because the apktool, if anyone have a workaround please let me know)
You must copy the following files to /usr/local/sbin/ for this to work :
Code:
/theme_updater/other/7za
/theme_updater/other/aapt
You must have installed openjdk
Windows.-
Version 1.0 - Initial release
Linux.-
Version 1.0 - Initial release
thanks Zeussn, it worked like a charm when i was using it yesterday
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
Hi all,
I know there are tons of 'how to make themes' threads out there in this community but like the title says , its specially for noobs( like me ).
Now I am not talking about noobs who dont know anything about the android OS,framework, recovery etc. Here, by noobs i mean people who dont know how to decompile apps, sign them , make them flashable , use SDKs etc. This guide will throw some light on some of the easier ways out there by using the brilliant features of some apps and programs combined with each other and believe me , it will give you the final result !
So Lets get started :
REQUIREMENTS
1.A NANDROID BACKUP !!
2. Ninjamorph from Stericson : creating a project , replacing PNGs and finishing the project .
http://forum.xda-developers.com/showthread.php?t=674604
3. An image editing software ( I used Photoshop)
4. Root File Manager (any)
5. Knowledge about your device , Duhh
PROCEDURE
1. Open up ninjamorph and start a new project.
2. Find the APK you wanna modify ( Framework-Res.apk for almost everything; SystemUI.apk for statusbar, clock , general backgrounds , drawer etc ; contacts/seccontacts.apk for phone/dialer , messaging.apk for sms app mods etc , i hope i made my point clear )
3.Modify Apks
now, from here you need to choose your path
Method1
4. (conventional one )Inside the project, goto drawable-hdpi ( for backgrounds goto drawable-nodpi ) and replace the pngs with the pngs you want by downloading them or extracting them from existing packages (of the same size as the original )
5. After replacing the images , simply finish your project and you're done!
Method2( which i used )
4. when you create a project , the Apk is extracted to the location in your device at /sdcard/androidthemes/workspace (your SD card) as a simple folder . Copy this folder to your Pc.
5.Edit the images using an image editing software like PS and save all the images in the copied folder itself in their respective locations OR you can replace the whole apk folder with an already modified/themed folder but just make sure that the modified apk folder is of the same device as yours( since if even a single image which is missing in the modified folder but is present in the original apk folder or is not changed appropriately , it will result in the app not being able to run. It will stop.
6. Once you're done with the replacing, replace the apk folder in /sdcard/androidthemes/extracted with the one you have changed in the above step.
7. Then Goto ninjamorph in your device and simply finish the project whose apk extracted folder you have just modified. Ninjamorph will compile and build the apk from your workspace folder and it will replace the original apk with your modified one.
8. Your new Apk has been themed! :laugh:
Precautions.
1.Have a nandroid backup ( big precaution )
2. Have backups of both the .apk file and the original extracted apk folder , so that if you make an incompatible modification and the app doesnt run, then just replace the apk in the file system of your device ( /system/app or /data/app depending on the apk you are modifying whether it is system or user) OR replace the extracted apk folder in /sdcard/androidthemes/workspace with the original one backed up.
Bonus - Make a flashable zip of your themed apks
http://forum.xda-developers.com/showthread.php?t=1572962 ( modify the updater script in the zip in the META-INF folder present in the sample zip to match your needs ) by @cheatman
Hit Thanks :good: if this helped
****Your warranty now void***
I am not responsible for crashing of apps or of bootlooping of your device, be sure you know how to get your device recovered using recovery(obviously custom one like twrp)
Hello guys, i am a new user here (not dev lol) and I have a old android device (codename:lettuce) and people like me who have low storage phones suffer problem due to apps getting bigger and bigger everyday.
No more stupids talks lets get to work.
Info: I recommend you to reduce the size of those user apps which you do not update frequently as after every update they will get replace by new one. And I definitely recommend to use app reduction on system integrated apps as it will allow you to move user apps into system on generated free space
Prerequisites:
1. Root Explorer app
2. ZArchiever app
3. Little knowledge of file managing
There are two independent methods to reduce size of any apk or bundled apk. You can either follow both or one or none
Method 1: Compressing APK's "resources.arsc" ( it is present inside apk you can see it using any archive app, i recommend ZArchiver)
Steps:
1. Search for apps which have >=10MB of "resources.arsc" file in the apk or bundled apk files and mark them for the operation.
2. Copy the apk into a dedicated folder in local storage of your device.
3.Open ZArchiver and open the apk's contents using "view" button
4.Extract "resources.arsc" and then again open the same apk.
5. Now tap on add button located in lower right corner and use file icon.
6.Now select the extracted "resources.arsc" file, check the compression level to fastest and add
7.Magic happened, apk size reduced
8.Move and replace the newly compressed apk or bundle apk with the installed one (make sure you force close the corresponding app first) and change the apk permission to 644.
Tips:
1.Do not compress files at ultra as it will slow down loading of images, icons, and other stuffs.
2. Settings have >=30MB of resources
Method 2: Removing "lib" folder inside those apps' apk or bundled apk which extract "lib" folder during installation like Youtube, Maps, Hangouts and many more. Highly recommended for system integrated apps, It is my advice to do not use this method on user apps.
Info:
1.This method should not be applied on Play Store and Google Play Services.
Steps.
1. ***Very Important*** Only for those apps which are installed either as system or user. Applying this method on backed-up apks will corrupt them. Do not touch these "lib" folders "/system/(app or priv-app)/*app_name*/lib" and "/data/app/*app_name/lib"
2.Copy the apk which fulfill condition for this method and extract lib folder using ZArchiver.
3. Here comes boring task, open any file manager you prefer then create and replace all ".so" files present in "lib" and its child folders with blank files ".so" with ***EXTACT SAME NAME*** nothing change in name or neither absence of any filename..
4. You may choose big ".so" files only greater than ~1MB only and leave others untouched.
5.Now after replacing the lib files with blank one, get back to ZArchiver,.open the apk from which u extracted lib folder then tap "add" button in lower right corner, tap upper file icon and then select the extracted and edited lib folder by tapping its icon, change compression level to ultra and tap add.
6.Now you have a apk file with fake lib files.
7.Force stop the app and replace apk file with edited one and set permission to 644.
8.Enjoy
Screenshots
https://photos.app.goo.gl/6dybtLkwu6mscXJ18