decompile android.policy.jar / android.policy.odex - Defy Q&A, Help & Troubleshooting

hey,
i have troubles decompiling android.policy.odex: how can i resolve the following exception?
Code:
Error occured while loading boot class path files. Aborting.
org.jf.dexlib.Code.Analysis.ClassPath$ClassNotFoundException: Could not find interface Lcom/motorola/android/widget/SlideButton$OnSlideEndListener;
at org.jf.dexlib.Code.Analysis.ClassPath$ClassDef.loadAllImplementedInterfaces(ClassPath.java:865)
at org.jf.dexlib.Code.Analysis.ClassPath$ClassDef.<init>(ClassPath.java:690)
at org.jf.dexlib.Code.Analysis.ClassPath.loadClassDef(ClassPath.java:280)
at org.jf.dexlib.Code.Analysis.ClassPath.initClassPath(ClassPath.java:163)
at org.jf.dexlib.Code.Analysis.ClassPath.InitializeClassPath(ClassPath.java:131)
at org.jf.baksmali.baksmali.disassembleDexFile(baksmali.java:111)
at org.jf.baksmali.main.main(main.java:293)
Error while loading class Lcom/android/internal/policy/impl/LockScreen; from file framework/android.policy.odex
Error while loading ClassPath class Lcom/android/internal/policy/impl/LockScreen;
I call baksmali with:
Code:
java -jar baksmali.jar -x framework/android.policy.odex -o androidpolicy -a 10 -d framework -c core.jar:ext.jar:framework.jar:android.policy.jar:services.jar:core-junit.jar
Thanks

too stupid, the file was com.motorola.android.widget.jar ;-)

Questions go in the Q&A section, not the Dev section.

Related

Vogue Android in depth Rom Building guide requested

