yashsingh1/xdaforums huggingface dataset:
[G1 Android Development] timmytim:
Themeing, Please help. Thanks in advance

Hey guys,

Im having issues with this script. I am able to decompile my framework-res.apk fine, make changes to xml files fine but when I recompile I get the errors below in my logs. I have tried themed and stock framework-res' and I made sure to sign them. Everytime I place one into my CWM zip file I get a bootloop.

As a test I decompiled the stock framework-res, did not change anything, recompiled, signed, and flashed and my phone still bootloops. There must be something with the recompile that I am not doing right.

Thanks in advance for the help.

--------------------------------------------------------------------------
|Mon 04/18/2011 -- 15:05:40.33|
--------------------------------------------------------------------------
java version "1.6.0_24"
Java(TM) SE Runtime Environment (build 1.6.0_24-b07)
Java HotSpot(TM) Client VM (build 19.1-b02, mixed mode, sharing)
'adb' is not recognized as an internal or external command,
operable program or batch file.
Could Not Find C:\Program Files\Android\android-sdk\tools\apkmgr\place-apk-here-for-modding\../place-apk-here-for-modding/signedframework-res.apk
Could Not Find C:\Program Files\Android\android-sdk\tools\apkmgr\place-apk-here-for-modding\../place-apk-here-for-modding/unsignedframework-res.apk
I: Loading resource table...
I: Decoding resources...
I: Copying assets and libs...
W: Could not find sources
I: Checking whether resources has changed...
I: Building resources...
aapt: warning: string 'zzzzz_tw_cursor_handle_choosertitle_sharevia' has no default translation in C:\Program Files\Android\android-sdk\tools\apkmgr\other\..\projects\framework-res.apk\res; found: de
aapt: warning: string 'zzzzz_tw_cursor_handle_popup_search' has no default translation in C:\Program Files\Android\android-sdk\tools\apkmgr\other\..\projects\framework-res.apk\res; found: de
I: Building apk file...
[G1 Android Development] $omator:
first of all you do not have adb working with apk manager - rtfm

second of all you might not have proper framework 'attached'
[G1 Android Development] timmytim:
FYI - The OP doesn't have a manual for adding the script to the platform tools folder.

Ok, I added an environment variable for ADB and I dont have that error anymore, however I still get "Could not find sources" and aapt warning: has no default translation.

What exactley do you mean by "The proper framework"? There is only ONE framework-res.apk on my ROM
[G1 Android Development] $omator:
F Y I ;d

no path at Environment Variables set ?

so...

apktool if [...some_file_name...]

at /other/
[G1 Android Development] timmytim:
Thanks for the help, but you lost me here:

I don't know what that means. My best guess is that the signing of the recompiled APK is not working right.

Also, what about this message:

W: Could not find sources
[G1 Android Development] $omator:
http://code.google.com/p/android-apktool/wiki/FrameworkFiles
[G1 Android Development] Archangel:
Ok i know there are a lot of questions here but i have one,, and i am really sorry if it has been asked before. I have a non system apk that all i want to do it change the text coloring to blue so i go into colors after i extracted the apk and decompiled it and i changed the "ff02346ff" in notepad and saved the changes to what i want then when i try to recompile it never works what am i doing wrong please??? Or it compiles then i sign it and install and it either force closes or doesnt load?
[G1 Android Development] Daneshm90:
Firstly dont sign it.

Heres ur best bet :

Decompile (if using 5.0 switch to resources only decompile)

Make changes

Recompile

Say yes twice

Then in keep folder delete resources.arsc

continue with script

Now push framework to phone.
[G1 Android Development] Archangel:
Ok thank you I will give it a try!
[G1 Android Development] timmytim:
Does this also apply to a framework-res.apk? I will need to sign that one though.
[G1 Android Development] Daneshm90:
Oops my bad, didnt read the "non system apk"

In that case definitely sign it.

Here are the modified steps :

Decompile (if using 5.0 switch to resources only decompile)

Make changes

Recompile

Say yes twice

Then in keep folder delete resources.arsc

continue with script

Sign apk

Install apk

Sorry misread his. Yes those steps especially apply to framework-res.
[G1 Android Development] timmytim:
I am using 4.9 so just a standard decompile?

What do you mean by the keep folder? I delete the resources.arsc from the root of the recompiled apk? I thought it needed that file.

**Edit - NM figured it out. Thanks for the help so far. I will post back if I need more :D
[G1 Android Development] Brut.all:
Yeah, but if it uses some private bits then he will get FCs. sharedUserId isn't for fun, it's important. But maybe Launcher doesn't need it, we'll see.
[G1 Android Development] Daneshm90:
And yea just removed tht line from default_workspace and search widget is no longer there.

