[Script] [Unmaintained] Quick Deodex Tool (v1.0.2) - Miscellaneous Android Development

Due ART changes, Quick Deodex doesn't work with Android Lollipop/Marshmallow/Nougat ROMs. I might update this script some day, but due other priorities and lack of time, this tool is currently unmaintained.
Well, if you ever tried to deodex a single APK file you should know how tricky this process can be. Searching XDA we find various tools and tutorials in how to deodex but most of them may look complicated enough to make a newbie or an user that never messed around with Android system give up. So, I wrote my own script to simplify two tasks: deodexing and zipaligning. I also made this script with newbies in mind, so, I did my best to make this tool as straightforward, small and portable as possible.
Requirements
• For Linux, you need OpenJDK 6 or newer
• For Windows, you need Java SE runtime 6 or newer
Instructions
• Download the script and extract it somewhere
• Grab a copy of the folders "framework", "app" and "priv-app" (optional, KitKat only) and put them inside "files" folder
• Run quick_deodex.bat (or quick_deodex.sh on Linux) and wait while the files are being deodexed
• After the script finishes, all files inside the folders you copied before will now be deodexed and zipaligned.
Any file that fail to deodex will be skipped and left intact, so you can fix what caused the problem and run the tool again. If all files fail to deodex, make sure Java runtimes are installed properly
Frequently Asked Questions
Q: I keep getting "Framework not found" error. What should I do?
A: For most APKs you can only deodex if you have the framework files, so, I made this a requirement, even if you want to deodex only a single file. In that case, grab a copy of "framework" folder from the same ROM you got the APK and run this script again, it'll fix that.
Q: I'm trying to deodex an entire ROM but some files get errors and aren't deodexed. What should I do?
A: This usually occur only if the files you're trying to deodex and the framework are from different ROM versions. If the files are all from the same ROM version and you're still getting this, try updating smali and baksmali components used by this script by downloading an updated copy and replacing the ones this script uses (located in "tools" folder).
Changelog
Version 1.0.2
• Minor bug fixes (Linux only)
Version 1.0.1
• Now compatible with Linux
Version 1.0
• Initial release

+1
It work without errors.
thanks man, it's first tools that perfectly worked.

Hey, has anyone tested the Linux version? Did it work? Linux users, leave some feedback

mbc07 said:
Hey, has anyone tested the Linux version? Did it worked? Linux users, leave some feedback
Click to expand...
Click to collapse
I will test out the Linux script later, in the process of doing clean install of 14.04 and setting up build environment, currently the windows verison is running though, looks like you have done a very nice job here, thank you a lot.

Version 1.0.2 is out, it fixes "Permission denied" errors that may occur in some Linux distros...

mbc07 said:
Version 1.0.2 is out, it fixes "Permission denied" errors that may occur in some Linux distros...
Click to expand...
Click to collapse
Still haven't gotten around to it, If all else fails, I will get time this weekend, stuck doing some cad drawings the next few days!

I keep getting this error in Ubuntu 14.04. ( Using Java7 Open JDK AMD64 version )
Exception:
Code:
JNLParseException[ Could not parse launch file. Error at line 0.]
at com.sun.javaws.jnl.XMLFormat.parse(Unknown Source)
at com.sun.javaws.jnl.XMLFormat.parse(Unknown Source)
at com.sun.javaws.jnl.LaunchDescFactory.buildDescriptor(Unknown Source)
at com.sun.javaws.jnl.LaunchDescFactory.buildDescriptor(Unknown Source)
at com.sun.javaws.Main.launchApp(Unknown Source)
at com.sun.javaws.Main.continueInSecureThread(Unknown Source)
at com.sun.javaws.Main.access$000(Unknown Source)
at com.sun.javaws.Main$1.run(Unknown Source)
at java.lang.Thread.run(Thread.java:745)
Wrapped Exception:
Code:
Failed to find the '<' charater that marks the end of a CDATA element. Exception parsing xml at line 0
at com.sun.deploy.xml.XMLParser.skipPCData(Unknown Source)
at com.sun.deploy.xml.XMLParser.nextToken(Unknown Source)
at com.sun.deploy.xml.XMLParser.parse(Unknown Source)
at com.sun.javaws.jnl.XMLFormat.parse(Unknown Source)
at com.sun.javaws.jnl.XMLFormat.parse(Unknown Source)
at com.sun.javaws.jnl.LaunchDescFactory.buildDescriptor(Unknown Source)
at com.sun.javaws.jnl.LaunchDescFactory.buildDescriptor(Unknown Source)
at com.sun.javaws.Main.launchApp(Unknown Source)
at com.sun.javaws.Main.continueInSecureThread(Unknown Source)
at com.sun.javaws.Main.access$000(Unknown Source)
at com.sun.javaws.Main$1.run(Unknown Source)
at java.lang.Thread.run(Thread.java:745)

@DarkAngel if it's a Java error, then it's related either to smali/baksmali or to the input files, not to the script itself. I would suggest testing the files you're trying to deodex in other tools, if they work, report to me what tool worked so I can try to figure out what's wrong in Quick Deodex...

@mbc07 I did keep seeing that and even made sure my path was set for Java. I'll see what I can come up with.
Having switched to a new Laptop has had me looking for new things as I was already set up before. ADB/Fastboot, JOdin3/Heimdall I can do fine. Windows I'm good to go as well I just rather do more/learn more in Linux this time around.

@mbc07
I tried it once again, this time uninstalling & purging all copies of Java ( only had version 7 & 8 though ) and then reinstalled version 7 only. I still get the same error. I did also try updating the smali and baksmali components just in case but no dice.
-------------------------------------
Windiows version, on the other hand, did go smoothly with no problems for me at all. Deodexed both folder perfectly w/ no errors ( JB 4.2.2 ). Tried them on a phone I have and all is working perfectly. :good:

With Dalvik runtime the deodexed files works well but when switching to ART I'm having bootloop.
Tested with Nexus 4 stock 4.4.4 KTU84P (during the deodex process there wasn't any errors) and clean install (factory reset)

Try updating smali / baksmali, I'm not running KitKat so there's not much I can do to test that =/

mbc07 said:
Try updating smali / baksmali, I'm not running KitKat so there's not much I can do to test that =/
Click to expand...
Click to collapse
If this can help you to fix the bug (or help someone else that encounter the same problem), I solved the problem by using this deodexer with compression level 0.

Desno365 said:
If this can help you to fix the bug (or help someone else that encounter the same problem), I solved the problem by using this deodexer with compression level 0.
Click to expand...
Click to collapse
Thanks for the tip, I'll take a look at it...

THANK YOU!!!!
mbc07 said:
Well, if you ever tried to deodex a single APK file you should know how tricky this process can be. Searching XDA we find various tools and tutorials in how to deodex but most of them may look complicated enough to make a newbie or an user that never messed around with Android system give up. So, based in Kamome tool and @RyokoN work, I wrote my own script to simplify two tasks: deodexing and zipaligning. I also made this script with newbies in mind, so, I did my best to make this tool as straightforward, small and portable as possible.
Requirements
• For Linux, you need OpenJDK 6 or newer
• For Windows, you need Java SE runtime 6 or newer
Instructions
• Download the script and extract it somewhere
• Grab a copy of the folders "framework", "app" and "priv-app" (optional, KitKat only) and put them inside "files" folder
• Run quick_deodex.bat (or quick_deodex.sh on Linux) and wait while the files are being deodexed
• After the script finishes, all files inside the folders you copied before will now be deodexed and zipaligned.
Any file that fail to deodex will be skipped and left intact, so you can fix what caused the problem and run the tool again. If all files fail to deodex, make sure Java runtimes are installed properly
Frequently Asked Questions
Q: I keep getting "Framework not found" error. What should I do?
A: For most APKs you can only deodex if you have the framework files, so, I made this a requirement, even if you want to deodex only a single file. In that case, grab a copy of "framework" folder from the same ROM you got the APK and run this script again, it'll fix that.
Q: I'm trying to deodex an entire ROM but some files get errors and aren't deodexed. What should I do?
A: This usually occur only if the files you're trying to deodex and the framework are from different ROM versions. If the files are all from the same ROM version and you're still getting this, try updating smali and baksmali components used by this script by downloading an updated copy and replacing the ones this script uses (located in "tools" folder).
Q: I want to deodex a KitKat ROM, but it have an additional "priv-app" folder with .odex files. Is this script compatible?
A: Yes, it is. When "priv-app" folder is present, the script handle it accordingly. Otherwise the script assumes it's a JellyBean ROM or older and skips "priv-app".
Changelog
Version 1.0.2
• Minor bug fixes (Linux only)
Version 1.0.1
• Now compatible with Linux
Version 1.0
• Initial release
Click to expand...
Click to collapse
Thank you so much!!! My phone doesn't play nice with deodexing. I've tried before to deodex my files with the kitchen, but always had problems. This tool is so easy to use, and it seems to work perfectly!!!! I have an old phone (LG Spectrum), and I am still a NOOB, but with your tool, I now have a debloated, customized deodexed zipaligned rom I can flash with no problems!!!!!

Thanks a bunch for this and thankkkkkks for making it work for linux, cant believe all the folks making deodex scripts that only work on windows tyty.

works perfectly .. just wanted to know how can i know is it zipling or not?

manan001 said:
works perfectly .. just wanted to know how can i know is it zipling or not?
Click to expand...
Click to collapse
The script zipalign the file right after it gets deodexed. If the zipalign process fails, the script will output "FAILED" and the file will remain untouched.
In other words, if you got "DONE" in the script, the file were successfully deodexed and zipaligned...

Nice tool but not working in windows 64bit but working fine in 32bit
Downloaded the latest update of smali/baksmali but the result is almost 50% ERROR, others DONE

modfiles said:
Nice tool but not working in windows 64bit but working fine in 32bit
Downloaded the latest update of smali/baksmali but the result is almost 50% ERROR, others DONE
Click to expand...
Click to collapse
The script works perfectly in 64-bit editions of Windows. However, you need also to install 64-bit edition of Java, otherwise it won't work. About your errors, check your input files, if possible, try to find another tool that successfully deodex them and tell me which tool is so I can take a look and fix Quick Deodex :good:

Related

Auto-Deodexer 2.3 [SCRIPT] [FROYO SUPPORT] [Devs Only]

Hey guys, so this script de-odexe's a rom's apks and jar's.
Many thanks to ofcourse JesusFreke who created this method and the way to do it. Also to coolbho for his apkopt script from which i learnt certain techniques of batch programming. This is crzyruski script updated with jesus freke's latest smali/baksmali update ver 1.2.3
It incorporates detecting the bootclasspath of the odex instead of the user specifying it. For non standard odex however a specific bootclass path must be defined. For example:
According to Jr33 for rosie deodexing u have to add class paths com.htc.framework.jar. Thank him for the new Sense bootclasspaths
For those who dont know, this essentially uses jf's method of baksmali'ing the odex file into smali files, and then recreating the classes.dex file and packaging it into the apk hence disregarding the need for the odex.
*New Menu added
*Ability to specify custom bootclasspath (eg for sense ui)
*Added a java check at the beginning
*Added 1.2.3 smali/baksmali with froyo support(thank jf ofcourse )
*Modified it so if an error is encountered during deodexing, it leaves that file behind so once done you know what files encountered errors
*Added Ignore Mode
*Removed zipalign
*If apk doesnt have corresponding odex, it moves it to deodexed_APK instead of user manually moving it
*Added compression level option
*You can monitor the status of ignore mode / compression level right above the main menu
DISCLAIMER:
Its a batch file so it'll only work on windows.
Convince farmatito to bring this to linux
Thanks
So I checked this out and all ...
It's only apk's, right?
I only glanced but I didn't see anything in there for framework, etc.
If I'm right, then perhaps .. you should just say it de-odex's a ROM's apk's instead of the entire ROM.
~enom~
enomther said:
So I checked this out and all ...
It's only apk's, right?
I only glanced but I didn't see anything in there for framework, etc.
If I'm right, then perhaps .. you should just say it de-odex's a ROM's apk's instead of the entire ROM.
~enom~
Click to expand...
Click to collapse
Oh, yea so it takes the apk and odex and creates the classes.dex and repackages into the apk so u only need the apk. Ok, ill change the post a bit also yes, it doesnt do frameworks cuz i dont think they have odex's and the jar's do but i dunno of a method to do tht
Daneshm90 said:
Oh, yea so it takes the apk and odex and creates the classes.dex and repackages into the apk so u only need the apk. Ok, ill change the post a bit also yes, it doesnt do frameworks cuz i dont think they have odex's and the jar's do but i dunno of a method to do tht
Click to expand...
Click to collapse
Yea ... the jar's have dex's too and can be odex-d and can also be un-odex-d. I personally have never been able to successfully de-odex a fully odex'd framework (but I haven't tried hard enough either ). The main difference is once they are de-odex'd ... you insert the classes.dex into the jar and no re-signing required (as they aren't signed).
Either way, nice script mate. Good Job!
~enom~
enomther said:
Yea ... the jar's have dex's too and can be odex-d and can also be un-odex-d. I personally have never been able to successfully de-odex a fully odex'd framework (but I haven't tried hard enough either ). The main difference is once they are de-odex'd ... you insert the classes.dex into the jar and no re-signing required (as they aren't signed).
Either way, nice script mate. Good Job!
~enom~
Click to expand...
Click to collapse
Ah sweet, something i shall incorporate in the script later on. thanx
so will this script allow you to take an app from say a cliq dump and allow it to run on any android device?
Will this allow you to grab the MyFaves from a TMO rom and de-odex it and install?
Joe333x said:
so will this script allow you to take an app from say a cliq dump and allow it to run on any android device?
Click to expand...
Click to collapse
Emm...no im 99.99% sure it doesnt help tht way. I know that odex's cause customization problems in roms....there are other factors im sure
mrandroid said:
Will this allow you to grab the MyFaves from a TMO rom and de-odex it and install?
Click to expand...
Click to collapse
MyFaves == No Go ... it requires some other form of trickery ... I'm not sure what exactly ... as I did de-odex it and it would not work properly on test-key ROM's like CM, etc.
... So it requires more than a simple de-odex.
~enom~
does your phone need to be connected? I noticed some ADB commands in the script
Daneshm90 said:
Hey guys, so this script de-odexe's a rom's apks.
Many thanks to ofcourse JesusFreke who created this method and the way to do it. Also to coolbho for his apkopt script from which i learnt certain techniques of batch programming
For those who dont know, this essentially uses jf's method of baksmali'ing the odex file into smali files, and then recreating the classes.dex file and packaging it into the apk hence disregarding the need for the odex.
Oh also make sure to place only apk's that have their corresponding odex's. Dont place only apk's !!!!!
Instructions:[WINDOWS ONLY & Phone Must stay connected with adb WORKING]
1. Download http://www.mediafire.com/?mwownkhzm4m
2. Extract to a folder
3. Place all your rom's apk's which have odex's attached to them into that folder
4. Run deoall
5. Copy all the apk's from the deodexed folder into ur corresponding rom app folder
Thanks
Upcoming:
Seperate Framework & apps folder
De-odex framework apk's and jar's (thanx for the tip enomther )
Click to expand...
Click to collapse
So the apk after that has the DEX built in or is dexopt still needed?
wesgarner said:
So the apk after that has the DEX built in or is dexopt still needed?
Click to expand...
Click to collapse
>.<.......................
kingklick said:
>.<.......................
Click to expand...
Click to collapse
Hey I am just double checking
If you're having problems de-odexing the framework is because there's a particular order to it.
If you look at your bootclasspath you'll see the framework files necessary to boot the android system, the rest (whatever's not in there) can be dexopted in any order.
If you're trying to de-odex the framework, you're going to have to backtrace yourself.
Personally, I do:
for i in /system/app/*.apk
unodex
for j in /system/framework/nonCoreJar1.jar /system/framework/nonCoreJar2.jar /system/framework/...nonCoreJarN.jar
unodex
for k in /system/framework/bootClassPathJarN.jar /system/framework/bootClassPathJarN-1.jar /system/framework/...bootClassPathJarN-y.jar
unodex
it requires a couple of reboots along the way to deal with any created dalvik-cache so that it doesn't interfere with the next needed classes.dex
the only turn-off was that it requires a running system to do it (it's not that big of a problem, but porting and then flashing starts getting old after a while).
Has that changed?
Does OP mean you can take the apks, toss them into a folder, and then do it from the computer without the phone?
---edit---
shoot me for not reading.
Daneshm90 said:
Instructions:[WINDOWS ONLY & Phone Must stay connected with adb WORKING]
Click to expand...
Click to collapse
jubeh said:
If you're having problems de-odexing the framework is because there's a particular order to it.
If you look at your bootclasspath you'll see the framework files necessary to boot the android system, the rest (whatever's not in there) can be dexopted in any order.
If you're trying to de-odex the framework, you're going to have to backtrace yourself.
Personally, I do:
for i in /system/app/*.apk
unodex
for j in /system/framework/nonCoreJar1.jar /system/framework/nonCoreJar2.jar /system/framework/...nonCoreJarN.jar
unodex
for k in /system/framework/bootClassPathJarN.jar /system/framework/bootClassPathJarN-1.jar /system/framework/...bootClassPathJarN-y.jar
unodex
it requires a couple of reboots along the way to deal with any created dalvik-cache so that it doesn't interfere with the next needed classes.dex
the only turn-off was that it requires a running system to do it (it's not that big of a problem, but porting and then flashing starts getting old after a while).
Has that changed?
Does OP mean you can take the apks, toss them into a folder, and then do it from the computer without the phone?
Click to expand...
Click to collapse
Yea I would figure as much ... simply b/c one must follow the BOOTCLASSPATH order when odex'ing ...
So Jubeh .. you're saying you've personally de-odex'd an fully odex'd framework b4?
Just looking for confirmation from someone who has personally ... since I'm too lazy to go through that hectik crappy process
~enom~
enomther said:
Yea I would figure as much ... simply b/c one must follow the BOOTCLASSPATH order when odex'ing ...
So Jubeh .. you're saying you've personally de-odex'd an fully odex'd framework b4?
Just looking for confirmation from someone who has personally ... since I'm too lazy to go through that hectik crappy process
~enom~
Click to expand...
Click to collapse
I did it with the tattoo build, but upon boot I would get all sorts of fc's, but I think that was due more to a bad, hasty port than the deodexing. It was also a long time ago when the tool first came out, dont know if there's been newer revisions, so I'll try it again on that funky tattoo rom.
K guys one problem i found after doing multiple apk's is that i need to give the listening dex command a bit delay so its ready for baksmali. I was doing it right after which it misses for some conversions. I'll upload with delay between the two commands. Hmm framework i gotta give a shot :/ Sounds interesting ...
Solid script! Should make deodexing A LOT easier
Ok so i uploaded with delay between, seems to work fine, tested a LOT of times
thanks for this! can't wait for frameworks to be de-odexed.
jubeh: Thanks for the info. I had no idea and have informed JF previously here: http://jf.andblogs.net/2009/11/08/smalibaksmali-v1-0/ (see comments)

Apk Manager 4.9 - Makes Modifying Ur Apk A Breeze (Windows/Linux)

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 file​message 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.apk​Help? :]
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?

[APP/TOOL] xUltimate

This is generously brought to you by a good friend Xeudoxus over on DroidForums.net Please feel free if you do enjoy his app/tool and what not definitely feel free to throw him a couple bucks for his hard work. He's definitely a huge plus to our community.
DONATE HERE
Alright xUltimate has been updated to v2 What this means is that you do not need your phone connect to your computer to deodex. So you can just manually place the .odex files in (\origi_frame\) and (\origi_app\) and it will deodex. You can also transfer the .odex files from your phone like the last version.
It should not be as buggy as before. Also some of the features still have not been updated yet for newer roms. (I will be working on this in the next couple days to try and bring the "patches" up to speed)
I have added some standalone tools (Tools that do not need to be in the main xUltimate dir)
On most of the xUltimate standalone's I have added some example files in the .zip's so you can see how it operates.
Also Ill be posting the old change log for xUltimate main (When I find it lol , I saved it from google cache after it was lost)
-Matt
--INFO--
xUltimate Main v2.1 has been updated for android 2.2 (It should be able to deodex 2.2/froyo) Tested on Nexus Froyo (Only had a problem with Bluetooth.odex <-- But thats a issue with the framework.jar) Clock colors and clock remove have been updated for froyo. Other features will be updated in time.
xUltimate Color Converter will convert hex color codes to the proper binary color code for editing colors in smali
Usage: xUltimate-CC {RRGGBB}
xUltimate Theme/MM Optimizer will opt_png and zip_align all .png's and .apk's in a MM .zip or update.zip or whatever .zip (It will also remove any .db files)
xUltimate Draw9Patch Compiler will compile correctly made .9.png's so you dont have to use eclipse or motodevtools anymore. Look at the example files in the .zip and you'll see how to process your entire theme at once if you wanted.
Go here to DOWNLOAD
This makes editing your phone super easy. You can deodex your phone, change color for text among a ton of other stuff with the add-ons. Please leave comments as to how it works for you, and any suggestions as I will be relaying this information along to Xeudoxus.
I'm going to keep my eye on this, thanks for the update.
I would... it's an incredibly useful tool and very easy to use. I'm just posting it here because he posts primarily on DroidForums.
so how exactly do I use the 9.png compiler?
This is my favorite thing ever. Time to theme that lockscreen
i tryed to use this but i have xp x32 so i get a error , does some know how to fix this ?
Thanks
I get an error when it tries to deodex the framework.jar:
UNEXPECTED TOP-LEVEL ERROR:
java.lang.OutOfMemoryError: Java heap space
at org.jf.dexlib.ItemFactory.makeItem(ItemFactory.java:43)
at org.jf.dexlib.IndexedSection.readItems(IndexedSection.java:48)
at org.jf.dexlib.Section.readFrom(Section.java:143)
at org.jf.dexlib.DexFile.<init>(DexFile.java:431)
at org.jf.dexlib.Code.Analysis.ClassPath.loadBootClassPath(ClassPath.jav
a:216)
at org.jf.dexlib.Code.Analysis.ClassPath.initClassPath(ClassPath.java:14
5)
at org.jf.dexlib.Code.Analysis.ClassPath.InitializeClassPath(ClassPath.j
ava:131)
at org.jf.baksmali.baksmali.disassembleDexFile(baksmali.java:103)
at org.jf.baksmali.main.main(main.java:278)
Press any key to continue . . .
Click to expand...
Click to collapse
Any thoughts as to how to increase the heap size so it doesn't die?
anyone have an issue after deodexing?
specifics:
everything completed successful but now when mounting phone it sees the internal SD as a write protected CD drive.
I'm using xUltimate 2.3.3 for Samsung Galaxy SL GT-i9003. I'm facing the below error when running with option 3
.
.
.
.
Starting BuddiesNow.odex
*****************************************
* Deodexing... *
* Redexing... *
* Processing... *
* Compressing/Aligning... *
*****************************************
BuddiesNow.apk Finished!
Starting CallSetting.odex
*****************************************
* Deodexing... *
* Redexing... *
out\com\sec\android\app\callsetting\voicecall\CallBarring.smali[0,0] null
* Processing... *
The system cannot find the file specified.
Press any key to continue . . .
Please help me to fix the same. I've found some APK files under the origi_app with no *.odex file with the same name as the *.apk file. I've removed them from the origi_app folder to force the option 3 run to complete. But the process stops even for some APK files has ODEX files. There were 145 APK and 105 ODEX files under origi_app folder. Made as 105 APK and ODEX files, but still the option 3 run didn't succeed.
I believe I am having a problem with Xultimate. I have tried deodexing a single file (services.jar) and even with no modifications the phone will not boot. I made sure to chown and chmod it back to original but it also didn't make a difference.
I then tried to deodex with xultimate and reodex with dexopt-wrapper without making changes and not only can the phone not boot but the resulting services.odex is a different size with different contents from the original.
I believe something is wrong with the version of Xultimate I am using. You can read my thread about it here http://forum.xda-developers.com/showthread.php?p=27289379
edit: here is the explanation of the dexopt-wrapper tool for reodexing files http://themikmik.com/showthread.php...w-About-adb-odex-themes-etc&p=75225#post75225
Error while deodexing
I'm getting this error while deodexing a Samsung Exhibit II...
Starting AccountAndSyncSettings.odex
*****************************************
* Deodexing... *
UNEXPECTED TOP-LEVEL EXCEPTION:
org.jf.dexlib.Util.ExceptionWithContext: regCount does not match the number of arguments of the method
at org.jf.dexlib.Util.ExceptionWithContext.withContext(ExceptionWithContext.java:54)
at org.jf.dexlib.Code.InstructionIterator.IterateInstructions(InstructionIterator.java:92)
at org.jf.dexlib.CodeItem.readItem(CodeItem.java:154)
at org.jf.dexlib.Item.readFrom(Item.java:76)
at org.jf.dexlib.OffsettedSection.readItems(OffsettedSection.java:48)
at org.jf.dexlib.Section.readFrom(Section.java:143)
at org.jf.dexlib.DexFile.<init>(DexFile.java:431)
at org.jf.baksmali.main.main(main.java:265)
Caused by: java.lang.RuntimeException: regCount does not match the number of arguments of the method
at org.jf.dexlib.Code.Format.Instruction3rc.checkItem(Instruction3rc.java:129)
at org.jf.dexlib.Code.Format.Instruction3rc.<init>(Instruction3rc.java:79)
at org.jf.dexlib.Code.Format.Instruction3rc.<init>(Instruction3rc.java:44)
at org.jf.dexlib.Code.Format.Instruction3rc$Factory.makeInstruction(Instruction3rc.java:145)
at org.jf.dexlib.Code.InstructionIterator.IterateInstructions(InstructionIterator.java:84)
... 6 more
Error occured at code address 8
code_item @0x2604
Click to expand...
Click to collapse
What should i do to fix this?
just in case, i'm using version 2.4 of xUltimate
Hey Guys
I got a Question about this Tool to deodex some Stock Roms.
Can i use this Tool for my Galaxy Note with Stock "DBTLRK" ? Its a Free Provider German Stock ROM (ICS)???
And when the Answer was Yes: Can i use the same Instructions like this for the Galaxy S+? Or was Something else?
Thank you for Response
I'm getting this error as well and I've only seen that you need to set the API level to 14. How do change the scripts xUltimate is running? sounds like you just need to add a "-a 14" in the baksmali.jar command but I can't find where.
The Poetic Vampire said:
I'm getting this error while deodexing a Samsung Exhibit II...
What should i do to fix this?
just in case, i'm using version 2.4 of xUltimate
Click to expand...
Click to collapse
It support the ICS Rom files, specifically LG Optimus 3D SU-760 Korean version of P920?
hackenggr said:
It support the ICS Rom files, specifically LG Optimus 3D SU-760 Korean version of P920?
Click to expand...
Click to collapse
You could always give this version a try and see if it works for you. I am not sure if you will get any other responses on this being it seems the developer has fallen off the face of earth. It is just a shame as this was an awesome program and brought me a lot of good results in the past.
http://www.xeudoxus.com/android/xUltimate-v2.4.2.zip
What have I to do when I see this:
ROM: GB_EUR_P735TV1.0.0B01
*****************************************
Choices: (Do not use anything here!! Press "7")
*****************************************
or is the tool just for nexus one? I have ZTE Blade II
Cannot Deodex
Excuse me, I have pulled the System/app and framework and then I try to deodex it but fail from the first. Then Run the test and got adb fail but the other are fine, but not for the deodex of course it must fail. How can I fix it? Thanks and sorry for my bad english
Why are there trojans in this?
thnsss

A way to Optimizing APK & Framework files

For optimizing apks, aside from fixAllAPKs by omniwolf, I found another one.
Note: I have no responsibility for breaking your ROM, so backup first.
Rights: No rights reserved, you can do whatever you like.
The classes.dex files have significant amount of debug infos in it, striping out those can reduce file size and increase some performance. I test it with all /system/app/ and /system/framework/ files, the ROM runs snapier, especially when you launching apps. Stripe out those debug info doesn't hurt anything, they are usefull only for original developer and one who wants to mod it, but you can always keep a copy of the original one for modding and debugging purpose.
Note that this does not boost performance like increase CPU freq, but the theory is, since the file size is reduced, dex and dalvik-cache became smaller in size, occupies memories smaller, thus processing is faster, and saves a little battery life, you can think it as something like optipng does.
Note also, you don't need to specify 0 compression, dex will be decompressed to /data/dalvik-cache, just use fixAllAPKs for fixing files inside APK that should not be compressed, and 0 compression for file type like xml isn't really a good idea.
Don't use this for ICS Framework files yet, there are specific files will causes surprising bugs when recompiled, but I'm lazy to find it out why and what, so just don't do it.
For FixAllAPKs, original thread here, http://forum.xda-developers.com/showthread.php?t=1123463
or post #36 by carl1961 http://forum.xda-developers.com/showpost.php?p=21458549&postcount=36
==========================================================================================================
RemoveDebuggingInfo_v2.2:
API Level must be specified to get 100% compatibility, it seems not forward nor backward compatible.
Froyo = 8, GB = 10, ICS4.0 ~ 4.0.2 = 14, ICS 4.0.3 = 15
Added API Level chooser, default 15 (ICS 4.0.3)
Added more descriptions.
Correct typos.
==========================================================================================================
depricated...
RemoveDebuggingInfo_v2.1:
First, Thanks to all who corrects me.
fix typo for menu selection 6
fix path for pulling for adb to work without setting PATH env variable
fix pushing framework to wrong directory
update smali/baksmali to v1.3.2
update script to compile/decompile using api level 15
added menu selection of fixAllAPKs
Instructions: Important
The default config is for ICS 4.03 base ROM, if you are gonna use it for Gingerbread Base ROM, need to edit the file RemoveDebuggingInfo.bat, and change the -a 15 to -a 10 for API level 10, then just double click start.bat and follow the on screen instruction.
java -jar baksmali-1.3.2.jar -b -a 10 -o .\classes .\classes.dex
java -jar smali-1.3.2.jar -a 10 .\classes -o .\classes.dex
Click to expand...
Click to collapse
Using API level 10 for ICS and API level 15 for GB will not work, you phone will just hang or endless reboots.
Pushing framework will reset all your settings, so if you choose to push framework, do a factory reset instead and just re-install your user apps.
After pushing /system/app, you must reboot to recovery and wipe dalvik and cache, another way of pushing is boot to recovery, mount /system then push.
I have only tested on Gingerbread 2.08.401.1 base, have no idea for ICS, but it should work, as the latest smali/baksmali supports ICS.
If you experience glitches, do it from the beginning by using un-modified apk and jar.
How it works: it is just baksmali (decompile dex to smali code WITHOUT debugging info) and then smali (compile back to dex)
Requirements: java and htc sync usb driver.
==========================================================================================================
Depricated - too much error.
RemoveDebuggingInfo_v2:
Added another script for simpler operations, instead of dragging hundreds of APKs, it is self descriptive, can pull and push /system/app, /system/framework, optimizing all files for app and framework, and reboot to recovery.
Tested on v2.08.401.1 ROM, on all files /system/app, /system/framework, should work on other device and ROM too, but not sure, test it yourself!
==========================================================================================================
For /data/app/ user application files, modify it may not installed at all, re-sign it also not help, so just do it manually to test.
But for now, here is a way to do it manually, since /system partition will not grow and many spaces left, you can simply put some APP on this partition, and following are working on my ROM, some should have naming as com.a.b.c... whatever is the name installed on /data/app/ stripe out the -1 at the end. Just besure the APP is uninstalled before pushing to /system/app/
Below are what I tested.
AdobePhotoshopExpress.apk
BarcodeScanner.apk
com.evernote.skitch.apk
ESFileExplorer.apk
GoogleDocs.apk
GoogleGoggles.apk
GoogleTranslate.apk
GPSTest.apk
org.hermit.audalyzer.apk
For APKs that has lib folder, you can just extract it and put it on /system/lib/ then del the lib folder inside the apk archive, e.g. flashplayer, adobereader.
adb should be start only once after booting your PC, if you get issues, like adb always shows restarting and out of date, it is because the included adb.exe in htc sync is out of date, and you had installed android sdk with environmental variable set, to fix it, both must have same version, or simply delete one of them, and if you have path variable set, you can del the included adb.exe as well.
Thanks for this, I will be sure to use it
Sent from my HTC Sensation XE with Beats Audio Z715e using xda premium
I have 189 Apps in system/app .... is there a way to make it with all files!?
Jonny said:
Thanks for this, I will be sure to use it
Just out of interest, what program do you use for getting the smali code?
Click to expand...
Click to collapse
It is the one and only, baksmali.jar and smali.jar http://code.google.com/p/smali/
xtcislove said:
I have 189 Apps in system/app .... is there a way to make it with all files!?
Click to expand...
Click to collapse
Yes I know it is so much, but need to write a sohphisticated code, maybe if I have time, I'll try to make it more easier, a vbscript or cmd script, or a shell script in linux. And don't forget the framework files too.
mudhi said:
I test it with all /system/app/ and /system/framework/ files, the ROM runs snapier, especially when you launching apps.
Click to expand...
Click to collapse
It is really so. I have checked it up.
mudhi said:
It is the one and only, baksmali.jar and smali.jar http://code.google.com/p/smali/
Click to expand...
Click to collapse
Thank you mudhi
a little off topic here, Is there a way to change smali files into a readable code (let's say i want to use it with eclipse !!)
i have tried searching and i came across Dex2Jar and jd-gui !!
my question here is: is there a way to use smali files into Eclipse ??
Alfaifi said:
Thank you mudhi
a little off topic here, Is there a way to change smali files into a readable code (let's say i want to use it with eclipse !!)
i have tried searching and i came across Dex2Jar and jd-gui !!
my question here is: is there a way to use smali files into Eclipse ??
Click to expand...
Click to collapse
Yes, use dex2jar to jar archive file, then jd-gui to view the source, you can also use DJ-decompiler (commercial) to view and change code, but that's not really readable, and compile back is too hard, and also jbe, ce etc... but I came to a conclusion.
Use dex2jar to decompile dex and use jd-gui to view the source for understand logic, method etc... and just reference it to smali code, and if you get use to it, hacking app will be easier, perhaps more easier than viewing the source code, because hackiing involviing mostly on 0 to 1, true to false, jump to where ... and that is only adding or changing a single code in smali, e.g. logic if a == b then c, if you want to make it always c, then just if 0 == 0 then c, or just a simple jump etc...
@mudhi new smali/baksmali 1.3.2 is out
And is also possible to remove debugging info from jar files that are present in framework folder?
texture said:
And is also possible to remove debugging info from jar files that are present in framework folder?
Click to expand...
Click to collapse
I think you can just rename them to .apk and then back to .jar.
mike1986. said:
I think you can just rename them to .apk and then back to .jar.
Click to expand...
Click to collapse
No you dont need to, just put(or pull) all framework files (both apks and jars) and it will process them all automatically.
Btw i just ran this on InsertCoin 4.1.1 for all APPS and Framework except i changed a script a bit (added -mx0) so it compresses APKS with 0 compression.
And can tell you that phone definitively feels faster, boots faster, apps open faster, and there a bit more free RAM available now.
Thank you mudhi allot for this!
mike1986. said:
@mudhi new smali/baksmali 1.3.2 is out
Click to expand...
Click to collapse
ah... hehe thank you, supposed ICS 4.0.3 is supported. Thank you!
Need a little clarification ..
java -version
if errorlevel 1 goto javaerr
---------------------
C:\>java -version
'java' is not recognized as an internal or external command,
operable program or batch file.
---------------------
I installed java however still get an error ..
What is needed > to install ? Link Maybe ?
Also ... I found a small ops in the bat file ..
:javaerr
cls
echo Java is not found, please install java and rerun the script.
echo Hit anykey to quit
PAUSE
goto end < forgot this ?
Thanks ..
WarlockW said:
Need a little clarification ..
java -version
if errorlevel 1 goto javaerr
---------------------
C:\>java -version
'java' is not recognized as an internal or external command,
operable program or batch file.
---------------------
I installed java however still get an error ..
What is needed > to install ? Link Maybe ?
Also ... I found a small ops in the bat file ..
:javaerr
cls
echo Java is not found, please install java and rerun the script.
echo Hit anykey to quit
PAUSE
goto end < forgot this ?
Thanks ..
Click to expand...
Click to collapse
You need to set java variable, here's how-to:
http://java.com/en/download/help/path.xml
mudhi, You've got few errors in start.bat file. If you want to pull the apps to "app" folder, use this command "adb pull /system/app/ app". If you do cd app, It won't find the adb in the app folder and won't do nothing.
ivicask said:
No you dont need to, just put(or pull) all framework files (both apks and jars) and it will process them all automatically.
Btw i just ran this on InsertCoin 4.1.1 for all APPS and Framework except i changed a script a bit (added -mx0) so it compresses APKS with 0 compression.
And can tell you that phone definitively feels faster, boots faster, apps open faster, and there a bit more free RAM available now.
Thank you mudhi allot for this!
Click to expand...
Click to collapse
Before optimizing with this script, my apks are all fixed with the vbscript by omniwolf, it only compress files that should be compressed, the script fixAllAPKs.vbs can be used before or after this. Anyway, I'll add a decision to run the script.
mudhi said:
Before optimizing with this script, my apks are all fixed with the vbscript by omniwolf, it only compress files that should be compressed, the script fixAllAPKs.vbs can be used before or after this. Anyway, I'll add a decision to run the script.
Click to expand...
Click to collapse
Is there any problem with doing 0 compression on all files? I dont have space problems, and doesnt that make phone run faster as it doesnt need to decompress any data? Saves both CPU and RAM?
drms12 said:
mudhi, You've got few errors in start.bat file. If you want to pull the apps to "app" folder, use this command "adb pull /system/app/ app". If you do cd app, It won't find the adb in the app folder and won't do nothing.
Click to expand...
Click to collapse
Oh yes, I know where's the error, because I have android sdk installed and environmental PATH variable are set, you can fix it by just set the PATH variable with where the adb.exe exist.
Or just change the script with this
ullapp
cd app
../adb pull /system/app/
or
ullapp
adb pull /system/app/ app
same as pullframe
mudhi said:
Oh yes, I know where's the error, because I have android sdk installed and environmental PATH variable are set, you can fix it by just set the PATH variable with where the adb.exe exist.
Or just change the script with this
ullapp
cd app
../adb pull /system/app/
or
ullapp
adb pull /system/app/ app
same as pullframe
Click to expand...
Click to collapse
Yes
I think you forgot to update the download, It still ver2.
There is an error in script - the push command to upload files to framework uploads them to /system/app
ICS 4.0.3 - got bootloop just after lockscreen shows. Had to restore system.

[Q] question about (de)compile...

I'm getting this issue:
I got Settings.apk and framework.apk from a rom, then i opened apktool and
1) imported fw: apktool if framework.apk
2) decompiled apk: apktool d Settings.apk
3)edited a string in a xml
4) rebuilt all: apktool b Settings Settings.apk
5)pushed it into system/app
6) fix permissions and reboot.
Settings now should work, but it doesnt. Can somebody tell me where i do a mistake?
Thank you
(I used win8, but i could use macos or ubuntu as well)
sign it first
ej8989 said:
sign it first
Click to expand...
Click to collapse
I did it. same result. maybe the application I used is not good (Auto-Sign v0.65). what application i've to use?
I didnt write it before, however the rom is on 4.2.1 (cyanogen 10.1)
put your re-complied apk to your phone's sd card and use zipsigner2 from playstore to sign it.
ej8989 said:
put your re-complied apk to your phone's sd card and use zipsigner2 from playstore to sign it.
Click to expand...
Click to collapse
Nothing. Maybe this is not good for 4.2.1? (I've used it lots of times with 4.1)
Well, apktool is using smali/baksmali to compile/decompile classes.dex/apk_name.odex file.
The problem can occur when you use different baksmali version when you decompile and also not the right version to compile (as the system expects it to be). You can also experience issues if the apk is not zipaligned properly (check down who to do that)
apktool has the smali/baksmali code inside it so you will need to get the newest version for it for JB for example.
You can check why the status bar is not there when you monitor the logcat and look for DEX related logs in the beginning.
You can also use smali/baksmali on your own: http://code.google.com/p/smali/wiki/DeodexInstructions
and just place the generated classes.dex in the apk
then zipalign -f 4 filein.apk fileout.apk (http://developer.android.com/tools/help/zipalign.html)
then push back fileout.apk (sytemui.apk in your case)
Sent from my Galaxy Nexus using xda premium

Categories

Resources