Hi all , i am a new android user and would like to have a go a biulding some custom roms, Now i have no experiene with linux.. well the last 3days.. lol, and i have read the how to make a hero rom txt from the vogue - hero site and while that maybe suffucient for others to get up and away with rom building its not for me, So i am wondering if there is a more in depth step by step guide for not only a new android user but a new linux user also, would be very much appreciated
ok so there hasnt been much of a respone so ill share the steps i have so far
1. I installed Ubuntu linux ( Dual Boot with win 7 )
2. Needed to know how to install Squashfs did a search on google found this
A) open terminal window ( Ubuntu start menu, accessories )
B) type: sudo aptitude search squashfs , u will be prompted for password
this is what happened with mine:
[email protected]:~$ sudo aptitude search squashfs
[sudo] password for ali3nfr3ak:
i squashfs-tools - Tool to create and append to squashfs filesystems
C) type this command:sudo apt-get install squashfs-tools
My Dialog ( ihad to uninstall and then reinstall to get this so mine will be alittle different to
yours
[email protected]:~$ sudo apt-get install squashfs-tools
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
squashfs-tools
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 0B/122kB of archives.
After this operation, 319kB of additional disk space will be used.
Selecting previously deselected package squashfs-tools.
(Reading database ... 115049 files and directories currently installed.)
Unpacking squashfs-tools (from .../squashfs-tools_1%3a4.0-1_i386.deb) ...
Processing triggers for man-db ...
Setting up squashfs-tools (1:4.0-1) ...
[email protected]:~$
C) all done close terminal i type: exit
3: Next for testing purposes download this Google-Android-Ion-v1.5-2009-10-23-sdcard-not-google-apps and etract this and placed a copy of system.sqsh into it s own directory
4: i then opened another terminal window ( easier to copy and paste show you what my window looks like
[email protected]:~$ dir
Desktop Documents Downloads examples.desktop HERO Music Pictures Public Templates Videos
[email protected]:~$ cd HERO
[email protected]:~/HERO$ dir
Testing
[email protected]:~/HERO$ cd Testing
[email protected]:~/HERO/Testing$ dir
system.sqsh
[email protected]:~/HERO/Testing$ unsquashfs system.sqsh
Parallel unsquashfs: Using 2 processors
650 inodes (1408 blocks) to write
[=====================================================================================================================================================-] 1408/1408 100%
created 650 files
created 45 directories
created 0 symlinks
created 0 devices
created 0 fifos
[email protected]:~/HERO/Testing$ dir
squashfs-root system.sqsh
[email protected]:~/HERO/Testing$
basicially u can use the same commands as windows but with out the / and the spelling and Capitial letters have to be exact
Windows
/dir
/cd hero
Linux
dir
cd HERO
A new folder is created called squashfs-root which has all the files/ folders from the system.sqsh u just decompressed ( my description )
and that is a far as i have got so far
ali3nfr3ak said:
Hi all , i am a new android user and would like to have a go a biulding some custom roms, Now i have no experiene with linux.. well the last 3days.. lol, and i have read the how to make a hero rom txt from the vogue - hero site and while that maybe suffucient for others to get up and away with rom building its not for me, So i am wondering if there is a more in depth step by step guide for not only a new android user but a new linux user also, would be very much appreciated
Click to expand...
Click to collapse
If you still have that txt, would you mind hosting or pasting it here? I've been asking around for a copy and everyone seems to have lost it.
clockworx said:
If you still have that txt, would you mind hosting or pasting it here? I've been asking around for a copy and everyone seems to have lost it.
Click to expand...
Click to collapse
same here. trying to make my first rom also
How-To-Make-A-Hero-ROM.TXT attached
MUCH appreciated!
updated 1st post with my very linux noob steps lol
having alittle trouble anyone can someone shed some light please
[email protected]:/home/ali3nfr3ak/Downloads/HERO2# genext2fs -d ./system -b 180000 -a system.ext2
genext2fs: invalid option -- 'a'
genext2fs: Note: options have changed, see --help or the man page.
[email protected]:/home/ali3nfr3ak/Downloads/HERO2# genext2fs -help
Usage: genext2fs [options] image
Create an ext2 filesystem image from directories/files
-x, --starting-image <image>
-d, --root <directory>
-D, --devtable <file>
-b, --size-in-blocks <blocks>
-i, --bytes-per-inode <bytes per inode>
-N, --number-of-inodes <number of inodes>
-m, --reserved-percentage <percentage of blocks to reserve>
-g, --block-map <path> Generate a block map file for this path.
-e, --fill-value <value> Fill unallocated blocks with value.
-z, --allow-holes Allow files with holes.
-f, --faketime Set filesystem timestamps to 0 (for testing).
-q, --squash Same as "-U -P".
-U, --squash-uids Squash owners making all files be owned by root.
-P, --squash-perms Squash permissions on all files.
-h, --help
-V, --version
-v, --verbose
and
[email protected]:/home/ali3nfr3ak/Downloads/HERO2# mkdir rootfs-mount
[email protected]:/home/ali3nfr3ak/Downloads/HERO2# mount -o loop rootfs.img
mount: can't find rootfs.img in /etc/fstab or /etc/mtab
ali3nfr3ak said:
having alittle trouble anyone can someone shed some light please
[email protected]:/home/ali3nfr3ak/Downloads/HERO2# genext2fs -d ./system -b 180000 -a system.ext2
genext2fs: invalid option -- 'a'
genext2fs: Note: options have changed, see --help or the man page.
[email protected]:/home/ali3nfr3ak/Downloads/HERO2# genext2fs -help
Usage: genext2fs [options] image
Create an ext2 filesystem image from directories/files
-x, --starting-image <image>
-d, --root <directory>
-D, --devtable <file>
-b, --size-in-blocks <blocks>
-i, --bytes-per-inode <bytes per inode>
-N, --number-of-inodes <number of inodes>
-m, --reserved-percentage <percentage of blocks to reserve>
-g, --block-map <path> Generate a block map file for this path.
-e, --fill-value <value> Fill unallocated blocks with value.
-z, --allow-holes Allow files with holes.
-f, --faketime Set filesystem timestamps to 0 (for testing).
-q, --squash Same as "-U -P".
-U, --squash-uids Squash owners making all files be owned by root.
-P, --squash-perms Squash permissions on all files.
-h, --help
-V, --version
-v, --verbose
and
[email protected]:/home/ali3nfr3ak/Downloads/HERO2# mkdir rootfs-mount
[email protected]:/home/ali3nfr3ak/Downloads/HERO2# mount -o loop rootfs.img
mount: can't find rootfs.img in /etc/fstab or /etc/mtab
Click to expand...
Click to collapse
first no -a it doesn't work
[CODEgenext2fs -d ./system -b 180000 system.ext2[/CODE]
then mount it for me i made the directory /mnt/system
Code:
sudo mkdir /mnt/system
sudo mount -o loop /whereever/system.ext2 /mnt/system
then make sure you do not have squashfs-tools 4.0 it wont work
make the sqsh file
Code:
sudo mksquashfs /mnt/system system.sqsh
say rootfs.img was on your desktop
Code:
sudo mkdir /mnt/rootfs
sudo mount -o loop /home/king0fkings/desktop/rootfs.img /mnt/rootfs
jamezelle said:
first no -a it doesn't work
[CODEgenext2fs -d ./system -b 180000 system.ext2[/CODE]
then mount it for me i made the directory /mnt/system
Code:
sudo mkdir /mnt/system
sudo mount -o loop /whereever/system.ext2 /mnt/system
then make sure you do not have squashfs-tools 4.0 it wont work
make the sqsh file
Code:
sudo mksquashfs /mnt/system system.sqsh
say rootfs.img was on your desktop
Code:
sudo mkdir /mnt/rootfs
sudo mount -o loop /home/king0fkings/desktop/rootfs.img /mnt/rootfs
Click to expand...
Click to collapse
Ok thank you very kindly.. just got in from milking the cows, so ill give this a blast
Code:
genext2fs -d ./system -b 180000 -a system.ext2
the -a does work when you use the right genext2fs from the sdk or from pulling the android source and building it. the genext2fs i had uploaded uses the -a but you need to have it in your path before the generic genext2fs gets used or directly execute it. i keep it in /root/bin and execute it from there.
Code:
~/bin/genext2fs -d ./system -b 180000 -a system.ext2
the -a is for making android specific images and sets correct permissions
http://dl.dropbox.com/u/2888561/porting/genext2fs
make sure you set it to executable
Code:
chmod 755 genext2fs
zenulator said:
Code:
genext2fs -d ./system -b 180000 -a system.ext2
the -a does work when you use the right genext2fs from the sdk or from pulling the android source and building it. the genext2fs i had uploaded uses the -a but you need to have it in your path before the generic genext2fs gets used or directly execute it. i keep it in /root/bin and execute it from there.
Code:
~/bin/genext2fs -d ./system -b 180000 -a system.ext2
the -a is for making android specific images and sets correct permissions
http://dl.dropbox.com/u/2888561/porting/genext2fs
make sure you set it to executable
Code:
chmod 755 genext2fs
Click to expand...
Click to collapse
hey there thanks for the info , i cannot get this command to work :
Code:
~/bin/genext2fs -d ./system -b 180000 -a system.ext2
i worked out how to get root on linux, copied genext2fs into /root/bin did this command
Code:
chmod 755 genext2fs
i dunno what to try now
[email protected]:~/Downloads/HERO2# ~/bin/genext2fs -d ./system -b 180000 -a system.ext2
bash: /root/bin/genext2fs: No such file or directory
[email protected]:~/Downloads/HERO2# chmod 755 genext2fs
[email protected]:~/Downloads/HERO2# ~/bin/genext2fs -d ./system -b 180000 -a system.ext2
bash: /root/bin/genext2fs: No such file or directory
im lost
ali3nfr3ak said:
hey there thanks for the info , i cannot get this command to work :
Code:
~/bin/genext2fs -d ./system -b 180000 -a system.ext2
i worked out how to get root on linux, copied genext2fs into /root/bin did this command
Code:
chmod 755 genext2fs
i dunno what to try now
[email protected]:~/Downloads/HERO2# ~/bin/genext2fs -d ./system -b 180000 -a system.ext2
bash: /root/bin/genext2fs: No such file or directory
[email protected]:~/Downloads/HERO2# chmod 755 genext2fs
[email protected]:~/Downloads/HERO2# ~/bin/genext2fs -d ./system -b 180000 -a system.ext2
bash: /root/bin/genext2fs: No such file or directory
im lost
Click to expand...
Click to collapse
1 go to package manager and remove genext2fs
2 login as root and copy zens genext2fs to /bin/
3 open terminal and type in
Code:
chmod 755 /bin/genext2fs
4 logout, then login as normal
5 it should work like so
Code:
genext2fs -d ./system -b 180000 -a system.ext2
I JUST DID IT SO I KNOW IT WORKS!!1
jamezelle said:
1 go to package manager and remove genext2fs
2 login as root and copy zens genext2fs to /bin/
3 open terminal and type in
Code:
chmod 755 /bin/genext2fs
4 logout, then login as normal
5 it should work like so
Code:
genext2fs -d ./system -b 180000 -a system.ext2
I JUST DID IT SO I KNOW IT WORKS!!1
Click to expand...
Click to collapse
ok thank you ill try that, thanks for all the help to by the way, its been a trying process learning how to use linux and build android roms, so thank u
ok got everything working and managed to create a system.sqsh to load, using msmisson ext2 method i tried to load it but has error:
mount: mounting /dev/block/loop1 on/sdcard/temp failed Invalid argument
failed
failed to mount /system
/bin/still (maybe ??? cant read properly) can't access tty: job control turned off
im basicially dumping Ion bundle and remaking it with no changes
big problem!!!!!!!
Selecting previously deselected package squashfs-tools.
(Reading database ... 115049 files and directories currently installed.)
Unpacking squashfs-tools (from .../squashfs-tools_1%3a4.0-1_i386.deb) ...
Processing triggers for man-db ...
Setting up squashfs-tools (1:4.0-1) ...
[email protected]:~$
4.0 will not work!!!!!!!!
1 do
Code:
sudo apt-get remove squashfs-tools
2 download this HERE
zenulator said:
Code:
genext2fs -d ./system -b 180000 -a system.ext2
the -a does work when you use the right genext2fs from the sdk or from pulling the android source and building it. the genext2fs i had uploaded uses the -a but you need to have it in your path before the generic genext2fs gets used or directly execute it. i keep it in /root/bin and execute it from there.
Code:
~/bin/genext2fs -d ./system -b 180000 -a system.ext2
the -a is for making android specific images and sets correct permissions
http://dl.dropbox.com/u/2888561/porting/genext2fs
make sure you set it to executable
Code:
chmod 755 genext2fs
Click to expand...
Click to collapse
damn zen i bet that has been half my battle with the power wake ups. i just ported a rom last night and got the power wakeups.
recreated it today with your genext2fs with -a and it booted right up thanks
I wanted to try testing some stuff using the emulator (not hardware related, obviously). Does anyone know if there a standalone tool for making yaffs2 filesystems (for system.img), or is my only option to install android source and compile it all?
jamezelle said:
big problem!!!!!!!
Selecting previously deselected package squashfs-tools.
(Reading database ... 115049 files and directories currently installed.)
Unpacking squashfs-tools (from .../squashfs-tools_1%3a4.0-1_i386.deb) ...
Processing triggers for man-db ...
Setting up squashfs-tools (1:4.0-1) ...
[email protected]:~$
4.0 will not work!!!!!!!!
1 do
Code:
sudo apt-get remove squashfs-tools
2 download this HERE
Click to expand...
Click to collapse
ok i see that , i saw that i had 4 but i guess when you said squashfs 4 wouldnt i guess i literally took it as it wouldnt work lol, not that the command would still work but the .sqsh not load , sorry bout that, but also once again thank you
woohoo got a booting image ,lol keeps telling me process android.process.acore has stopped unexpectedly, lots of times probably all those google packages i removed ...oh well i have a start now thanks jamezelle without your help wouldnt have happened
Thought you might want to take a look at this little script I made: ROM porting

[Help] Can not deodex LGWeather/ LGWeatherTheme D802

please guide me
for 2 apk I can not deodex it show error
All ODEX files:
(1) ./system/app/LGWeather.odex
(2) ./system/app/LGWeatherTheme.odex
Enter file number (0 = cancel): 1
Disassembling ./system/app/LGWeather.odex ...
java -Xmx512m -jar baksmali.jar -a 17 -d system/framework -x ./system/app/LGWeather.odex
UNEXPECTED TOP-LEVEL EXCEPTION:
org.jf.dexlib.Util.ExceptionWithContext: The section size in the header and map for item type TYPE_PROTO_ID_ITEM do not match
at org.jf.dexlib.Util.ExceptionWithContext.withContext(ExceptionWithContext.java:54)
at org.jf.dexlib.Item.addExceptionContext(Item.java:177)
at org.jf.dexlib.Item.readFrom(Item.java:79)
at org.jf.dexlib.DexFile.<init>(DexFile.java:396)
at org.jf.baksmali.main.main(main.java:280)
Caused by: java.lang.RuntimeException: The section size in the header and map for item type TYPE_PROTO_ID_ITEM do not match
at org.jf.dexlib.ReadContext.addSection(ReadContext.java:152)
at org.jf.dexlib.MapItem.readItem(MapItem.java:78)
at org.jf.dexlib.Item.readFrom(Item.java:77)
... 2 more
map_item
Press Enter to continue
Sent from my LG-D802 using Tapatalk 2
I'm having exact problem
Has anyone figured out how to deodex the weather apps. Thanks !

[Q] Bspatch compile for N4

I want compile bsdiff for my Nexus 4 but i have some issue.
- I have download bspatch source from here https://code.google.com/p/android-source-browsing/source/browse/bspatch.c?repo=platform--external--bsdiff
- I use this command to compile under Ubuntu
> arm-linux-gnueabi-cpp bspatch.c -o bspatch -lbz2
and
> arm-linux-gnueabi-cpp -static -march=armv7 bspatch.c -o bspatch -lbz2
but the result file is a text and not a binary, the shell does not output errors.
Thanks

[GUIDE] How to Decompile APKs with ODEX files [Noob Friendly]

THIS GUIDE HAS BEEN TESTED ON KITKAT, MARSHMALLOW AND NOUGAT
When you have a system app with an odex file like bluetooth.apk and bluetooth.odex you can't use apktool for decompile and there is no need for deodex the whole ROM, follow this guide to decompile and mod one of these apps and nothing else.
REQUIREMENTS
- Be root
- platform-tools folder : lastest version download
- Java installed
- Files: baksmali.jar, smali.jar and zipalign.exe.
SET UP
- Make a folder named "Baksmali" and place these files: baksmali.jar, smali.jar, zipaling.exe, the apk and it's odex file
- Place the platform-tools folder in Baksmali folder and rename it to framework.
- Make sure the files are named baksmali.jar and smali.jar for simplicity , not baksmali-somenumber.jar. This is optional but keep in mind that in the commands i will assume these files are named like that so if you don't you'll have to replace with their real names like baksmali-2.0.0.jar
I i attached a zip with the complete Baksmali folder, but keep in mind this folder was created in feb 2016, you may need download manually the latest files to make sure if you got any errors it's not because of outdated versions
DECOMPILE
- Conect your device to the PC
- Go to Backsmali/framework
- Right click + SHIFT on an empty space of the folder and select "open command window here" and write:
adb pull /system/framework/arm/boot.oat boot.oat
For kitkat: adb pull /system/framework
- Go to Baksmali folder
- Right click + SHIFT on an empty space of the folder and select "open command window here" and write this command (replace NAME with the name of your odex file):
java -jar baksmali.jar -x -c boot.oat -d framework NAME.odex -o out
For Kitkat = java -jar baksmali.jar -d framework -x NAME.odex
- The files should be in the "out" folder now created
COMPILE
This way you can create a classes.dex so then you can place it in an apk so the apk is not more dependent of the odex file.
- Again in Baksmali folder Right click + SHIFT and select "open command window here":
java -jar smali.jar -o classes.dex out
Now open the APK file with 7zip/winrar and drag the file classes.dex, confirm and exit.
write this command:
zipalign -v 4 apk.apk new_apk.apk
apk: name of the apk we just added classes.dex file
new_apk: apk generated by zipaling, ready to use in the device
PLACE APP IN THE DEVICE
Rename the new_apk to the original name, and with a root explorer place it in system/app with permisions rw-r-r, remember deleting the odex file in that folder.
Update Marhsmallow: Delete the folder APKNAME in system/app and paste the apk in with permisions rw-r-r
If when you open the app crashes always try rebooting
Hello
Thank you for your guide.
I am trying to decompile the Settings.apk in order to solve some translations issues in a flash-able ROM.
In the priv-app/Settings folder there is a Settings.odex file, so i tried to follow your guide to decompile the whole thing.
The following command gives me an error, i think there is some version mismatch here:
java -jar baksmali-2.1.0.jar -d framework -x Settings.odex
Exception in thread "main" org.jf.dexlib2.DexFileFactory$UnsupportedOatVersionException: Unsupported oat version: 39
at org.jf.dexlib2.DexFileFactory.loadDexFile(DexFileFactory.java:147)
at org.jf.dexlib2.DexFileFactory.loadDexFile(DexFileFactory.java:78)
at org.jf.baksmali.main.main(main.java:266)
I am copying the needed files (framework, Settings.odex/apk) from the Zip ROM, not from the phone, i guess this isnt an issue right?
luismpc said:
Hello
Thank you for your guide.
I am trying to decompile the Settings.apk in order to solve some translations issues in a flash-able ROM.
In the priv-app/Settings folder there is a Settings.odex file, so i tried to follow your guide to decompile the whole thing.
The following command gives me an error, i think there is some version mismatch here:
java -jar baksmali-2.1.0.jar -d framework -x Settings.odex
Exception in thread "main" org.jf.dexlib2.DexFileFactory$UnsupportedOatVersionException: Unsupported oat version: 39
at org.jf.dexlib2.DexFileFactory.loadDexFile(DexFileFactory.java:147)
at org.jf.dexlib2.DexFileFactory.loadDexFile(DexFileFactory.java:78)
at org.jf.baksmali.main.main(main.java:266)
I am copying the needed files (framework, Settings.odex/apk) from the Zip ROM, not from the phone, i guess this isnt an issue right?
Click to expand...
Click to collapse
Idk maybe you should try adb pull to extract the framework from the phone, also the last versión of baksmali is 2.1.1 you got them all here.
The folder i share has the lastest versión of both.
Note Im not a dev, i made this step by step guide because i dind't find in google something clear about it and took me a long time to make it work.
I followed this guide here and i was able to decompile my file, thanks
luismpc said:
Hello
Thank you for your guide.
I am trying to decompile the Settings.apk in order to solve some translations issues in a flash-able ROM.
In the priv-app/Settings folder there is a Settings.odex file, so i tried to follow your guide to decompile the whole thing.
The following command gives me an error, i think there is some version mismatch here:
java -jar baksmali-2.1.0.jar -d framework -x Settings.odex
Exception in thread "main" org.jf.dexlib2.DexFileFactory$UnsupportedOatVersionException: Unsupported oat version: 39
at org.jf.dexlib2.DexFileFactory.loadDexFile(DexFileFactory.java:147)
at org.jf.dexlib2.DexFileFactory.loadDexFile(DexFileFactory.java:78)
at org.jf.baksmali.main.main(main.java:266)
I am copying the needed files (framework, Settings.odex/apk) from the Zip ROM, not from the phone, i guess this isnt an issue right?
Click to expand...
Click to collapse
The guide worked on KitKat, now is updated to work on Marhsmallow, you can use the new method maybe also works on Lollipop...
This guide worked wonderfully for me. I was able to decompile and recompile a system apk for Marshmallow. Thank you!
Is there a way to convert the smali files to java for Marshmallow apks (dex2jar)?
Everything worked great up until the compile part. I got an error saying "mismatched d input '' expecting END_METHOD_DIRECTIVE"
See photo attached. Anyone have any idea how to fix this so I can compile a classes.dex for my SystemUI?
Also, I just upgraded to Android N if that makes a difference...
I tried for a Marshmallow file and get this error, also I did update smali and baksmali to the latest files;
Code:
C:\Baksmali>java -jar baksmali.jar -x -c boot.oat -d framework LGSystemUI.odex -o out
Exception in thread "main" com.beust.jcommander.ParameterException: Unknown option: -x
at com.beust.jcommander.JCommander.parseValues(JCommander.java:742)
at com.beust.jcommander.JCommander.parse(JCommander.java:282)
at com.beust.jcommander.JCommander.parse(JCommander.java:265)
at org.jf.baksmali.Main.main(Main.java:90)
Thanks
Good guide. Also working in 7.1.1
neo4uo said:
I tried for a Marshmallow file and get this error, also I did update smali and baksmali to the latest files;
Code:
C:\Baksmali>java -jar baksmali.jar -x -c boot.oat -d framework LGSystemUI.odex -o out
Exception in thread "main" com.beust.jcommander.ParameterException: Unknown option: -x
at com.beust.jcommander.JCommander.parseValues(JCommander.java:742)
at com.beust.jcommander.JCommander.parse(JCommander.java:282)
at com.beust.jcommander.JCommander.parse(JCommander.java:265)
at org.jf.baksmali.Main.main(Main.java:90)
Thanks
Click to expand...
Click to collapse
you don't need the "-x" for baksmail, just "x"
Code:
java -jar baksmali.jar x -c boot.oat -d framework LGSystemUI.odex -o out
you don't need the "-x" for baksmail, just "x"
Click to expand...
Click to collapse
Thanks a lot, it worked for me. I am using version 2.2.0.
However, while executing "java -jar smali.jar -o classes.dex out" command I get following error. Please suggest the necessary correction.
C:\Users\Sandip\Desktop\New folder\Baksmali>java -jar smali.jar -o classes.dex out
Exception in thread "main" com.beust.jcommander.MissingCommandException: Expected a command, got -o
at com.beust.jcommander.JCommander.parseValues(JCommander.java:725)
at com.beust.jcommander.JCommander.parse(JCommander.java:304)
at com.beust.jcommander.JCommander.parse(JCommander.java:287)
at org.jf.smali.Main.main(Main.java:87)
C:\Users\Sandip\Desktop\New folder\Baksmali>
Figured it out from here..... https://github.com/JesusFreke/smali/wiki/SmaliBaksmali2.2
Ok. I did everything worked. However, when I try with my SystemUI, I notice additional file inside a folder (lib/arm/libNaturalEffect.so) which I assume system animation effect separated from the system (indication of modifiable).
So, do I need to keep the folder and place recompiled SystemUI.apk inside it, or else?
In case anyone has this same error...
San.Dip said:
Thanks a lot, it worked for me. I am using version 2.2.0.
However, while executing "java -jar smali.jar -o classes.dex out" command I get following error. Please suggest the necessary correction.
C:\Users\Sandip\Desktop\New folder\Baksmali>java -jar smali.jar -o classes.dex out
Exception in thread "main" com.beust.jcommander.MissingCommandException: Expected a command, got -o
at com.beust.jcommander.JCommander.parseValues(JCommander.java:725)
at com.beust.jcommander.JCommander.parse(JCommander.java:304)
at com.beust.jcommander.JCommander.parse(JCommander.java:287)
at org.jf.smali.Main.main(Main.java:87)
C:\Users\Sandip\Desktop\New folder\Baksmali>
Click to expand...
Click to collapse
I had this same error, and here is the solution I found that worked:
java -jar smali.jar assemble out -o classes.dex
I know that SanDip left the link on where he figured out how to fix it, but it wasn't immediately obvious to me what the fix was after I visited the link. Hope this helps someone!
dnnz said:
THIS GUIDE HAS BEEN TESTED ON KITKAT, MARSHMALLOW AND NOUGAT
Click to expand...
Click to collapse
I try to use this guide for Lollipop 5.1.1. boot.oat created succesfully:
Code:
d:\Baksmali\framework>adb pull /system/framework/arm/boot.oat boot.oat
/system/framework/arm/boot.oat: 1 file pulled. 4.8 MB/s (54336860 bytes in 10.858s)
and everything is ok until following command:
Code:
d:\Baksmali>java -jar baksmali.jar -x -c boot.oat -d framework DownloadProviderUi.odex -o out
Exception in thread "main" com.beust.jcommander.MissingCommandException: Expected a command, got -x
at com.beust.jcommander.JCommander.parseValues(JCommander.java:725)
at com.beust.jcommander.JCommander.parse(JCommander.java:304)
at com.beust.jcommander.JCommander.parse(JCommander.java:287)
at org.jf.baksmali.Main.main(Main.java:90)
I can't find new files. I even can't find "out" folder. Where should it be? I'm newbie, this guide noob friendly - I hope you can help me. I have 2 apps: each have apk and odex files. I need to deodex this apps.
Xperiarmus said:
Code:
d:\Baksmali>java -jar baksmali.jar -x -c boot.oat -d framework DownloadProviderUi.odex -o out
Exception in thread "main" com.beust.jcommander.MissingCommandException: Expected a command, got -x
at com.beust.jcommander.JCommander.parseValues(JCommander.java:725)
at com.beust.jcommander.JCommander.parse(JCommander.java:304)
at com.beust.jcommander.JCommander.parse(JCommander.java:287)
at org.jf.baksmali.Main.main(Main.java:90)
Click to expand...
Click to collapse
Try executing without the dash before the command, like this: java -jar baksmali.jar x -c boot.oat -d framework DownloadProviderUi.odex -o out
---------- Post added at 03:39 PM ---------- Previous post was at 03:32 PM ----------
I'm also trying to use baksmali (v2.2.2) to decode odex files, without success so far. I'm launching the command:
sudo java -jar baksmali.jar x -c framework/arm/boot.oat -d framework/ Messages.odex -o out/
and I get the error below:
Code:
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 1890058312
at org.jf.dexlib2.dexbacked.BaseDexBuffer.readSmallUint(BaseDexBuffer.java:53)
at org.jf.dexlib2.dexbacked.OatFile$DexEntryIterator.next(OatFile.java:579)
at org.jf.dexlib2.dexbacked.OatFile$DexEntryIterator.next(OatFile.java:570)
at com.google.common.collect.TransformedIterator.next(TransformedIterator.java:48)
at org.jf.util.AbstractForwardSequentialList$1.next(AbstractForwardSequentialList.java:91)
at java.util.AbstractSequentialList.get(AbstractSequentialList.java:88)
at org.jf.dexlib2.DexFileFactory.loadDexFile(DexFileFactory.java:129)
at org.jf.baksmali.DexInputCommand.loadDexFile(DexInputCommand.java:144)
at org.jf.baksmali.DisassembleCommand.run(DisassembleCommand.java:161)
at org.jf.baksmali.Main.main(Main.java:102)
Anyone having this issue as well? Adding -Xmx5000m option to the java command does not work.
I have just reinstalled stk.apk into pixelized OS for SMT-23
dnnz said:
THIS GUIDE HAS BEEN TESTED ON KITKAT, MARSHMALLOW AND NOUGAT
When you have a system app with an odex file like bluetooth.apk and bluetooth.odex you can't use apktool for decompile and there is no need for deodex the whole ROM, follow this guide to decompile and mod one of these apps and nothing else.
thank you very much sir, i almost reverted back to my old OS since custom OS did not have a sim card menu. omst epople since dont know abou this since i really had to search for this/.
Click to expand...
Click to collapse
To I tried to test it on the HiddenMenu.apk but am getting errors of missing "embedded dex file"
(I am on Android 8.0.0)
Code:
java -jar baksmali.jar x -c boot.oat -d framework HiddenMenu.odex -o out
Exception in thread "main" org.jf.dexlib2.DexFileFactory$DexFileNotFoundException: Could not locate the embedded dex file /system/app/HiddenMenu/HiddenMenu.apk. Is the vdex file missing?
at org.jf.dexlib2.dexbacked.OatFile$OatDexEntry.getDexFile(OatFile.java:586)
at org.jf.dexlib2.dexbacked.OatFile$OatDexEntry.getDexFile(OatFile.java:567)
at org.jf.baksmali.DexInputCommand.loadDexFile(DexInputCommand.java:158)
at org.jf.baksmali.DisassembleCommand.run(DisassembleCommand.java:162)
at org.jf.baksmali.Main.main(Main.java:102)
Caused by: org.jf.dexlib2.dexbacked.DexBackedDexFile$NotADexFile: Not a valid dex magic value: 7f 45 4c 46 02 01 01 03
at org.jf.dexlib2.util.DexUtil.verifyDexHeader(DexUtil.java:93)
at org.jf.dexlib2.dexbacked.OatFile$OatDexEntry.getDexFile(OatFile.java:583)
... 4 more
To try to solve the above problem, I tried to reconstruct the path structure as on the device (I adb pulled the complete \system\framework dir from the device), without success:
Code:
java -jar baksmali.jar x -c boot.oat -d framework .\system\app\HiddenMenu\oat\arm64\HiddenMenu.odex -o out
Error occurred while loading class path files. Aborting.
org.jf.dexlib2.DexFileFactory$DexFileNotFoundException: Could not locate the embedded dex file /system/framework/core-oj.jar. Is the vdex file missing?
at org.jf.dexlib2.dexbacked.OatFile$OatDexEntry.getDexFile(OatFile.java:586)
at org.jf.dexlib2.dexbacked.OatFile$OatDexEntry.getDexFile(OatFile.java:567)
at org.jf.dexlib2.analysis.PathEntryLoader.loadEntry(PathEntryLoader.java:62)
at org.jf.dexlib2.analysis.ClassPathResolver.loadLocalOrDeviceBootClassPathEntry(ClassPathResolver.java:197)
at org.jf.dexlib2.analysis.ClassPathResolver.<init>(ClassPathResolver.java:89)
at org.jf.dexlib2.analysis.ClassPathResolver.<init>(ClassPathResolver.java:154)
at org.jf.baksmali.AnalysisArguments.loadClassPathForDexFile(AnalysisArguments.java:134)
at org.jf.baksmali.AnalysisArguments.loadClassPathForDexFile(AnalysisArguments.java:89)
at org.jf.baksmali.DisassembleCommand.getOptions(DisassembleCommand.java:209)
at org.jf.baksmali.DeodexCommand.getOptions(DeodexCommand.java:71)
at org.jf.baksmali.DisassembleCommand.run(DisassembleCommand.java:183)
at org.jf.baksmali.Main.main(Main.java:102)
Caused by: org.jf.dexlib2.dexbacked.DexBackedDexFile$NotADexFile: Not a valid dex magic value: 7f 45 4c 46 01 01 01 03
at org.jf.dexlib2.util.DexUtil.verifyDexHeader(DexUtil.java:93)
at org.jf.dexlib2.dexbacked.OatFile$OatDexEntry.getDexFile(OatFile.java:583)
... 11 more

Developing

pls someone work on 3minit battery or tell me how to change battery icon on stock 7.0???
I gave it a go but couldn't figure out how to deodex systemui
hmm take help from @sailesh
This is what I got, I may be doing it wrong.
[email protected]:~/my_wd$ cp system/framework/arm/boot.oat .
[email protected]:~/my_wd$ cp system/priv-app/SystemUI/
[email protected]:~/my_wd$ cp system/priv-app/SystemUI/oat/arm/SystemUI.odex .
[email protected]:~/my_wd$ java -jar baksmali-2.2b4.jar x -c /tmp/framework/boot.oat SystemUI.odex -o SystemUI
Error occurred while loading class path files. Aborting.
org.jf.dexlib2.analysis.ClassPathResolver$ResolveException: Error while loading oat file boot.oat
at org.jf.dexlib2.analysis.ClassPathResolver.loadEntry(ClassPathResolver.java:241)
at org.jf.dexlib2.analysis.ClassPathResolver.loadLocalClassPathEntry(ClassPathResolver.java:169)
at org.jf.dexlib2.analysis.ClassPathResolver.loadLocalOrDeviceBootClassPathEntry(ClassPathResolver.java:181)
at org.jf.dexlib2.analysis.ClassPathResolver.<init>(ClassPathResolver.java:121)
at org.jf.dexlib2.analysis.ClassPathResolver.<init>(ClassPathResolver.java:106)
at org.jf.baksmali.AnalysisArguments.loadClassPathForDexFile(AnalysisArguments.java:134)
at org.jf.baksmali.AnalysisArguments.loadClassPathForDexFile(AnalysisArguments.java:91)
at org.jf.baksmali.DisassembleCommand.getOptions(DisassembleCommand.java:204)
at org.jf.baksmali.DeodexCommand.getOptions(DeodexCommand.java:71)
at org.jf.baksmali.DisassembleCommand.run(DisassembleCommand.java:178)
at org.jf.baksmali.Main.main(Main.java:102)
Caused by: org.jf.dexlib2.analysis.ClassPathResolver$NotFoundException: Cannot find dependency boot-core-libart.oat in null
at org.jf.dexlib2.analysis.ClassPathResolver.loadOatDependencies(ClassPathResolver.java:261)
at org.jf.dexlib2.analysis.ClassPathResolver.loadEntry(ClassPathResolver.java:239)
... 10 more
Click to expand...
Click to collapse
gabriwinter said:
This is what I got, I may be doing it wrong.
Click to expand...
Click to collapse
You should add the classpath-dir parameters and not pointing directly to boot.oat.
This is how i used it :
Code:
java -jar baksmali-2.2b4.jar x -d framework\arm -c framework\arm SystemUI.odex -o SysUI
vache said:
You should add the classpath-dir parameters and not pointing directly to boot.oat.
This is how i used it :
Code:
java -jar baksmali-2.2b4.jar x -d framework\arm -c framework\arm SystemUI.odex -o SysUI
Click to expand...
Click to collapse
I got it, this is what worked for me.
Code:
java -jar baksmali-2.2b4.jar deodex SystemUI.odex -b system/framework/arm/boot.oat -o SysUI
Thanks for pointing me out in the right direction
I've got a working version with System UI Tuner enabled, still have to tweak it a little, I'll upload when I finished.

Categories

Resources