Hmm thats true Brut.all.

i just looked at other launchers adw, launcherpro n they dont have it so i assumed it'd sorta work without it. But yea if ur havin issues then thats prolly the one to blame ;)
[G1 Android Development] idroid84:
Would I not need android.uid.shared?

I think I found out whats going on, basically I think the Launcher.apk is protected and if this is changed it checks packages.xml file then if fails replaces it with com.android.launcher.apk.

PackageManager( 87): Package com.android.launcher codePath changed from /system/app/Launcher.apk to /data/app/com.android.launcher.apk; replacing with new
[G1 Android Development] Daneshm90:
So far its working fine for me. No issues, try it n see.

But as brut.all says, it serves a purpose.
[G1 Android Development] idroid84:
It worrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrks!!!! I will play now! and see if I get any more errors.

I think that android:sharedUserId="android.uid.shared" could be a "check" for system files and replace if mismatch! Just like windows file scan!!!
[G1 Android Development] Daneshm90:
Nah its a bit more complex if i recall. It has to do with how other apps treat each other and memory usage of those apps. If i recall a app with shared uid never gets closed or something like that and its processes are broken to multiple components to reduce memory usage. W/e why fix something that isnt broken :rolleyes:
[G1 Android Development] idroid84:
ah right, then why removing that line it would work I just don't know. Would like to know though if anyone knows.

However, if there is a solution without removing this line then I would like to hear it.
[G1 Android Development] Daneshm90:
Well u cud build from source and that way it'd have the proper keys and you wudnt have this problem. Im not aware of how to sign with the proper keys without building from source, id like to know if theres a way as well.
[G1 Android Development] Brut.all:
Apps with same sharedUserId can use each others bits, call themselves directly, etc. So if Launcher uses some system apps or some system apps use it, then you will get FCs in some cases.

But I don't see anything "magic" in Launcher, so it's quite probable that it doesn't need this shared user.

update.zip. I say this fifth and last time.

Or maybe sign it with key, that was used for rom building - as Daneshm90 said. But I don't know, whether this is possible.
[G1 Android Development] idroid84:
Update.zip is not the method I would like to use because I want it 'out of the box'. I really do thank you for your assistance though. Much appreciated for your time and everyone who has helped.
[G1 Android Development] Daneshm90:
Hey brut, quick question.

Considering we gotta sign update.zip's and well i use the same keys i sign my apks with, wont it still cause an issue ? cuz an update.zip essentially will just push the file to /data or /sytem wherever u specify.
[G1 Android Development] Brut.all:
Yes, you're right, but... system won't notice, that anything has changed, it won't check signatures :-) This is the trick used by themers and other modders.
[G1 Android Development] Daneshm90:
Correct but thats only for /system apps right ? so im confused as to why one would consider that update.zip pushing a signed apk to lets say /system/app through recovery be less prone to errors than adb pushing it while the phone is booted considering both were signed with the same keys.
[G1 Android Development] idroid84:
So lets say that this is the facts "system won't notice that anything has changed".

Question

What is the correct method to 'step by step' using your apk tools.. lets say for example change an xml file within the .apk. Lets say for the sake Launcher.apk...

Could you write a guide to do this? Do you sign all system files or not sign them as I am alittle confused what apk/zip/update files you have to sign and how to push them to the phone properly. (Maybe expand on your utilities for the update.zip projects to make it an all in one apk/zip/update scripts).

You have really helped me alot understanding the concepts so far throughout this thread. ;)
[G1 Android Development] Brut.all:
If files are signed using same keys, then simple "adb install" should be ok. update.zip trick is for replacing apk with one which is signed using different keys.

What I don't understand is: if most of people use some custom ROMs, then why we don't have their keys? Maybe I'm just wrong and we have them. Wait a sec, I must test something.

Most apps don't use sharedUserId, so this is just: pull, uninstall, decode, modify, build, sign (using any key), install. For system apps look above - maybe I just overcomplicate things and you could simply sign you Launcher using testkeys. Wait a sec.
[G1 Android Development] Brut.all:
Ok, I have pulled random system apk from my CM5.0.8 and resigned it using testsign tool. All digests are the same, so seems keys are same too, but CERT.RSA file is different. Tried to install it, but got INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES, so now I'm confused too ;-)
[G1 Android Development] idroid84:
Interesting find sir. Time to see.
[G1 Android Development] Daneshm90:
Yup its impossible to replicate cert.rsa. Thats where name,email... all tht info about the author who signed it is stored. If we could replicate it then we could officially mod an app, and still receive updates from the market ;)

