automated odex to dex script
When grabbing a new Android device, most applications' dex files have been optimised for the device. A few people have written a guide to using smali and baksmali in this situation (http://forum.xda-developers.com/showthread.php?t=1208320), but here's a handy script to do it all. You'll need smali.jar and baksmali.jar in the local directory when you run it.
echo "+------------------------------+" echo "+ +" echo "+ mass de-odexer +" echo "+ TROTMASTER +" echo "+ +" echo "+------------------------------+" mkdir BOOTCLASSPATH 2>/dev/null mkdir tobedeodexed 2>/dev/null mkdir deodexed 2>/dev/null #clear out the previous contents COMMENT THIS OUT IF YOU ARE USING THE SAME BOOTCLASSPATH etc. rm BOOTCLASSPATH/* 2>/dev/null rm tobedeodexed/* 2>/dev/null rm deodexed/* 2>/dev/null #get bootclasspath files TODO:get only .jar files echo "pulling boot class path files..." adb pull /system/framework/ BOOTCLASSPATH/ > /dev/null 2>&1 #get odexes echo "pulling .odex files..." for i in $(adb shell ls /system/app/*.odex | sed -e 's/odex./odex/'); do adb pull $i tobedeodexed/$(echo $i|cut -d"/" -f 4)>/dev/null 2>&1;done #Now run smali then baksmali to change odex to dex. may need -a to change api level for i in $(ls tobedeodexed/*.odex);do rm -R out/ 2>/dev/null; echo baksmali-ing $(echo $i|cut -d"/" -f 2);java -Xmx1024m -jar baksmali.jar -x $i -d BOOTCLASSPATH/; echo smali-ing $(echo $i|cut -d"/" -f 2);java -Xmx1024m -jar smali.jar -o deodexed/$(echo $i| cut -d "/" -f 2).dex out;done