Android Tablets Forum banner
1 - 4 of 4 Posts

·
Registered
Joined
·
128 Posts
Discussion Starter · #1 ·
You'll need Java JRE for this and AVABox Grab the jar or apk you want to play with, put it in avaboxroot/smali/baksmali. Use 7-zip to extract classes.dex. Pull up cmd.exe as an administrator and change to that directory. Then:
Code:
java -jar baksmali-<version>.jar -o classout/ classes.dex
Do your editing, then, to repack it, type
Code:
java -Xmx512M -jar smali.jar classout/ -o new-classes.dex
Put it back into the apk or jar and run with it.
 

·
Registered
Joined
·
30 Posts
Darexius;15462][CODE]java -jar baksmali-<version>.jar -o classout/ classes.dex[/CODE] Do your editing said:
java -Xmx512M -jar smali.jar classout/ -o new-classes.dex[/code]
Just a note on the "do your editing" part, I've found that it works very well (assuming the jar you want to modify belongs to the standard android framework) is to setup an android build environment, do a full make, copy the complete output somewhere for safekeeping, then make the changes you want to the .java files, do another make. The baksmali the jar file from both the original android and with your changes, comparing them shows nicely where exactly changes have been made, then compare your changed .smali files against the ones from the ROM and merge in the relevant changes.For everything that goes beyond simple changes, this is much easier then writing larger amounts of code directly in smali.Also, a general approach for keeping the modifications to existing code to a minimum is to add a new .java file with a new class with static methods with your new code and just call these static methods, passing along any variables, fields, parameters that are required, from the original code. That way the merging becomes much simpler as the new .java file ends up as one or more new .smali files you can just copy, and the injected call is just a one line (plus one line per passed parameter) that can easily be merged in.
 
1 - 4 of 4 Posts
This is an older thread, you may not receive a response, and could be reviving an old thread. Please consider creating a new thread.
Top