• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Root Framework error. Need help with compile.

nyioo7

Well-Known Member
Oct 27, 2011
122
27
Hey guys. I've been trying to learn about framework on android with my Triumph. But everytime I change something inside, I get error when I load the ROM on my phone. The error is com.android.phone has stopped working.

I've been following instructions on how to use apktool, apk multi too, apkchanger and also baksmali.jar and smali.jar.

What I'm trying to do is trying to change color of notification bar text, lock screen texts, fonts and colors. But none of those work for me. I've tried one after one and they all gave me same error com.android.phone has stopped working. Then I get stuck in boot loop.

I tested with simple notification text color change by decompiling classes.dex out of services.jar and changing just a single line to change the color. Still gave me error.

It seems to me that I cannot modify anything inside framework folder or it'll throw error at me. I would like to know how you guys did it and what am I missing? I've tried using UOT Kitchen and the framework-res.apk cooked from there works just fine except it cannot change the color of the text since it's in services.jar.

I've tried compiling classes.dex with 512M parameter and without the parameter. Still got the same error. For other stuffs, in APK Multi Tool, I tried setting compression to 0, memory size to 512 and didn't work. Tried playing around with settings and still didn't work.I cannot figure out what I'm missing anymore.

TL;DR - Framework modification fail for everything, even the smallest change. Please help.:thinking:
 
Are you just using the .jar that is in the dist folder? You have to use the original signed .jar with the META-INF folder, that is the signed part. If that is the issue then use 7zip to open the original .jar and put the modified dex file in there. Tip: When you change framework-res delete the folder that you are replacing because sometimes it will just merge and things will be messed up. Hope this helps.
 
  • Like
Reactions: inub and nyioo7
Upvote 0
Hey. Thanks for the reply.

I'm using the services.jar that I got the classes.dex out. I just replace the classes.dex after modifying. The services.jar is from stock ROM too. So, I think I'm using the original .jar. Even the slightest change in classes.dex is throwing me error.

Also, the framework-res.apk seems to do the same. Even the slightest change causes the error. Its' also from stock ROM too. Am I missing something here? Both processes are showing me the exact same error. So, I think the way I'm putting them back in is not right. Do I need to sign them back? I thought system files do not require signing since they are already signed.

I am using winrar to open .jar and putting back dex file. Is that the problem?
 
Upvote 0
Any help guys? Am I compiling it wrong? framework-res.apk modified at UOT kitchen works just fine. But when I modify the exact same code in the XML files from stock framework-res.apk, I get the error and boot loop. :thinking:

When decompiling I see you are using apktool. When I do everything I am doing it in linux using the apktool. The other thing to remember is no matter what part of the ROM you are working on, make sure to load in the framework-res.apk from the rom even if you are working on the framework-res.apk so it knows what settings to decompile. So first run

$ apktool if framework-res.apk

So for each ROM you are decompiling and recompiling this needs to be done. So lets say you choose to decompile frameworks.jar from MIUI and CM7 you need to first load the MIUI framework-res.apk from MIUI then decompile MIUI frameworks.jar. Then load the CM7 frameworks-res.apk then decompile CM7 frameworks.jar. And the same thing goes for recompiling it. If you have further questions please feel free to post.
 
  • Like
Reactions: nyioo7 and inub
Upvote 0
When decompiling I see you are using apktool. When I do everything I am doing it in linux using the apktool. The other thing to remember is no matter what part of the ROM you are working on, make sure to load in the framework-res.apk from the rom even if you are working on the framework-res.apk so it knows what settings to decompile. So first run

$ apktool if framework-res.apk

So for each ROM you are decompiling and recompiling this needs to be done. So lets say you choose to decompile frameworks.jar from MIUI and CM7 you need to first load the MIUI framework-res.apk from MIUI then decompile MIUI frameworks.jar. Then load the CM7 frameworks-res.apk then decompile CM7 frameworks.jar. And the same thing goes for recompiling it. If you have further questions please feel free to post.

Hey. Thanks for the reply. One thing I'm not clear on this is that, when I run apktool if command, it installs the framework-res.apk in a folder. So, my question is, how do I decompile frameworks.jar? I am currently decompiling jar file I want to modify (services.jar) using baksmali.jar and recompiling with smali.jar. These compilers do not seem to have anything to do with apktool. Am I missing a step? Because it's throwing me the same error. com.android.phone process has stopped working and goes into boot loop.

I am able to modify the framework-res.apk now. My problem was that I was not deleting the res folder or any folders I modified. It was because I did not understand fully of how apktool compile.
 
Upvote 0
Hey. Thanks for the reply. One thing I'm not clear on this is that, when I run apktool if command, it installs the framework-res.apk in a folder. So, my question is, how do I decompile frameworks.jar? I am currently decompiling jar file I want to modify (services.jar) using baksmali.jar and recompiling with smali.jar. These compilers do not seem to have anything to do with apktool. Am I missing a step? Because it's throwing me the same error. com.android.phone process has stopped working and goes into boot loop.

I am able to modify the framework-res.apk now. My problem was that I was not deleting the res folder or any folders I modified. It was because I did not understand fully of how apktool compile.

Ill put together a quick cheat sheet on what I am doing in ubuntu give me some time :D
 
  • Like
Reactions: nyioo7
Upvote 0
Alright wrote it up for Ubuntu should work perfectly based on the tools I also put in the download site.

AndroidDecompileRecompile - mtdev-cm - How to decompile and recompile all things Android - CyanogenMod by Team MTDEV - Google Project Hosting

Hey g60madman. If you got time, could you give me a quick tip on how to modify and recompile jar file? I've tried recompiling service.jar with modified original classes.dex and it's giving me error and boot loop. I'm using " java -Xmx512M -jar smali.jar" to recompile. But it seems to be wrong at some point.

This is what I was doing. Trying to change the clock color in task bar. I changed const/4 v8, 0x0 to const v8, 0x000000. It would compile just fine with this but it gives me error when I apply it to the phone.
 
Upvote 0
Hey g60madman. If you got time, could you give me a quick tip on how to modify and recompile jar file? I've tried recompiling service.jar with modified original classes.dex and it's giving me error and boot loop. I'm using " java -Xmx512M -jar smali.jar" to recompile. But it seems to be wrong at some point.

This is what I was doing. Trying to change the clock color in task bar. I changed const/4 v8, 0x0 to const v8, 0x000000. It would compile just fine with this but it gives me error when I apply it to the phone.

Follow the step 1 procedure I did in the write up but run it the same against the services. The way the step 1 procedure was written is for every files in system/frameworks you don't need to run the java command or anything like that just the following....

Copy service.jar to tools folder
$ cd ~/tools

Rename the service.jar
$ mv service.jar service-org.jar

Decompile and make changes
$ ./apktool d service-org.jar

Recompile service.jar and copy to ROM.
$ ./apktool b fservice-org.jar service.jar

If you have further questions please let feel free to post :)
 
  • Like
Reactions: nyioo7
Upvote 0
Follow the step 1 procedure I did in the write up but run it the same against the services. The way the step 1 procedure was written is for every files in system/frameworks you don't need to run the java command or anything like that just the following....

Copy service.jar to tools folder
$ cd ~/tools

Rename the service.jar
$ mv service.jar service-org.jar

Decompile and make changes
$ ./apktool d service-org.jar

Recompile service.jar and copy to ROM.
$ ./apktool b fservice-org.jar service.jar

If you have further questions please let feel free to post :)

Ohhh. So, I was extracting and decompiling classes.dex. Thanks.
 
Upvote 0

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones