[Q] De-Odexed Framework not working - General Questions and Answers

Hello all;
I have an LG p698 device, with a custom ROM (ZemDroid)(Gingerbread). Everything is working fine, but I wanted to add Arabic support to it, and for that, I need a deodexed framework.
I pulled the entire /system/framework directory, copied and modified the BOOTCLASSPATH as necessary, and used smali and baksmali 2.0.3. They reported no errors in disassembling the framework.odex file, created the "out" directory, and then using smali created the classes.dex file, which I shoved into the framework.jar file using Ark (Kubuntu 13.10).
I made a copy of the working framework.jar and framework.odex files on device, and put the new jar, and of course, deleted the odex.
wiped the dalvik cache for good measure, and rebooted.. The phone got stuck on LG logo :/ (It didn't even reach the custom splash image)
I can reboot into CWM, I can even adb into it in this state, but it won't continue starting up. Replacing original ones lets the device start normally, but my deodexed framework.jar won't :crying:
Any ideas?

Related

[Q] Is a partially deodexed phone okay?

I'm using xUltimate to deodex the files on my rooted Motorola I1 but I'm getting errors with a few of the system apps(Phone, CameraMoto, etc.). Is it safe to copy to my phone just the successfully deodexed apks and let be the few odexed apps? Or does everything on my phone need to be either odexed or deodexed for the phone to run?
I'm also very interested to the answer to this...
Well, it took a few failed reboots, but as of now my phone seems to be working while only partially deodexed. It's fully booted and I can make a phone call - haven't tested anything else. Everything in /system/framework is deodexed, but there are still a few apks in /system/apps that are not.
The output from the failed reboots seemed to indicate that at least one of the still-odexed apk files needed particular odex files in /system/framework and couldn't find them, raising an unhandled exception(I'd deleted all the .odex files from /system/framework once I'd copied over the deodexed versions). I copied back the odex files the apk needed(just the .odex files, not the originial .jar or .apk files) to /system/framework and the phone booted successfully.
So right now my /system/app has a mixture of odexed and deodexed files; my /system/framework has only deodexed jars but also has a few of the original odex files. Not sure if the phone would be okay with a mixture of odexed and deodexed files in /system/framework, especially with regard to certain critical jars. I seem to recall, however, attempting to put a single deodexed file(services.jar) onto a different phone(HTC Incredible) and not getting good results.
As long as the framework files are odexed, both deodexed and odexed apps in /system/app will work.
If the framework is deodexed, all /system/apps has to be deodexed, if not, the apps will be disabled on boot and won't show up in launcher (they won't get deleted). The device won't boot if for example the settings app gets disabled..
The framework cannot be deodexed partially.
Thanks Fr4gg0r, that makes sense and jibes with what I found. So far I've been able to manually deodex some of the /system/apps that xUltimate couldn't deodex itself, so I may not need to run with a partially deodexed phone, anyways.

[Q] Why won't my changes in framework-res.apk load?

