[Q] Problem with apks (de)compiled with apktool - Android Q&A, Help & Troubleshooting

I made some changes to my SystemUI.apk, and I pushed it back, then rebooted, only to find my status bar had disappeared.
So, I restored to my backup, and made 4 copies of the SystemUI.apk to try to find out where the problem lay.
Copy 1: No change
Copy 2: Decompiled and Compiled with apktool. No other change.
Copy 3: Decompiled with apktool. Changed one png. Compiled with apktool
Copy 4: Decompiled with apktool. Edited text in strings.xml and changed a few colours. Compiled with apktool.
Out of these 4, only the first one worked. The rest had my status bar gone. Hence I have arrived at the conclusion that something had gone wrong in either the compiling or decompiling stages. I didn't sign the apk because I read that system apps should not be signed.
Just to make sure, these were the steps I took.
1. Retrieve SystemUI.apk, framework-res.apk, and SemcGenericUxpRes.apk
2. Install frameworks with apktool
3. Decompile SystemUI.apk
4. Make any changes
5. Compile
6. Place on SD card
7. Change \system\ to be RW
8. Copy SystemUI.apk from sd card, and overwrite the one in \system\app
9. Ensure permissions are set to rw-r-r (644)
I have not much idea what else could have gone wrong, but then again, I'm just a newbie who follows others' guides and might have missed out on doing something. Perhaps some kind soul would be able to point that out?

