Deodexing/zipaligning Apk Files
#1
Posted 10 August 2012 - 03:16 PM
Thank you all in advance!
Visit DRDevs.com hosting site for all official Droidrzr.com ROMs, Apps, GApps and other mods/files!!
Please PM me if you need help!
I will be hosting AOSP-Based ROM GApps packages!
Download the most Up-to-Date GApps Packages for AOSP ROMs from me here!
#2
Posted 10 August 2012 - 04:33 PM
First download the latest smali /baksmali from
Rename both baksmali-1.3.3.jar to baksmali.jar and smali-1.3.3.jar to smali.jar (I gathered you had done that already, but if not it just makes command line easier.)
Make a folder to put your framework (and odex) files in.
Make a folder for your apps (both apk and odex files).
You will want to start with your framework, first. Put the baksmal.jar and smali.jar in the folder with framework files.
Before you start you need to determine the API level of the rom you ate working with. If you pulled the rom from your phone then under settings -> about phone -> android version (mine is 4.0.4). Compare that to the list at
To get your API level (API for 4.0.4 is 15)
This will look like -a 15 at cmd prompt. Be sure to put your API level in place of the 15
Open up a cmd prompt and enter in
Java -jar baksmali.jar -a 15 -x core.odex
This will make a folder called out.
Now type in the md prompt
Java -jar smali.jar out -o classes.dex
(At least I think that is how it goes)
This will put the contents of out to classes.dex
Open core.jar with something like 7zip then move classes.dex into the open 7zip window. Once classes.dex is inside core.jar then close any open 7zip windows. Delete the out folder, and classes.dex and move on to the next file.
#3
Posted 10 August 2012 - 04:34 PM
Missing BOOTCLASSPATH files
The most common issue, which is almost guaranteed to happen if you're deodexing an entire build, is an error which is something like "org.jf.dexlib.Code.Analysis.ValidationException: class Lcom/google/android/gtalkservice/IChatListener; cannot be resolved."
This is caused when the odex file has an additional dependency, beyond the jars in the normal BOOTCLASSPATH. To resolve the issue, you need to find which jar contains the class mentioned in the error message, and then add that to the BOOTCLASSPATH with the -c option. You can usually guess which jar it is in from the class name, but if not, you can disassemble the framework jars and find which one has that class.
OK so the most important part of an error is this line
org.jf.dexlib.Code.Analysis.ValidationException: class Lcom/google/android/gtalkservice/IChatListener; cannot be resolved
And in that line look for this
class Lcom/google/android/gtalkservice/IChatListener;
This tells us we need to add com.google.android.gtalkservice in the command line. Use the -c : and will look like
java -jar baksmali.jar -a 15 -c :com.google.android.gtalkservice -x yourfile.odex
You can add multiple entries by using the : to separate each dependency you need. It looks like this
java -jar baksmali.jar -a 15 -c :core.jar:framework.jar:ext.jar -x yourfile.odex
#4
Posted 10 August 2012 - 04:34 PM
if there is a more sufficient way please chime in. Also this process was done on windows. I'm not sure of the procedure for Linux.
#5
Posted 10 August 2012 - 05:15 PM
Visit DRDevs.com hosting site for all official Droidrzr.com ROMs, Apps, GApps and other mods/files!!
Please PM me if you need help!
I will be hosting AOSP-Based ROM GApps packages!
Download the most Up-to-Date GApps Packages for AOSP ROMs from me here!
#6
Posted 10 August 2012 - 05:20 PM
Tomorrow, when I'm sober (LoL), I will reread this again and try to give it a go. Thank you again.
There's nothing more challenging than messing with the Droid with a buzz on
#7
Posted 10 August 2012 - 05:58 PM
Ill throw this tip out there. Try to use one of the available tools to do a batch deodex. What you have left you will have to do manually the old fashioned way. Do some research on grep and what it is. It can be a very useful tool when you come to missing class failures!
On a side note: i think you're pushing this addiction thing to a new limit! Lol.. just started theming and now attempting a deodex! Haha I likes!
Sent from my DROID RAZR using Tapatalk 2
#8
Posted 10 August 2012 - 05:59 PM
Sent from my DROID RAZR using Tapatalk 2
#9
Posted 11 August 2012 - 05:27 AM
Visit DRDevs.com hosting site for all official Droidrzr.com ROMs, Apps, GApps and other mods/files!!
Please PM me if you need help!
I will be hosting AOSP-Based ROM GApps packages!
Download the most Up-to-Date GApps Packages for AOSP ROMs from me here!
#10
Posted 11 August 2012 - 05:29 AM
Challenging?.... is there any other way!? Lol. Ill throw this tip out there. Try to use one of the available tools to do a batch deodex. What you have left you will have to do manually the old fashioned way. Do some research on grep and what it is. It can be a very useful tool when you come to missing class failures! On a side note: i think you're pushing this addiction thing to a new limit! Lol.. just started theming and now attempting a deodex! Haha I likes! Sent from my DROID RAZR using Tapatalk 2
i'm working my way up to building my own ROM. But I want to get some basics out of the way. I also don't want to rely on someone releasing a deodexed source, (even though we have one), but I want to know how to do it. Not only am I an Android addict, I'm also a command line addict.
Visit DRDevs.com hosting site for all official Droidrzr.com ROMs, Apps, GApps and other mods/files!!
Please PM me if you need help!
I will be hosting AOSP-Based ROM GApps packages!
Download the most Up-to-Date GApps Packages for AOSP ROMs from me here!
#11
Posted 11 August 2012 - 06:06 AM
This was taken from smali / baksmali site. Missing BOOTCLASSPATH files The most common issue, which is almost guaranteed to happen if you're deodexing an entire build, is an error which is something like "org.jf.dexlib.Code.Analysis.ValidationException: class Lcom/google/android/gtalkservice/IChatListener; cannot be resolved." This is caused when the odex file has an additional dependency, beyond the jars in the normal BOOTCLASSPATH. To resolve the issue, you need to find which jar contains the class mentioned in the error message, and then add that to the BOOTCLASSPATH with the -c option. You can usually guess which jar it is in from the class name, but if not, you can disassemble the framework jars and find which one has that class. OK so the most important part of an error is this line org.jf.dexlib.Code.Analysis.ValidationException: class Lcom/google/android/gtalkservice/IChatListener; cannot be resolved And in that line look for this class Lcom/google/android/gtalkservice/IChatListener; This tells us we need to add com.google.android.gtalkservice in the command line. Use the -c : and will look like java -jar baksmali.jar -a 15 -c :com.google.android.gtalkservice -x yourfile.odex You can add multiple entries by using the : to separate each dependency you need. It looks like this java -jar baksmali.jar -a 15 -c :core.jar:framework.jar:ext.jar -x yourfile.odex
I ran into one of these bootclass issues right away and did what you said but I still got an error? It said it could not locate com.motorola.android.widget? But that file is definitely there. Anyone know?
That was my input
[code=auto:0]
Visit DRDevs.com hosting site for all official Droidrzr.com ROMs, Apps, GApps and other mods/files!!
Please PM me if you need help!
I will be hosting AOSP-Based ROM GApps packages!
Download the most Up-to-Date GApps Packages for AOSP ROMs from me here!
#12
Posted 11 August 2012 - 06:17 AM
There will be times when a class is simply not there. Whether its a typo or abandoned code it happens. When that happens you'll need to baksmali with -I (uppercase i) to ignore the missing class
Sent from my DROID RAZR using Tapatalk 2
#13
Posted 11 August 2012 - 06:26 AM
Thats where grep comes into play. Grep the framework folder for the class youre missing then add the file that has that class to the bootclasspath
There will be times when a class is simply not there. Whether its a typo or abandoned code it happens. When that happens you'll need to baksmali with -I (uppercase i) to ignore the missing class
Sent from my DROID RAZR using Tapatalk 2
I'm sorry, could you elaborate a little bit more on what grep is? and where in the baksmali command would I use the -I ? could you just write an example command with the -I in it so I would know where it goes? Thanks again
edit: also, there IS a com.motorola.widget but for some reason it says it cannot locate it? it is in the folder and within my cmd line path. I don't want to use ignore if it might cause force closes later? I just want to make sure I know when I should actually ignore something
Edited by tucstwo, 11 August 2012 - 06:32 AM.
Visit DRDevs.com hosting site for all official Droidrzr.com ROMs, Apps, GApps and other mods/files!!
Please PM me if you need help!
I will be hosting AOSP-Based ROM GApps packages!
Download the most Up-to-Date GApps Packages for AOSP ROMs from me here!
#14
Posted 11 August 2012 - 06:32 AM
Grep -r "missing class name" pathtoframeworkfiles
If youre on windows youll need to do a google search to find a comparable tool.
As far as the. -i it can go anywhere..
Java -jar baksmali.jar -x -I...... so on so forth.
Sent from my DROID RAZR using Tapatalk 2
#15
Posted 11 August 2012 - 06:40 AM
I did find wingrep too, thank you
Visit DRDevs.com hosting site for all official Droidrzr.com ROMs, Apps, GApps and other mods/files!!
Please PM me if you need help!
I will be hosting AOSP-Based ROM GApps packages!
Download the most Up-to-Date GApps Packages for AOSP ROMs from me here!
#16
Posted 11 August 2012 - 06:48 AM
I am on windows, not linux. I tried -I, it was rejected. -a -b -c -d -f -l -m -o -p -r are my only options.
I did find wingrep too, thank you
Maybe its -l... its been a while lol..
Wingrep should do it. :-) i havent used windows for about 2 years so... your guess is as good as mine.
Sent from my DROID RAZR using Tapatalk 2
#17
Posted 11 August 2012 - 07:05 AM
Visit DRDevs.com hosting site for all official Droidrzr.com ROMs, Apps, GApps and other mods/files!!
Please PM me if you need help!
I will be hosting AOSP-Based ROM GApps packages!
Download the most Up-to-Date GApps Packages for AOSP ROMs from me here!
#18
Posted 11 August 2012 - 07:09 AM
I'm buzzed most times I'm working on that stiff! You're gonna make me pull out my computer! Lol
Sent from my DROID RAZR using Tapatalk 2
#19
Posted 11 August 2012 - 08:51 AM
Specifically: android.policy.odex apache-xml.odex com.motorola.blur.library.serviceutils.odex. The first two point to a class in the "com.motorola.android.widget", but I get a cannot interface error with that. The last one (thus far) is looking for a "javax" file, which doesn't even exist as far as I can see.
Visit DRDevs.com hosting site for all official Droidrzr.com ROMs, Apps, GApps and other mods/files!!
Please PM me if you need help!
I will be hosting AOSP-Based ROM GApps packages!
Download the most Up-to-Date GApps Packages for AOSP ROMs from me here!
#20
Posted 11 August 2012 - 10:33 AM
Apps are done the same way, but I have found it easier to put a copy of the framework files into the apps folder instead of trying to get baksmali to look in a different directory. Maybe someone else can fill that part in. if there is a more sufficient way please chime in. Also this process was done on windows. I'm not sure of the procedure for Linux.
Thanks for this info. The reason I was getting errors was because of the -a 15 I wasn't putting in.
- sublime likes this
Visit DRDevs.com hosting site for all official Droidrzr.com ROMs, Apps, GApps and other mods/files!!
Please PM me if you need help!
I will be hosting AOSP-Based ROM GApps packages!
Download the most Up-to-Date GApps Packages for AOSP ROMs from me here!
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users