Theres a connection between the 2 other files that store just the digests and the rsa file, it verifies based on all three.
[G1 Android Development] oMszKikiIzWavyo:
Okay, I Have Windows Vista x32, So Is It Different Or The Same
[G1 Android Development] Daneshm90:
Re: Apk Manager 4.4 - Makes Modifying Ur Apk A Breeze (Windows/Linux)

normally when u install java from java.com it adds it to ur path. if it doesnt, then u gotta add it manually.
[G1 Android Development] Daneshm90:
Hey,

If u select compile,

U get two questions asked.

Second question is a "keep" method where ur original apk gets extracted to a keep directory in root folder. In there u shud delete anything u modified, the script then repacks all that into ur compiled apk. This allows things like androidmanifest to remain consistent and not cause bootloops.
[G1 Android Development] Archangel:
Where do you say yes at? All that was asked was is this a system apk which it isnt?
[G1 Android Development] timmytim:
It's part of the apkmanager script when you compile the apk. It will ask if it is a system file
[G1 Android Development] Archangel:
ok i am confused becuase all i did was make the changes and compile then it asked me whether it was a system apk and i said no and thats it,,,nothing else?
[G1 Android Development] Archangel:
so say yes even though it is not a system apk?
[G1 Android Development] Daneshm90:
Yup....sorry i forgot to mention that.

Yes say yes twice
[G1 Android Development] timmytim:
ugh.... I took a stock framework-res, decompiled it, changed nothing, recompiled and deleted the resources.arsc from the keep folder, resigned it and flashed with the CWM and I still get a boot loop.

I didnt even change anything! Something is wrong with the recompile or signing.
[G1 Android Development] Daneshm90:
Check adb log as to why its bootlooping.

Did u check apkmanager's log to see if any image errors reside ?
[G1 Android Development] timmytim:
Where do I check the ADB log? I'm not using ADB as far as I know. Im just flashing the framework with CWM, im not doing any ADB push or anything.

Here is the apkmanager log from the compile:

|Mon 04/18/2011 -- 20:44:30.22|
--------------------------------------------------------------------------
java version "1.6.0_24"
Java(TM) SE Runtime Environment (build 1.6.0_24-b07)
Java HotSpot(TM) Client VM (build 19.1-b02, mixed mode, sharing)
Could Not Find C:\Program Files\Android\android-sdk\platform-tools\place-apk-here-for-modding\../place-apk-here-for-modding/signedframework-res.apk
Could Not Find C:\Program Files\Android\android-sdk\platform-tools\place-apk-here-for-modding\../place-apk-here-for-modding/unsignedframework-res.apk
I: Loading resource table...
I: Decoding resources...
I: Copying assets and libs...
W: Could not find sources
I: Checking whether resources has changed...
I: Building resources...
aapt: warning: string 'zzzzz_tw_cursor_handle_choosertitle_sharevia' has no default translation in C:\Program Files\Android\android-sdk\platform-tools\other\..\projects\framework-res.apk\res; found: de
aapt: warning: string 'zzzzz_tw_cursor_handle_popup_search' has no default translation in C:\Program Files\Android\android-sdk\platform-tools\other\..\projects\framework-res.apk\res; found: de
I: Building apk file...
The system cannot find the file specified.
[G1 Android Development] Daneshm90:
Yea adb logcat, is wht u need to know whts going wrong.

ive done this countless times n it works....so not sure what the problem is.
[G1 Android Development] timmytim:
Man, I must be doing something really wrong.

Ok, so do I need to be running ADB on my PC when i do all of this? (adb,exe?)

Do I need the phone plugged into USB also?

When I type in adb logcat in the command prompt i get "unable to open log device 'dev/log/main': no suich file or directory
[G1 Android Development] Daneshm90:
Ah ur using a kernel that has adb logging turned off.