Well, apktool is using smali/baksmali to compile/decompile classes.dex/apk_name.odex file.
The problem can occur when you use different baksmali version when you decompile and also not the right version to compile (as the system expects it to be). You can also experience issues if the apk is not zipaligned properly (check down who to do that)
apktool has the smali/baksmali code inside it so you will need to get the newest version for it for JB for example.
You can check why the status bar is not there when you monitor the logcat and look for DEX related logs in the beginning.
You can also use smali/baksmali on your own: http://code.google.com/p/smali/wiki/DeodexInstructions
and just place the generated classes.dex in the apk
then zipalign -f 4 filein.apk fileout.apk (http://developer.android.com/tools/help/zipalign.html)
then push back fileout.apk (sytemui.apk in your case)

Related

Basic Theming Steps in Order - Krad

For my reference for newer builds....
1. Services.odex modify via smali baksmali - About 5-8 steps taking about 5 minutes
2. Cook framework with Kitchen - About 5 minutes
3. use apkmanager to decompile framework-res.apk and alter status_bar.xml with FF000000 to FFFFFFFF - About 15 minutes
4. recompile apkmanager with system and extra files
5. remove the files edited in keep folder and resource.arsc
6. compile
7. take new status_bar.xml and copy into modfied kitchen zip from step 2
8. test to see if new colors stick
9. Open older modified framework and copy mdpi folder contents to kitchen zip
10. Open HDPI folder on older framework modified and copy only battery files to new kitchen framework.
11. Should have colors and graphics in place to flash to phone for testing.
12. All went well you are done.
Tools needed
7-zip
Java
ADB
Smali
Baksmali
AndroidSigner - thanks to Jhott
apkmanager - thanks to Jhott
Nice work mate im sure it will help a lot

[Q]Problem after changing AndroidManifest.xml

Hello Guys and Galls,
I want to change the background of Settings.apk from black to white. I use the FroyoMod Rom http://forum.xda-developers.com/showthread.php?t=815595.
If change
Code:
<application android:label="@string/settings_label" android:icon="@drawable/ic_launcher_settings" android:taskAffinity="">
to
Code:
<application android:theme=[COLOR="Red"]"@android:style/Theme.Light.NoTitleBar"[/COLOR] android:label="@string/settings_label" android:icon="@drawable/ic_launcher_settings" android:taskAffinity="">
in AndroidManifest.xml.
I use ApkManger to decompile and compile. The (de)compiling is without any errors.
After compile with ApkManager i do the follow:
- open original Settings.apk and unsignedSettings.apk with 7-zip
- delete AndrodManifest.xml in original Settings.apk
- copy AndroidManifest.xml from unsignedSettings.apk to original Settings.apk
- copy the modified original Settings.apk to the phone in /system/app
- chmod 644 Settings.apk
- chown root:root Settings.apk
So now if I start Settings nothing happens, nothing, not even an fc.
This is was logcat says:
Code:
com.android.settings has no certificates at entry AndroidManifest.xml
What I´m doing wrong?
Try one of the many apk re-packaging tools on this forum. Ive used apktool but there are some front ends built for it
From something awesome
killersnowman said:
Try one of the many apk re-packaging tools on this forum.
Click to expand...
Click to collapse
tigger-gg said:
I use ApkManger to decompile and compile.
Click to expand...
Click to collapse
By the way if I change any other xml file in /res there are no such problems.
tigger-gg said:
I use ApkManger to decompile and compile.
Click to expand...
Click to collapse
dur
i read this on the mobile and did not see that....
solving the problem? because I would be interested
Me too, I'm having a problem recompiling an AndroidManifest.xml with apkmanager 5.0.1., it won't install unless I use an original AndroidManifest.xml file first, then I can flash right over it. At first I thought it was a the change I made in the file, but I just decompiled and compiled an unmodified version, and it did the same thing. So its the compiler.
Settings.apk is a signed system app. It will refuse to run unless signed by the same key as the rest of the system apps. Just replacing a single XML in the APK will cause a signature mismatch.
Best bet? I'd say make your change, then use a kitchen like dsixda's to resign the whole system with the test key (I think this is a menu option).
Yep your whole system has to have the same signature. I did this edit for a rom a while back, but I made the settings transparent instead of white background by using Theme.Wallpaper.NoTitlebar. Just sign your whole rom together with testkeys and all should be good until another system app gets changed/modified and the signatures don't match again.
Sent from my PG06100 using Tapatalk
Thanks to Gene Poole and one_love_420, I will try your instructions.
If your after quickly signing a whole load of apk's, I wrote a command line front end to do all the hard work for you.
You can even generate your own private key.
Questions or Problems Should Not Be Posted in the Development Forum
Please Post in the Correct Forums
Moving to Q&A
BUMP to top
Please big problem been fighting for weeks
any one know anything about this!!
So anybody find a solution yet? Seems to be the binary text conversion.
It is the signitures in manifest.inf fyi

[Q] Help me! Modify CMParts.apk lead to FC!

When I modify the CMParts.apk's ../res/values-zh-rCN/strings.xml,
It lead to a bug, a CM setting option will Force Close;
CyanogenMod settings->Interface->Notification power widget->Widget buttons->Brightness modes,
Brightness modes will FC, can anyone help me?
These are my steps to modify the CMParts.apk:
1. install JRE;
2. download the apktool1.4.3 from code.google.com;
3. use "apktool d CMParts.apk" to decompile CMParts.apk;
4. modify ../res/values-zh-rCN/strings.xml, edit the string"警告:前面有怪兽!" to "警告!", in line 356;
5. use "apktool b CMParts CMParts1.apk" to compile modified files;
6. use CMParts1.apk's resources.arsc to replace CMParts.apk's resources.arsc;
7. copy CMParts.apk to /system/app, and grant it all permissions.
Any other CM settings work well;
the string"警告:前面有怪兽!" is be change to "警告!" succeed.
My OS is Win7(32bit), Used tools is apktool 1.4.3;
Sorry my English, My English is so poor;
Can anyone help me? Thx.^*(- -)*^
this ploblem is sloved, plz look 5th floor.
Nobody can help me? :-(
I've modded a few apks and im pretty sure you have to delete the new resources.arsc (the one from the project folder) before recompiling or it won't work, that could be why you get fc.
Also did you copy your modified XML to the new project folder too?
Sent from my HTC Legend using XDA App
but, when compile the modified xml,
the modified xml is not exist in CMParts1.apk,
and i replace the resources.asrc,
the string which i wanna modified is changed,
to puzzle me, the xml which lead to fc, is not the strings.xml,
In my opinion, it should be in /res/values/X.xml.
Sent from using XDA App
the cmparts.apk cant be decomplied by apktool or other tools,
if modify, should be modify the Source Code from CyanogenMod,
that's all.

howto de/compile systemui.apk without any error

Hello,
I wanted to de/compile the systemui.apk and got errors.
I installed framework-res.apk with apktool.
After installation I used apktool (Win7) and decompiled the systemui.apk.
But I got the same errors as many others have gotten them.
brut.blahblahblah..
So I tried other apktool.jar (apktoolICS.jar) and it worked fine!
I opened the new systemui folder and there are the following folders:
res and assets
no smali folder. is it right and normal?
Because the compiling with old apktool (not apktoolICS) didn't work, I compiled with the ICS file and it worked. I got the translation message (airplane_mode).. Not interesting for me atm.
When I look at the new built systemui.apk, I wondered about the file size.
The new file: 1.009kb
The old file: 1.338kb
I signed the new file. Now the file size is 1.044kb.
I edited only a xml file (styles.xml)..
The file didn't work on the sgs2..
Could someone tell me what I did wrong?
Please help me
Best regards
Marcus
*push* after moving to correct section
maybe no need to sign your new file,
try to drag the META-INF folder and the AndroidManifest.xml from the older file to the new file you build
BTW, is your old systemui file a deodex one?
if no deodex, the smali code wil include in the odex file~

Beginner Battery MOD Question

Im beginning to learn a few basics about modding the systemui.apk.
I can use the AUTO APK TOOL to decompile my SystemUI.apk, decompile the classes.dex file into smali code, use dex2Jar & jd-gui to view the classes.dex file in java.
As a project for teaching myself about the android system i'm looking into modding the battery icon. I have followed a few guides/tutorials and have a basic knowledge/understanding on what files to change/add in SystemUI.apk (stat_sys_battery.xml, stat_sys_battery_charge.xml, battery-con png files in 'drawable-xhdpi', then recompile and push to my phone (SGS3).
My questions are:
1. Do all Mods that change system settings/layout have to be baked into the SystemUI.apk? Or in this example is it possible to develop a small application using Eclipse, which when a button is clicked it change's the battery icon dynamically?
Hope it makes sense

Categories

Resources