Framework error. Need help with compile.

Last Updated:

  1. nyioo7

    nyioo7 Well-Known Member

    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 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 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.:confused:

  2. BSydz

    BSydz Well-Known Member Developer

    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.
    inub and nyioo7 like this.
  3. nyioo7

    nyioo7 Well-Known Member

    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?
  4. nyioo7

    nyioo7 Well-Known Member

    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. :confused:
  5. g60madman

    g60madman Well-Known Member Developer

    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.
    nyioo7 and inub like this.
  6. inub

    inub Well-Known Member

    thanks i was having that same problem the other day
    g60madman likes this.
  7. nyioo7

    nyioo7 Well-Known Member

    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. 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.
  8. g60madman

    g60madman Well-Known Member Developer

    Ill put together a quick cheat sheet on what I am doing in ubuntu give me some time :D
    nyioo7 likes this.
  9. nyioo7

    nyioo7 Well-Known Member

    Wow dude. Thanks!
  10. g60madman

    g60madman Well-Known Member Developer

    inub and nyioo7 like this.
  11. nyioo7

    nyioo7 Well-Known Member

    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.
  12. g60madman

    g60madman Well-Known Member Developer

    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 :)
    nyioo7 likes this.
  13. nyioo7

    nyioo7 Well-Known Member

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

Share This Page