U need to turn it on in recovery.
[G1 Android Development] timmytim:
CWM recovery? I dont have any ADB options in my recovery :(
[G1 Android Development] Daneshm90:
Are u running hardcore's kernel ?
[G1 Android Development] timmytim:
Nope Ursa Minor kernel from Andromeda 3. I can switch to Hardcore's. I will do that now.
[G1 Android Development] Daneshm90:
Ok run his, then under speedmod optionsin recovery, go under tweak

U'll find android logging

Turn that on
[G1 Android Development] timmytim:
Done, enabled. Now what?

Thanks by the way! I will owe you HUGE!
[G1 Android Development] Daneshm90:
Now if u have adb setup...

Boot ur phone and run adb logcat

U'll see framework crashing.....

If u want to post it do

Turn off phone

adb logcat >> log.txt

Turn on phone for 1min or so

Then send me log.txt or post it here
[G1 Android Development] timmytim:
Im assuming you mean boot the phone with the bad framework causing the bootloop?
[G1 Android Development] timmytim:
I attached the txt file because it's long. I see the errors at the end but dont know whats causing it.

Had to zip it due to file size, sorry
[G1 Android Development] Daneshm90:
Heres ur error when taken out of context :

Do me a favour, delete apkmanager's log.txt

Take ur original framework, decompile it see if log has any errors.

E/System ( 3290): Failure starting core service

E/System ( 3290): android.content.res.Resources$NotFoundException: Resource ID #0x10b000a

E/System ( 3290):	at android.content.res.Resources.getValue(Resources.java:892)

E/System ( 3290):	at android.content.res.Resources.loadXmlResourceParser(Resources.java:1869)

E/System ( 3290):	at android.content.res.Resources.getXml(Resources.java:780)

E/System ( 3290):	at com.android.internal.os.PowerProfile.readPowerValuesFromXml(PowerProfile.java:147)

E/System ( 3290):	at com.android.internal.os.PowerProfile.<init>(PowerProfile.java:141)

E/System ( 3290):	at com.android.server.am.BatteryStatsService.publish(BatteryStatsService.java:53)

E/System ( 3290):	at com.android.server.am.ActivityManagerService.main(ActivityManagerService.java:1307)

E/System ( 3290):	at com.android.server.ServerThread.run(SystemServer.java:121)

I/SystemServer( 3290): Device Policy

E/SystemServer( 3290): Failure starting DevicePolicyService

E/SystemServer( 3290): java.lang.NullPointerException

E/SystemServer( 3290):	at com.android.internal.content.PackageMonitor.register(PackageMonitor.java:65)

E/SystemServer( 3290):	at com.android.server.DevicePolicyManagerService.<init>(DevicePolicyManagerService.java:217)

E/SystemServer( 3290):	at com.android.server.ServerThread.run(SystemServer.java:246)

I/SystemServer( 3290): Status Bar

E/SystemServer( 3290): Failure starting StatusBarService

E/SystemServer( 3290): java.lang.NullPointerException

E/SystemServer( 3290):	at com.android.server.status.StatusBarService.<init>(StatusBarService.java:466)

E/SystemServer( 3290):	at com.android.server.ServerThread.run(SystemServer.java:254)
[G1 Android Development] timmytim:
THis is the log after decompiling:

--------------------------------------------------------------------------

|Mon 04/18/2011 -- 21:55:29.11|

--------------------------------------------------------------------------

java version "1.6.0_24"

Java(TM) SE Runtime Environment (build 1.6.0_24-b07)

Java HotSpot(TM) Client VM (build 19.1-b02, mixed mode, sharing)

Could Not Find C:\Program Files\Android\android-sdk\platform-tools\place-apk-here-for-modding\../place-apk-here-for-modding/signedframework-res.apk

Could Not Find C:\Program Files\Android\android-sdk\platform-tools\place-apk-here-for-modding\../place-apk-here-for-modding/unsignedframework-res.apk

I: Loading resource table...

I: Decoding resources...

I: Copying assets and libs...
[G1 Android Development] Daneshm90:
Ok try switching apktool to an alternate version

so if on 1.3.1 try 1.3.2...n vice versa
[G1 Android Development] timmytim:
Are you talking about the apktool.bat or apktool.jar?

Also, do you want to try and decompile / recompile, or just decompile and post log?
[G1 Android Development] timmytim:
I was on 1.3.2 and tried 1.3.1 and I still get a boot loop. I am still using the same stock framework from my ROM, decompiled, changed nothing, recompiled, deleted resources.asrc, resigned and flashed in CWM with stock (untouched) twframework-res.

Am I on the right track with those steps?
[G1 Android Development] Daneshm90:
Think so, although its 1am here so i might be wrong :p

I'll continue this 2moor, for 2nite though give this a shot :

decompile with dependancy and drag twframework-res into the script....

then continue wht u were doing before.

L8r
[G1 Android Development] timmytim:
Will do, you're the man (or woman ????) Thanks a ton!
[G1 Android Development] timmytim:
Didn't work :(

I can try the 1.3.2 version with those steps. I will do that tomorrow and report back.

Thanks again
[G1 Android Development] dreamsforgotten:
Don't re sign the framework-res.apk the first yes you answered was do you want to retain the signature so eventhough you have a file called unsignedframework open it the meta inf folder is in tact. Just rename it to framework-res.apk. The system files should all use the same signature
[G1 Android Development] kirbnite:
NO. Do not sign framework-res.apk

That is a system app and system apps do NOT get signed.

The signature for system apps is the META folder and the android.manifest file.
[G1 Android Development] $omator:
god freakin damn it do not switch apktool one with 4.9 is just ok(works for me)

copy STOCK framework-res.apk into /apkmanager_folder/other/

go to apkmanager folder in cmd

then enter /other/ folder

type: apktool if framework-res.apk

and it will work said it to you 3 pages back but you did not listen ;)
[G1 Android Development] timmytim:
Thank you all for the help, I am trying these steps out now.

I'm confused though because some people are telling me sign the framework and others are not.

Also, if I do not sign it should I still delete the resources.asrc from the /keep/ folder?

I am on Windows 7 and I thought that I read a few pages back that this works better on Windows XP. Is there any truth to that?

I cannot thank you guys enough, seriously. I will get through this and when I do I will be able to finish my theme!
[G1 Android Development] timmytim:
I did this. Message says framework-res installed to C:\users\tim\apktool

framework. There is now a 1.apk in the folder.

I reran the script and still get those 2 errors.

Do I need to use option 10 instead and drag that 1.apk into the script?
[G1 Android Development] $omator:
no sorry idk i give up ;)
[G1 Android Development] timmytim:
I don't blame. Thanks for trying.
[G1 Android Development] dreamsforgotten:
All I do is this in 4.9. Put framework-res.apk into place here for modding. Run script type 22, choose the file, then 9 . Mod your file then use option 11. Then delete what I edited in keep. If you edit xmls delete resources.arsc in keep. Then hit enter in the script. Any errors then don't flash it. If no error then rename the file in place here for modding from unsignedframework-res.apk to framework-res.apk. Stuck it in zip and flash. No other folder no 1.apk none of that.
[G1 Android Development] timmytim:
A few posts back I listed some errors. Do you know if those are actual errors or just warnings?

|Mon 04/18/2011 -- 20:44:30.22| --------------------------------------------------------------------------

java version "1.6.0_24" Java(TM) SE Runtime Environment (build 1.6.0_24-b07) Java HotSpot(TM) Client VM (build 19.1-b02, mixed mode, sharing)

Could Not Find C:\Program Files\Android\android-sdk\platform-tools\place-apk-here-for-modding\../place-apk-here-for-modding/signedframework-res.apk

Could Not Find C:\Program Files\Android\android-sdk\platform-tools\place-apk-here-for-modding\../place-apk-here-for-modding/unsignedframework-res.apk

I: Loading resource table...

I: Decoding resources...

I: Copying assets and libs...

W: Could not find sources

I: Checking whether resources has changed...

I: Building resources... aapt: warning: string 'zzzzz_tw_cursor_handle_choosertitle_sharevia' has no default translation in C:\Program Files\Android\android-sdk\platform-tools\other\..\projects\framework-res.apk\res; found: de aapt:

warning: string 'zzzzz_tw_cursor_handle_popup_search' has no default translation in C:\Program Files\Android\android-sdk\platform-tools\other\..\projects\framework-res.apk\res; found: de

I: Building apk file... The system cannot find the file specified.
[G1 Android Development] timmytim:
Good news!

I changed the compression in apk manager from 9 (default) to 0 and was able to decompile and recompile the original framework without changing any files in the framework and flash it with CWM. The phone booted without any errors!

Now I just have to changed the xml's and try it again.

I will report back my finding later this evening.

Thanks again for all of the help guys.
[G1 Android Development] timmytim:
Hmmm, whenever I modify an XML file and follow the above steps I get boot loops :(
[G1 Android Development] dreamsforgotten:
Damn that sucks no errors when you recompile the xmls? Also I believe you stated this is a stock rom? A themed or already edited framework almost always errors
[G1 Android Development] timmytim:
Its the framework from a ROM that a dev built over in the Captivate forums. Are you saying that I need a stock (AT&T) framework to make this work?
[G1 Android Development] timmytim:
Now when I try to recompile I get an error in the apk manager log that says:

"The system cannot find the file specified"

Also, the recompiled framework is about 3-4MB smaller than the original
[G1 Android Development] dreamsforgotten:
Exactly you need a stock one!
[G1 Android Development] sakai4eva:
Am I blind, because I can't see the download link in the OP