Working from rooted 2.3.3 (on a Droid X2, but I don't think that matters).
I have pulled /system/framework/framework-res.apk from the phone, unzipped, modified exactly one file (\res\drawable-hdpi\zz_moto_list_texture_bg.png) with photoshop, zipped back up (7-zip), zipaligned and pushed back into the /system/framework/ directory with the correct permissions. The file was not re-signed.
The phone boots without error, but the new modified file does not get loaded, the old version of the graphic remains. I have double checked and my modified /system/framework/framework-res.apk is in place. I don't know where the phone is getting the old version from.
I have tried formatting the system cache, erasing all user data via android recovery, zipped with different levels of compression for the apk file (moderate to none), same result.
I had this problem before on 2.2.2, which I thought was corrected by formatting the cache, but I guess I was wrong and it got fixed by chance.
Does anyone know what can be done to force framework-res.apk in the /system/framework/ directory to load?
Relevant files attached.
Chris
Figured this out. There is a 5x5 graphic that colored the background texture. I had to change that too.
Chris

[Q] Modifying .odex file

Is it possible to modify code in a system .odex file without de-odexing?
Here is what I've been trying, without success (Windows computer, Samsung Epic 4G Touch phone, stock ROM with 2.3.6):
On my computer, using Android Commander, I pull a .odex from /system/app to my computer. There is a corresponding .apk, but I leave that alone. I also pull the entire /system/framework folder.
On my computer, from the location containing the framework folder and the .odex file, I run "java -jar baksmali.jar --api-level 10 -d framework -x <FILE_NAME>.odex". This creates an "out" folder, with the com/android/<FILE_NAME> folder structure and the code.
I modify the code (.smali files).
I rename the original .odex file and run "java -jar smali.jar --api-level 10 out/ -o <FILE_NAME>.odex". This creates a new .odex file that, as far as I can tell, should have the updated code in it.
Using Android Commander, I push the new .odex to /system/app on my phone, change the permissions to 644, and reboot the phone.​
The changes aren't having an effect. In fact, the status bar is completely gone (the example I'm working on is a mod to the status bar in SystemUI.odex).
Any idea what I'm doing wrong?
So I'm getting the feeling that it's not possible to edit odexed apks. Is there anyway to de-odex just a single apk rather than the whole rom?
Brent212 said:
So I'm getting the feeling that it's not possible to edit odexed apks. Is there anyway to de-odex just a single apk rather than the whole rom?
Click to expand...
Click to collapse
http://forum.xda-developers.com/showthread.php?t=1208320
Basically, no odex can be edited and put back that easy. Wrapping and Signing ODEX style is required.
Awesome! That thread's perfect. I'm hoping I can deodex, mod the code, create a classes.dex file and put it in with the .apk, zipalign it, and just replace the existing .apk and .odex with the new .apk.
That thread (http://forum.xda-developers.com/showthread.php?t=1208320) had the answers I was looking for.
The trick was to either rename the new .odex to classes.dex and put it into the .apk, and zipalign the .apk (although I have a feeling that wasn't actually necessary), or to copy the signature from the old .odex file to the new one.
Brent212 said:
That thread (http://forum.xda-developers.com/showthread.php?t=1208320) had the answers I was looking for.
The trick was to either rename the new .odex to classes.dex and put it into the .apk, and zipalign the .apk (although I have a feeling that wasn't actually necessary), or to copy the signature from the old .odex file to the new one.
Click to expand...
Click to collapse
Odex is not dex. And vice versa. Remember that. When compiling, the result is always dex. To have odex, you need to wrap it with dexopt-wrapper within your phone.
sent from my white ray using XDA App

[Q] Services.jar changes, even simply deodexing the file prevents phone from booting

I am trying to make a minor change to my services.jar and so far have no been successful.
I deodexed the file with xultimate2.3.3 , extracted the classes.dex with 7zip 9.2, I used apktool 1.4.3 to "expand" the contents, made the change, repacked the dex file and put it back into services.jar and the phone cannot compelete boot. I made sure to change the permissions, owner a group to match the previous file.
I then tried using Xultimate to deodex the file and put it back on the phone and this also keeps it from booting.
I then tried using the already deodexed file from another rom (2.2.1 vs 2.2.2) and it had the same issue.
So far I have to reflash my phone with Odin every time and I am getting tired of making the same mistake over and over.
edit: Maybe I should ask - what is the appropraite way to move the file over? I am doing it by going into root explorer, deleting /system/framework/services.jar+services.odex, using adb push to put the file on the sdcard, using root explorer to move it from sdcard to /system/framework then changing the permissions in root explorer to match the previous file before finally running "chown root.root /system/framework/services.jar" from adb shell
Either my method for copying the file is bad or xultimate 2.3.3 is messing up the deodex. Any advice on another tool to use to deodex this file?
You should be using baksmali/smali to decompile/recompile classes.dex, not apktool :/
Apktool can decompile .jars too
I use it and works fine
@OP
After deodexing decompile the jar using Virtuous Ten Studio by Diamondback(Google it)
Burned from my laser torch using pencil cells
Thank you for the replies. I will try these suggestions.
As a side note I also tried to use Xultimate to deodex the file, then ran dexopt-wrapper on the output to reodex the unchanged file and the phone is stuck in a boot loop.
You can read about re-odexing files here http://themikmik.com/showthread.php...w-About-adb-odex-themes-etc&p=75225#post75225
Can you give suggestions on another tool to de-odex the services.jar file? I think xultimate is the problem. It is the only common denominator.
I forgot to add that the original services.odex is a different size and has different contents from the new services.odex created by xultimate+dexopt-wrapper
I didn't expect it to work but I took the modified/deodex services.jar from a 2.2.1 rom and put it into my 2.2.2 rom and it had the same non boot issue.
The newest version of xUltimate i could find.
Enjoy
http://www.xeudoxus.com/android/xUltimate-v2.4.2.zip

Proper way to modify framework.jar and android.policy.jar

Hello - I am trying to add 'Reboot' option to Power Menu by modifying the following files - framework-res.apk, framework.jar, and android.policy.jar file. I was successfully able to add additional values to the xml file inside framework-res.apk and was able to merge my changes into the original .apk file and update in /system/framework without any issues. However, the smallest changes I make in framework.jar or android.policy.jar file breaks my system. It does not go into a Reboot Loop, but rather gives a message... Unfortunately, the <app name> has stopped working... or something like that... for almost all the apps and repeatedly.
I am on a Stock ROM of Micromax A110 (Mobistel T2). Do I need to DEODEX these .jar files first or do something else? I can't find the .odex files for these two jar files. I am not sure what I am doing wrong. Please help.
I can see some .odex files in my /system/app folder, but none in /system/framework. Is this normal? I am sure I didn't do any deodexing.

Categories

Resources