[Q] De-Odexed Framework not working - Android Q&A, Help & Troubleshooting

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
Any ideas?

Related

[Q] Applications crash after pushing modded framework-res.apk

After rebooting with a modded/pushed framework-res.apk i can see my changes (status bar bg, etc).
But shorty after entering my pin code, several applications crash, repeatedly. Why is this happening?
Here's what i did:
Code:
adb pull /system/framework/framework-res.apk
2. Opened framework-res.apk in BetterZip
3. Extracted pngs to be edited in photoshop
4. Dropped edited pngs back to framework-res.apk in BetterZip and saved file
5. Signed the .apk with Android-sign.app
Code:
adb reboot recovery
adb shell
mount system
exit
adb push framework-res.apk /system/framework-res.apk
adb reboot
Can't figure out what I'm doing wrong here, I tried flashing cache. Tried doing this process on OpenFireROM but ended up in a bootloop.
Any suggestions?
Thanks in advance
tried zipalign, still no luck
maybe i'll just buy an iphone
Try wipe dalvik cache this should help
Sent from my HTC Wildfire using XDA App
Did you try putting the original meta-inf folder and manifest xml back into your modified framework?
Sent from my HTC Wildfire using XDA App
Tried wiping the dalvin cache, still no luck.
At what stage should i put back the .xml and META-INF folder?
Thank you for your replies
sohn said:
Tried wiping the dalvin cache, still no luck.
At what stage should i put back the .xml and META-INF folder?
Thank you for your replies
Click to expand...
Click to collapse
After you compile the apk.
Sent from my HTC Wildfire using XDA App
I tried a new approach on this now;
decompiling framework-res.apk with apktool
editing pngs in photoshop
building new .apk with apktool
now i noticed the compiled .apk did not include the META-INF folder, so i tried two approaches here;
1) signing it with android-sign.app (on mac os), this did not work
2) I included the original META-INF folder and saved the files using a zip manager, this failed too
thought i had it when i saw the decompiled png files
I had this to but tomorrow I will look better to it to look to the problem
Will reply tomorrow what I found
send from my HTC WildFire
* 2.1
* rooted
* clockworkmod recovery
* no custom rom yet, only theme
I dont think stock roms can apply themes because they aren't deodexed.
When you compile the apk using apk manager, don't forget to delete the resource.arsc and other files in the keep folder you modified.
Also don't mess with .9 pngs as that can screw your framework if you duno what you're doing.
Or just use the UOT kitchen to make a flashable zip.
Btw you can inject themes on any rom you want
Even with an extracted nandroid backup
Search: one click theme injector
(Sorry can't give the link on phone)
send from my HTC WildFire
* 2.1
* rooted
* clockworkmod recovery
* no custom rom yet, only theme
i installed windows server 2003 on a virtual machine and made changes to non .9.pngs in 7zip, flashing this worked out fine.
if I decompile a framework and edit the .9.pngs in photoshop, then replacing files in 7zip, would that work?
Yes works by me but have only done a few can be that not every .9.PNG will work, one time 1file was making every app fc so I think just try and if its not working just use backup of the one before and try again I think, I am doing the same
send from my HTC WildFire
* 2.1
* rooted
* clockworkmod recovery
* no custom rom yet, only theme

[Q] Re-compile framework-res.apk

I am trying to make some minor changes to framework-res.apk in /res/values/bools.xml
I used apktool to decompile and make my changes but I am not sure how to properly re-compile.
Just "apktool b framework-res" errors out with invalid resource names.
Finally got it to re-compile by pasting the resource.arsc. from original apk(Dunno if this is correct way)
Then, after re-compile I paste the META-INF from the original apk.
I am hesitant to push this onto my phone now because to file sizes of the modified and original .apk differ by like 2mb. And theres 100 more files in /res of the modified .apk. (Now shows file I was trying to access by decompiling before)
Can I safely push the .apk? or am I doing it completly wrong?
Thanks!
( I did search forums and web before, but did not find anyone having to copy resource.arsc before re-compiling)
trailblazerz11 said:
I am trying to make some minor changes to framework-res.apk in /res/values/bools.xml
I used apktool to decompile and make my changes but I am not sure how to properly re-compile.
Just "apktool b framework-res" errors out with invalid resource names.
Finally got it to re-compile by pasting the resource.arsc. from original apk(Dunno if this is correct way)
Then, after re-compile I paste the META-INF from the original apk.
I am hesitant to push this onto my phone now because to file sizes of the modified and original .apk differ by like 2mb. And theres 100 more files in /res of the modified .apk. (Now shows file I was trying to access by decompiling before)
Can I safely push the .apk? or am I doing it completly wrong?
Thanks!
( I did search forums and web before, but did not find anyone having to copy resource.arsc before re-compiling)
Click to expand...
Click to collapse
FOr me, APKtool works as ****...
What you can do: pull /system/framework/framework-res.apk ~/backup
and then you can push. If it doesn't work, then boot into recovery, select mount system and push back the old one.
OT: I don't get why you should use original resources.arsc...
offtopic: when I decompile framework-res using apktool, I get other file structure then normal extract. example: my framework-res doenst have a raw-folder, but apktool decompiled has...
mDroidd said:
FOr me, APKtool works as ****...
What you can do: pull /system/framework/framework-res.apk ~/backup
and then you can push. If it doesn't work, then boot into recovery, select mount system and push back the old one.
OT: I don't get why you should use original resources.arsc...
offtopic: when I decompile framework-res using apktool, I get other file structure then normal extract. example: my framework-res doenst have a raw-folder, but apktool decompiled has...
Click to expand...
Click to collapse
This is due to the raw folder being combined into the resources file. Search for apkmultitool it is a far easier tool to use and will do everything you need. That goes for both posts
Before doing that, create a flashable zip containing the framework-res.apk file which you can use in case you get a black screen or something.
So that you don't have to restore.
You do realize that resources.arsc, aka resources directory is the collection of xml and other data. You take it from another ROM, how on earth will your xml edits be preserved?
Sent from my HTC Desire using Tapatalk
I need to edit the bools.xml file in framework-res.apk and an a bit stuck on the apktool. I used the APK Multitool to decompile the framework-res.apk file. I then used notepad++ to edit the bools.xml file. I then recompiled it using the APK Multitool and pushed it to /system/framework overwriting the original (after first making a copy of the original). On reboot the phone is stuck in a boot loop.
I managed to use ADB shell to restore the original file and it now boots (I lost all the synchronise stuff but not a big deal). So I have been searching and have found various posts about the later versions of apktool not working very well.
I have a fairly clean Windows 7 x86 installation with Java 1.6 and am using this to do the work on. Can someone point me in the right direction as to how to edit/recompile the framework-res.apk file?
Andy
I actually also trying to edit bools.xml located in framework-res.apk
I'm using Apk Changer it may be easier.
after some tries (and bootloops) I've managed to do some changes in framework-res : replacing pictures -> It works
after decompiling the apk, when I edit values within bools.xml , & then choose to compile, it creates a folder called "keep" and i have to delete edited files in that folder so as to replace them by my customized files.
BUT I don't find the folder "values" that contains bools.xml . Therefore, the generated apk will not make changes done in bools.xml .
Does anyone has any idea about Editing that xml ?
More details & Tuto :
http://forum.xda-developers.com/showthread.php?t=916814
http://forum.xda-developers.com/showpost.php?p=9066440&postcount=1
http://forum.xda-developers.com/showpost.php?p=9978779&postcount=62
@ADB100
Advanced Decompiling
Sometimes, you have that pesky app that just won't decompile correctly. Usually, it's an app related to others, like a proprietary system app based off framework-res.apks.
When this happens, you need to ensure that the frameworks are there to have the app's recourse tables properly compile.
For either apktool or apk manager, find a folder on your computer called "apktool."
The should be a folder in here called "framework," and inside that, a 1.apk.
For an app that is dependent on the framework-res.apk in a specific phone/rom, take the framework-res.apk for that rom and rename it 1.apk.
Replace the default one in the folder with yours.
If there's a second one, like the twframework-res.apk for Samsung phones, rename it 2.apk and place it in the "framework" folder.
Now, decompile like normal, and everything should be good
//By theimpaler747
Click to expand...
Click to collapse
-Yasser-
-yasser- said:
I actually also trying to edit bools.xml located in framework-res.apk
I'm using Apk Changer it may be easier.
after some tries (and bootloops) I've managed to do some changes in framework-res : replacing pictures -> It works
after decompiling the apk, when I edit values within bools.xml , & then choose to compile, it creates a folder called "keep" and i have to delete edited files in that folder so as to replace them by my customized files.
BUT I don't find the folder "values" that contains bools.xml . Therefore, the generated apk will not make changes done in bools.xml .
Does anyone has any idea about Editing that xml ?
More details & Tuto :
http://forum.xda-developers.com/showthread.php?t=916814
http://forum.xda-developers.com/showpost.php?p=9066440&postcount=1
http://forum.xda-developers.com/showpost.php?p=9978779&postcount=62
@ADB100
-Yasser-
Click to expand...
Click to collapse
The values folders get compressed into the resources.arsc file so in the keep folder delete this file and your changes will stick
not sure if you got this figured out yet but if not heres how the whole process should go.
Code:
apktool if framework-res.apk
if on a sense based rom do this too
Code:
apktool if com.htc.resources.apk
change to the directory where your framework-res.apk is
Code:
apktool d -f framework-res.apk out
or something like this if apktool is not in your path
Code:
apktool d -f ~/Desktop/framework-res.apk ~/Desktop/out
easy way to build is to cd to out folder
Code:
cd ~/Desktop/out
to build apk
Code:
apktool b
then just sign apk if needed
if you are on linux you can try this:
http://forum.xda-developers.com/showthread.php?t=1446233
wes342 said:
not sure if you got this figured out yet but if not heres how the whole process should go.
Code:
apktool if framework-res.apk
if on a sense based rom do this too
Code:
apktool if com.htc.resources.apk
change to the directory where your framework-res.apk is
Code:
apktool d -f framework-res.apk out
or something like this if apktool is not in your path
Code:
apktool d -f ~/Desktop/framework-res.apk ~/Desktop/out
easy way to build is to cd to out folder
Code:
cd ~/Desktop/out
to build apk
Code:
apktool b
then just sign apk if needed
if you are on linux you can try this:
http://forum.xda-developers.com/showthread.php?t=1446233
Click to expand...
Click to collapse
Thanks for this. This is what I have done but it hasn't worked for me so far. I am not sure whether I need to sign the file or not - I suspect I do?
Apart from the boot-loop another thing that worries me is the file sizes - the original framework-res.apk is 6,135,120-bytes whilst the new one is 3,319,608-bytes.
My ROM is based on the stock rooted 3.12.405.1 by nitro. The framework-res.apk already had a modification (the default wallpaper was changed) and I changed this back by just replacing the image in the .apk from WinRar and this worked fine. I want to edit the bools.xml file and get it back into the resources.arsc file.
Andy
ADB100 said:
Thanks for this. This is what I have done but it hasn't worked for me so far. I am not sure whether I need to sign the file or not - I suspect I do?
Apart from the boot-loop another thing that worries me is the file sizes - the original framework-res.apk is 6,135,120-bytes whilst the new one is 3,319,608-bytes.
My ROM is based on the stock rooted 3.12.405.1 by nitro. The framework-res.apk already had a modification (the default wallpaper was changed) and I changed this back by just replacing the image in the .apk from WinRar and this worked fine. I want to edit the bools.xml file and get it back into the resources.arsc file.
Andy
Click to expand...
Click to collapse
No you don't have to sign the framework API. System apks are signed. What edits are you trying to do?
zelendel said:
No you don't have to sign the framework API. System apks are signed. What edits are you trying to do?
Click to expand...
Click to collapse
All I want to edit is the bools.xml file so I can enable the SIP client to work over 3G: i.e. change this line in the file and re-cook it
Code:
<bool name="config_sip_wifi_only">true</bool>
This is potentially the 1st step though. If I can sucessfully edit this then I will probably try other things.
Andy
ADB100 said:
All I want to edit is the bools.xml file so I can enable the SIP client to work over 3G: i.e. change this line in the file and re-cook it
Code:
<bool name="config_sip_wifi_only">true</bool>
This is potentially the 1st step though. If I can sucessfully edit this then I will probably try other things.
Andy
Click to expand...
Click to collapse
Ok so here is a step by step that I have used to make just this edit.
Apkmultitool is the one I use.
1. Decompile the apk
2. Change the false to true
3. Compile with option 11
4. In the keep folder delete the resource.asc file and then finish compiling.
5. Put New apk in zip removing the unsigned so it is named properly
6. Flash
zelendel said:
Ok so here is a step by step that I have used to make just this edit.
Apkmultitool is the one I use.
1. Decompile the apk
2. Change the false to true
3. Compile with option 11
4. In the keep folder delete the resource.asc file and then finish compiling.
5. Put New apk in zip removing the unsigned so it is named properly
6. Flash
Click to expand...
Click to collapse
OK - just removed and reinstalled APK Multitool, verified the path environment variable and followed these steps - Step 3 where it asks whether this is a system apk I said yes and when it asks about copying files I said yes. The resulting file is now 5,653KB compared to the original that is 5,992KB. I assume the difference is the lack of signing?
Does this sound right?
Andy
ADB100 said:
OK - just removed and reinstalled APK Multitool, verified the path environment variable and followed these steps - Step 3 where it asks whether this is a system apk I said yes and when it asks about copying files I said yes. The resulting file is now 5,653KB compared to the original that is 5,992KB. I assume the difference is the lack of signing?
Does this sound right?
Andy
Click to expand...
Click to collapse
That and the compression level that is used. It will also change if you optimize the pngs. Nothing to really worry about
I am obviously doing something fundamentally wrong
I followed the instructions to the letter, created the unsignedframework-res.apk, renamed it, pushed it to to my device (adb remount, adb push framework-res.apk system/framework/framework-res.apk) and rebooted - boot loop. Tried signing it with APK Multitool and then pushing this file. This time it booted but I had forced close on all sorts of things. Restored the original file and it is working again but all the sync stuff has screwed up meaning I need to re-flash as my ROM has stuff in /data that will get wiped if I do a factory reset.
Any other pointers or do you want to try editing the file for me and I'll see if yours works? I have attached the original file.
Andy
ADB100 said:
I am obviously doing something fundamentally wrong
I followed the instructions to the letter, created the unsignedframework-res.apk, renamed it, pushed it to to my device (adb remount, adb push framework-res.apk system/framework/framework-res.apk) and rebooted - boot loop. Tried signing it with APK Multitool and then pushing this file. This time it booted but I had forced close on all sorts of things. Restored the original file and it is working again but all the sync stuff has screwed up meaning I need to re-flash as my ROM has stuff in /data that will get wiped if I do a factory reset.
Any other pointers or do you want to try editing the file for me and I'll see if yours works? I have attached the original file.
Andy
Click to expand...
Click to collapse
I've tried to change it for you,
Code:
<bool name="config_sip_wifi_only">false</bool>
The file size is reduced to 3.23 Mb maybe it's bcz of optimizing effect..
check if it works .
-Yasser-
-yasser- said:
I've tried to change it for you,
Code:
<bool name="config_sip_wifi_only">false</bool>
The file size is reduced to 3.23 Mb maybe it's bcz of optimizing effect..
check if it works .
-Yasser-
Click to expand...
Click to collapse
Hi
Thanks for this. Just renamed this and pushed it to my DHD, rebooted and yep it works. I haven't built a ROM with it yet but this tells me something is wrong at my end....
I have a fairly vanilla Dell PC with Windows 7 Ultimate x86 OEM. I have installed the DSIXDA kitchen and have been building ROMs for my DHD for a while. I have some of the Android SDK installed but maybe not all or updated (not sure if this is a problem?) but enough for adb.exe to work? I have installed the APK Multitool (obviously) and some other utilities (Ultimate Multi Tool, HTC Sync)
Other than that its a pretty clean machine - Microsoft Security Essentials and WinRar is all that's installed. This is a spare PC that I wiped recently and installed Windows 7 on and all I am really using it for is making android ROMs.
EDIT: Just built a ROM with this framework-res.apk as swapping this after I have configured account sync seems to screw the accounts up (they sync but aren't displayed in Settings, Accounts & Sync). Anyway the ROM built OK and its all working. I'd really like to know what I am doing wrong with editing the APK?
Andy
OK.
I don't really know what's wrong with your PC, or procedure ..
I'll tell you what I am doing, that may helps.
I'm using apk changer . download it from here
I think It's nearly the same as other tools, although you can try it.
For editing framework-res.apk,
first open cmd : cd <..>\apk_changer\other (folder containing apktool.jar)
then type : java -jar apktool.jar if <PATH To>\framework-res.apk
It should tell you that "framework installed to ..."
Now put your framework-res.apk in "place-files-here-for-modding"
and run apkchanger.bat choose 1 (decompile) and 3 (for sources & resources)
Do your modifications.
then return to bat, type 3 (compile). yes for system apk & yes for replacing original files.
a 'keep' folder will be created, delete resources.asc inside it.
type enter within cmd & you're done . check the new file in "place-files-here-for-modding" (unsignedframework-res.apk)
Yasser
-yasser- said:
OK.
I don't really know what's wrong with your PC, or procedure ..
I'll tell you what I am doing, that may helps.
I'm using apk changer . download it from here
I think It's nearly the same as other tools, although you can try it.
For editing framework-res.apk,
first open cmd : cd <..>\apk_changer\other (folder containing apktool.jar)
then type : java -jar apktool.jar if <PATH To>\framework-res.apk
It should tell you that "framework installed to ..."
Now put your framework-res.apk in "place-files-here-for-modding"
and run apkchanger.bat choose 1 (decompile) and 3 (for sources & resources)
Do your modifications.
then return to bat, type 3 (compile). yes for system apk & yes for replacing original files.
a 'keep' folder will be created, delete resources.asc inside it.
type enter within cmd & you're done . check the new file in "place-files-here-for-modding" (unsignedframework-res.apk)
Yasser
Click to expand...
Click to collapse
Hi
Thanks for replying. I am going to wipe and reinstall Windows 7. I know it seems a bit drastic but its the only way I can eliminate it - plus its just a PC in the corner that has no important stuff (apart from the android stuff) on it.
Andy

[Q] Modifying odexed framework

I have an SGH-i547c running stock rom. This is what I prefer. Needless to say, it is odexed
I needed to edit the AudioService.smali file in the framework.odex
I figured out how to deodex framework.odex and edit the AudioService.smali file from the "out" folder
I also figured out how to odex the folder back into a framework.odex file without any errors.
However, the original framework.odex file is 8502KB and the edited and re-odexed version is 8034KB and it does not work on my device. The device failed to boot after replacing with the smaller file..........I had to re-flash the stock /system with Odin as I could not gain enough permission to push the original framework.odex I had backed up, back to the device using ADB through stock recovery or download mode.
I only changed a couple values in the AudioService.smali file yet I tried re-odexing several times and the output file was always smaller than the original and would not work on device.
I found some tutorials on this online and I find them not very well explained, complicated and not specific to what I am trying to do.
What did I do wrong??
Can someone explain to me how to do this properly without having to go get a degree?
Thanks

[Q] deodexing and odexing back

I am trying to edit a smali file in the framework.odex file on my stock touchwiz rom.
I first deodexed it with baksmali.jar
I got the "out" folder containing the .smali files which I wanted to edit. Great! right??
Without touching anything in the "out" folder, I attempted to odex back as a test.
I did so using smali.jar and got a my new framework.odex file in the smali/baksmali folder as expected.
However, the output framework.odex file is slightly smaller than the original framework.odex file which makes no sense to me.
The output file caused the device to bootloop when I replaced the original framework.odex file on the device with the one output from smali.jar.
I cannot seem to get a straight explanation on how to do this properly. I do not want to deodex my entire rom when all I need is to change a couple values in the AudioService.smali of my odexed framework.jar.
Can someone please help me deodex this freaking framework.odex file and odex it back so it actually works on the phone. I know I am close and there is a simple step I am missing yet I cannot figure it out to save my life.
Please help!!!!
Cheers!
Mike

values folder missing after recompiling?

Hi all. I was looking for an app on my phone to change around a bit. Just to get the hang of Decompiling and recompiling apks for theming purposes.
So I decided on the LGDownloadsUi.apk & decided to change the text color. I decompiled the apk opened the colors.xml located in res/values and changed the color code to red. Recompiled the apk. I went to move the xml to the original zip. (as I have read is proper procedure) in this case because it's a system app. But the values folder is gone.
I tried moving all of the apk files from the recompiled apk to the original (leaving meta folder). Moved it over to linux to use kitchen to create a app/priv-app flashable. Built then flashed however the rom doesn't boot after flashing. Any ideas of what I'm doing wrong?
More info
Phone name/model: LG G3 d851
Android v: 6.0 MM
Running multirom tried flashing on secondary rom that booted just fine before flashing. Thanks in. Advance guys!
TheLogicalGamer said:
Hi all. I was looking for an app on my phone to change around a bit. Just to get the hang of Decompiling and recompiling apks for theming purposes.
So I decided on the LGDownloadsUi.apk & decided to change the text color. I decompiled the apk opened the colors.xml located in res/values and changed the color code to red. Recompiled the apk. I went to move the xml to the original zip. (as I have read is proper procedure) in this case because it's a system app. But the values folder is gone.
I tried moving all of the apk files from the recompiled apk to the original (leaving meta folder). Moved it over to linux to use kitchen to create a app/priv-app flashable. Built then flashed however the rom doesn't boot after flashing. Any ideas of what I'm doing wrong?
More info
Phone name/model: LG G3 d851
Android v: 6.0 MM
Running multirom tried flashing on secondary rom that booted just fine before flashing. Thanks in. Advance guys!
Click to expand...
Click to collapse
I discovered that you can edit those xml's build the apk, the copy android manifest.xml and meta folder into the build folder. Then rebuild the apk to avoid signature issues. Instead coping the edit xml's into the new apk.

Categories

Resources