[GUIDE] Decompile/Theme GingerBlur Framework - Atrix 4G Themes and Apps

Hey everyone! I've created a guide for themers that shows step-by-step how to decompile and recompile the GingerBlur framework-res.apk. With GingerBlur 4, decompilation and recompilation can be done without any errors. This should make it significantly easier to theme my ROM.
http://briefmobile.com/how-to-theme-gingerblur
If you're unclear on how to do something, you should ask me below and I'll write more to the guide. In the future I'd like to add these to the guide:
Step-by-step "How To" create a theme like GingerBlur
How to edit .9.pngs properly
How to create flashable .zip's
How to change text/menu colors
Make sure to throw your suggestions below!

You sure do alot for someone with limited time..... Thanks
Sent from my MB860 using Tapatalk

Gvndeb60 said:
You sure do alot for someone with limited time..... Thanks
Sent from my MB860 using Tapatalk
Click to expand...
Click to collapse
I love phones. And I love the people on the Atrix forums.

geez, man. could you do me a favor and let me know what phone you go to next. thanks for the guide too.

chaosjh said:
geez, man. could you do me a favor and let me know what phone you go to next. thanks for the guide too.
Click to expand...
Click to collapse
Not sure quite yet. We'll have to see what AT&T comes up with.

kennethpenn said:
Make sure to throw your suggestions below!
Click to expand...
Click to collapse
Any idea why the BlurDialer never decompiles correctly? Will there be a fix for that?

gera4ever94 said:
Any idea why the BlurDialer never decompiles correctly? Will there be a fix for that?
Click to expand...
Click to collapse
I'm not quite sure why Moto failed at creating the BlurDialer.apk. Don't expect a fix on Froyo. Maybe it'll be fixed on 2.3 Gingerbread.

Ok, so I'm not to familiar with themeing, but I figure replacing a few .png files in the drawable-hdpi folder can't be to hard... But every time I try re-compiling the framework-res.apk, I get multiple errors all having to do with the public.xml file, which I didn't touch.
I de-compile the apk just fine, replace the .png files with different ones (same names), and then get the error upon re-compiling. And then nothing appears in the build folder at all. Any thoughts??? Any help would be much appreciated. Thanks.
**Edit**
When I run the cmd to compile the framework-res folder, I get:
W: Could not find sources
I: Building Resources...

Swiftks said:
Ok, so I'm not to familiar with themeing, but I figure replacing a few .png files in the drawable-hdpi folder can't be to hard... But every time I try re-compiling the framework-res.apk, I get multiple errors all having to do with the public.xml file, which I didn't touch.
I de-compile the apk just fine, replace the .png files with different ones (same names), and then get the error upon re-compiling. And then nothing appears in the build folder at all. Any thoughts??? Any help would be much appreciated. Thanks.
**Edit**
When I run the cmd to compile the framework-res folder, I get:
W: Could not find sources
I: Building Resources...
Click to expand...
Click to collapse
Could you read out some of the errors?
Most .png files can be replaced within WinRAR or 7zip without decompiling the framework. Only ".9.png" files need decompilation and recompilation.

when decompiling i get this:
apktool d -f framework-res.apk
Code:
I: Loading resource table...
I: Loaded.
I: Decoding file-resources...
W: Cant find 9patch chunk in file: "drawable-hdpi/statusbar_background.9.png". R
enaming it to *.png.
W: Cant find 9patch chunk in file: "drawable-hdpi/title_bar_portrait.9.png". Ren
aming it to *.png.
I: Decoding values*/* XMLs...
I: Done.
I: Copying assets and libs...
that means it doesnt decompile correct the .9.png files?
when compiling, with minor changers in .9.png files i get these errors:
Code:
C:\FIXblur\framework-res\res\values\public.xml:3604: error: Public symbol drawab
le/sym_keyboard_space declared here is not defined.
....
le/tab_selected_bar_left_v4 declared here is not defined.
C:\FIXblur\framework-res\res\values\public.xml:3614: error: Public symbol drawab
le/tab_selected_bar_right declared here is not defined.
.....
.....
C:\FIXblur\framework-res\res\values\public.xml:3657: error: Public symbol drawab
le/zz_vzw_stat_sys_roaming_cdma_custom3 declared here is not defined.
btw the java jre i have is
Windows x64 16.09 MB jre-6u25-windows-x64.exe
(on my x64 win7)

Paschalis said:
when decompiling i get this:
apktool d -f framework-res.apk
Code:
I: Loading resource table...
I: Loaded.
I: Decoding file-resources...
W: Cant find 9patch chunk in file: "drawable-hdpi/statusbar_background.9.png". R
enaming it to *.png.
W: Cant find 9patch chunk in file: "drawable-hdpi/title_bar_portrait.9.png". Ren
aming it to *.png.
I: Decoding values*/* XMLs...
I: Done.
I: Copying assets and libs...
that means it doesnt decompile correct the .9.png files?
when compiling, with minor changers in .9.png files i get these errors:
Code:
C:\FIXblur\framework-res\res\values\public.xml:3604: error: Public symbol drawab
le/sym_keyboard_space declared here is not defined.
....
le/tab_selected_bar_left_v4 declared here is not defined.
C:\FIXblur\framework-res\res\values\public.xml:3614: error: Public symbol drawab
le/tab_selected_bar_right declared here is not defined.
.....
.....
C:\FIXblur\framework-res\res\values\public.xml:3657: error: Public symbol drawab
le/zz_vzw_stat_sys_roaming_cdma_custom3 declared here is not defined.
btw the java jre i have is
Windows x64 16.09 MB jre-6u25-windows-x64.exe
(on my x64 win7)
Click to expand...
Click to collapse
Make sure you're decompiling GingerBlur 4. Only GB4 has my new-and-improved framework-res.

If you have the android sdk installed, it's version of aapt might be causing conflicts depending on the version of apktool being used. Since apktool just grabs the first one it finds in it's path, keep an eye on that. For linux, there is no way to set the path for apktool, the code just calls aapt, to be found wherever on the system visible from within java, no shell PATH changes have any affect. I have a custom version I did up to force the location of aapt via command line option.
If you are using .9.png files, make sure they are .9.png files and not just regular files with that extension. Apktool is like Santa Claus, it can tell when you are being naughty or nice.
All the small xml files like strings.xml are jumbled together in resources.arsc, all the identifiers in your statusbar.xml etc are decoded and reassigned when apktool recompiles them. So keep a copy of your mods outside of the apk as backup, you might not be able to extract them exactly as you modified them. If you reference new drawables, make sure those files exist somewhere in the apk folder before compiling as well.
Cheers!

Ok, so I've never themed Android before, but I'd be interested in playing around with the option, there are a few questions I have though.
1) Do you have a downloadable framework-res.apk or do I need to just pull it via adb (I know how to do this, I was just wondering)?
2) If I push the new framework-res.apk what is the risk of getting the boot loop of death that tends to happen if you incorrectly theme a ROM?
3) If I were to be caught in a BLOD would that mean that I would need to restore via an sbf and start all over again or could I still access Tenfars CWM somehow during the boot process and restore to the last Nandroid backup?
4) Should the device be wiped before testing a theme, or is it OK to just push the new framework-res.apk over the existing without wiping?
I'm sure I will have more questions in the future. I just got apktools running on my Mac, but don't have much time at the moment to fiddle around with it. I'm a newbie when it comes to this stuff, but I do know enough to feel comfortable working with these files.
I want to thank you in advance, theming Android devices is something I've wanted to learn how to do since I started using Android and I look forward to dabbling with it. I also look forward to the information in the guides you list as wanting to write in the future. You are awesome kennethpenn.

I don't know who invented this .9.png file thing, but it's the stupidest thing I've ever encountered... so frustrating... ggrrr

lostinbeta said:
1) Do you have a downloadable framework-res.apk or do I need to just pull it via adb (I know how to do this, I was just wondering)?
Click to expand...
Click to collapse
You can grab it from the GingerBlur CWM update zip. It is inside /system/framework.
lostinbeta said:
2) If I push the new framework-res.apk what is the risk of getting the boot loop of death that tends to happen if you incorrectly theme a ROM?
3) If I were to be caught in a BLOD would that mean that I would need to restore via an sbf and start all over again or could I still access Tenfars CWM somehow during the boot process and restore to the last Nandroid backup?
Click to expand...
Click to collapse
If you keep a copy of GBlur on your sd then you can usually use CWM to recover from a BLOD. You may have to: disconnect from all power - pull the battery - with battery out plug into AC - CWM will start and you can reflash the working GBlur zip
lostinbeta said:
4) Should the device be wiped before testing a theme, or is it OK to just push the new framework-res.apk over the existing without wiping?
Click to expand...
Click to collapse
Since a theme is basically image modifications there is no reason to wipe. To go fresh after applying a theme flash the DeOdexed CWM zip.

Thank you for the info nottach, all seems pretty easy (I had already pulled the framework-res.apk from my phone, but I have the GB4 zip on my computer in case I need more copies).
There doesn't happen to be some sort of emulator for this is there? lol. I highly doubt there is, but it seems rather daunting to change a file, push the framework-res.apk then have to restart to see if the change was successful. All part of the game though, can't always expect things you aren't really supposed to be doing in the first place to be easy.

lostinbeta said:
Thank you for the info nottach, all seems pretty easy (I had already pulled the framework-res.apk from my phone, but I have the GB4 zip on my computer in case I need more copies).
There doesn't happen to be some sort of emulator for this is there? lol. I highly doubt there is, but it seems rather daunting to change a file, push the framework-res.apk then have to restart to see if the change was successful. All part of the game though, can't always expect things you aren't really supposed to be doing in the first place to be easy.
Click to expand...
Click to collapse
No problem, the more themes the better.
I dont think there is an emulator, but there is an app that supposedly restarts the framework-res.apk. Ive never used it so I can't say if it works. Basically I'll make a ton of notes about changes that need to be made then ill carefully do one at a time. I always keep the latest few working versions of my themes on my sd while creating in case something goes wrong.
Heres the app i was talking about incase youre brave.
http://forum.xda-developers.com/showthread.php?t=1028541

Ok, moment of truth... de-compiled & re-compiled framework-res.apk, changing multiple 9.pngs as well as normal .pngs... no errors on de-compile or re-compile... flashing now... Come on, no boot loop, no boot loop...
**Edit**
Success... thank God... think I got it down now... just takes some trial & error when beginning.

So for anyone interested, here is a little tidbit that is pretty useful on how the whole .9.png (Or 9 Patch images) work in android.
http://developer.android.com/guide/topics/graphics/2d-graphics.html#nine-patch
It helps understanding how to edit them.
It reminds me of the Scale9 method in actionscript (sorry, I used to be a web developer and actionscripter so I try and relate new code and methods to what I already know to understand them better).

So i googled how to theme Gingerblur and got the link you posted. I then became a member of this site for some clarification on the instructions and upon searching, i found this post which is pretty sweet. Anyways, back to the question.
I understand all the commands, seem pretty simple, except for step 2. Is this the actual theme file you're referring to? If so are there any restrictions to what theme I can use, or do only certain ones work with this rom?
Thanks in advance!

Related

newbie question -de/recompile androidmanifest.xml

OK, I've been working on my rom and for the most part its actually going really well - I've got it working fast, gsync is working, blah blah
I've run into a permission problem though, and I need to edit HTCDialer.apk's AndroidManifest.xml file to include a new permission line. Sadly, I haven't figured out how to do this on my own (I've been android devving for about 2 weeks now... maybe 3, i forgot haha).
How do I decode those androidmanifest.xml files?
Secondly - I've also tried making other changes to .apk files and using autosign.bat to resign them, but half the time my changed apk's never work. The apps just don't work or appear in my app list, and logcat says something about apk uid signatures not matching, so I ran "fix apk uids" from recovery but that didn't help either. i don't think my apk changes are being signed properly.
Is apktool what you're after?
YES! OMG thank you. I had thought they were just .dex'd xml files so I tried baksmali but I kept getting top level errors. apktool worked perfect for me, got apst whatever baksmali error I had and did it just fine. You're awesome, thanks!
Aeltrius said:
YES! OMG thank you. I had thought they were just .dex'd xml files so I tried baksmali but I kept getting top level errors. apktool worked perfect for me, got apst whatever baksmali error I had and did it just fine. You're awesome, thanks!
Click to expand...
Click to collapse
could please help me?
i would like to decode a exisisting apk to edit the androidmanifest.xml just a little bit to my personal need. somehow the apk tool just leads to an error everytime. when i just unpack the apk and edit the xml-file its of course crypted.
could you give me a explanation of how to just edit the androidmanifest.xml of an exisiting apk and package the apk again?
apktool d name.apk out
(now edit the androidmanifest.apk in out directory)
apktool b out
now you have to SIGN the out.apk that is in /out/dist directory

[Q] APK Manager Still Can't Remove Clock

I'm trying to remove the clock from my status bar without installing ("flashing?") any custom mods.
I know that this has been discussed before, and that there are many threads on the topic already. But I didn't want to necro any old threads, and I've scoured the Internet reading at least two dozen threads (both on this forum and other forums, and doing many Google searches) on doing this. I still can't do it. I'm a complete noob when it comes to Android.
I finally managed to download and install APK Manager v4.9 and APKTools (I don't even know the difference between the two...) and set my PATH variables.
Then I read up on how to decompile. But here's the problem. The threads/tutorials I read all say to edit some smali file located at
Code:
smali\com\android\systemui\statusbar\Clock.smali
But after I decompile with APK Manager, I don't see any smali file at all! All I see is what's in the attached image.
How do I edit that which does not exist? Or did I decompile something incorrectly? I've also attached my log file just after I decompiled SystemUI.apk.
Well instead of looking for smali files, I read that I could accomplish the same thing by editing status_bar.xml. So I did that.
But now I'm having trouble re-compiling using APK Manager. My log file reads
--------------------------------------------------------------------------
|Wed 12/21/2011 -- 18:35:22.59|
--------------------------------------------------------------------------
java version "1.7.0_01"
Java(TM) SE Runtime Environment (build 1.7.0_01-b08)
Java HotSpot(TM) Client VM (build 21.1-b02, mixed mode, sharing)
I: Framework installed to: C:\Users\Jay\apktool\framework\2.apk
I: Loading resource table...
I: Decoding resources...
I: Loading resource table from file: C:\Users\Jay\apktool\framework\1.apk
I: Copying assets and libs...
W: Could not find sources
I: Checking whether resources has changed...
I: Building resources...
aapt: warning: string 'quickpanel_dc_text' has no default translation in C:\Users\Jay\Desktop\apk_manager_4.9\other\..\projects\SystemUI.apk\res; found: ko
I: Building apk file...
The system cannot find the file specified.
Could Not Find C:\Users\Jay\Desktop\apk_manager_4.9\place-apk-here-for-modding\signedunsignedSystemUI.apk
Could Not Find C:\Users\Jay\Desktop\apk_manager_4.9\place-apk-here-for-modding\unsignedunsignedSystemUI.apk
The system cannot find the file specified.
The system cannot find the file specified.
The system cannot find the file specified.
'7za' is not recognized as an internal or external command,
operable program or batch file.
'7za' is not recognized as an internal or external command,
operable program or batch file.
The system cannot find the file specified.
Click to expand...
Click to collapse
This is what the log looks like after I attempt to recompile and then zipalign.
The strange thing is that if I decompile then immediately recompile without changing anything, I still get the same error "W: Cannot find sources." Furthermore, the SystemUI.apk that is output is much smaller than the original.
What files am I missing, exactly?
I know you said you wanted to avoid flashing anything but I would honestly recommend you consider jkays mods.
You can root your phone with one of chainfires cfroot kernels which are essentially stock with root and CWM.
Then flash the stock jkay theme. Everything at this point will be pretty normal like before.
Now you can use jkay deluxe app to do lots of great things and removing the clock is one of them.
I know it sounds like a lot but trust me everything I've said to do can be done in a few minutes once you have downloaded the various things.
Sent from my GT-I9100 using XDA App
Thanks for the reply. There are two things that are keeping me from flashing my phone.
I don't know how to do it (yet). I'll probably read up a little on it, but I'm brand new to Android.
I read that flashing a custom ROM will increase a flash counter which will void any warranty. Furthermore, this appears difficult to reverse.
I just figured that if I want to change one small thing I might as well try to decompile/recompile and learn something. But if doing that is really this difficult, then maybe you're right and I will consider installing a custom ROM.
I could really use some expert advice. This stuff makes my eyes roll, haha.
The way I suggested is still keeping your stock Rom.
If you want to post the details of your current firmware and phone I am happy to step you through the process.
There are significant benefits to rooting your device but like you said your flash counter may increase so a jig from ebay for a couple of bucks is handy.
Sent from my GT-I9100 using XDA App
I have a Samsung SGH i777-UCKH7 running Android version 2.3.4. I read on this thread
http://forum.xda-developers.com/showthread.php?t=1311081
that you can flash custom ROMs without increasing the counter. What exactly is jkay mod? Is it a kernel or a ROM?
Bummer. At the moment jkays Stuff is only for the I9100 sorry.
Sent from my GT-I9100 using XDA App
Well thanks for posting anyway
But can anyone help me figure out as to why I'm getting errors when compiling? Did I post this in the wrong forum?
Bump. Just need someone to look at the log...

Help work out bugs in CM9/10/sense4/aokp- smali/baksmali and more to come..

How can I contribute to development?
Post #1 is a tutorial for how to decompile/recompile jar files to help with the project.
Post #2 will have information on how to pull a proper logcat and how to post your logcat
___________________________________________________________________
I'll write up a quick little guide for smali/baksmali that can be used with the previous resource I posted.
First, windows will work just fine. You will have to install the java JDK(not sdk, you can have both however), this is straightforward, just google and follow directions.
Next, download http://smali.googlecode.com/files/smali-1.3.2.jar and http://smali.googlecode.com/files/baksmali-1.3.2.jar (both are also attached)
If you can already type "adb" in the command prompt of windows, then the path was set for the tool.. find where you have ADB at, and paste those files into the same directory. If not follow the directions in the following quote, except you will be putting the above downloaded files in the directory you chose.
There's two simple ways to get there:
1 way = click Start > Control Panel > System icon.
2nd way = click the Start button, right-click “My Computer”(Computer for Vista/7) and select “Properties”.
If your using XP, your there. If your using Vista/7, click on Advanced system settings on the left side.
You should now be in the System Properties window.
Click on the Advanced tab.
Click on the Evironment Variables... button
In the System variables(lower box), scroll through the list until you see Path under the Variable column.
Click on it to highlite it, click on the Edit... button.
We are going to add our path to adb, where we installed the SDK, in the Variable value: box.
Make sure your cursor is at the end of the last entry, and type this:
;C:\android\tools\
Click to expand...
Click to collapse
Press the windows button or click start button, type cmd and press enter(to open command prompt), and type "java -jar baksmali-1.3.2.jar -o out/rogers/dexout/rogers-classes.dex" and see if the error it gives you shows you that there is no "rogers-classes.dex" file, if so then you've done everything right thus far.
Now you should look at the resource I had posted before, so you don't have to search, here it is again http://rootzwiki.com/topic/19262-protip-getting-data-working-on-that-epic-port-you-just-did/
For this example, look under where it says "Data:", I am going to do what it says for the framework.jar file. Jar files are basically zip files, rename framework.jar to framework.zip, then unzip it with whatever program you use, making sure you know where it is located. Do this for BOTH the cm9 rom, and also with the stock rom(we should be able to use any rom we currently have, ARHD, energy, speedrom, etc). I would name the stock rom zip folder "base" and the cm9 zip folder "port", so you can keep track easily.
If you have followed along this far, you will have a file called classes.dex, this will be what we are decompiling for both cm9 and stock, then we will copy files as needed, and recompile just the cm9 classes.dex, so again, pay attention to which is which, and what the path is. Ignore the other file that was unzipped for now, just know when you rezip it, you have to replace the original classes.dex file and zip it up with the other file that it was unzipped with.
So lets say this is the result, I have a folder c:\android\porting\base folder that contains a classes.dex file, and a c:\android\porting\base(I renamed the unzipped folder after I unzipped each) that also contains a classes.dex file.
Here is a post that explains what we are about to do if you need a reference. http://forum.xda-developers.com/showpost.php?p=4152564&postcount=2
To decompile(if you correctly installed the java jdk and set the path correctly for baksmali/smali) you would type this in:
Code:
java -jar baksmali-1.3.2.jar -o out/base locationOFyour/classes.dex
the "out/base" is where it will put the output files, in a directory called OUT in your USER folder. Quick protip if you are unsure how to type in the location of the classes.dex file, just type in "java -jar baksmali-1.3.2.jar -o out/base" and then DRAG the classes.dex file from your file explorer to the command prompt window, and IT will put the correct path(it should be something like ~/android/porting/base if I remember correctly). I am working on OSX, so you may have to do this if the example isn't helpful enough. Protip #2: Write all this $h*t down! Create a text document with every step you do, then you can just copy/paste the line above, and modify it as needed- this also helps keep track of what you are doing- aka a changelog.
If you followed protip #2 above, copy the same command you just typed in, but change where it says "base" in the path, to "port". If you have two folders in your OUT folder, one called base, and one called port, you have done everything correctly thus far.
Since this is an example, this is what the resource I posted above on rootzwiki says to do with the result output files:
android/net - the ConnectivityManager classes and interfaces as well as all the NetworkStateTrackers.
android/telephony
com/android/internal/telephony
Click to expand...
Click to collapse
So basically I am just copying everything from the above folders from my BASE, to the PORT, overwriting each file in the port. Once done, you will type this:
Code:
java -Xmx512M -jar smali-1.3.2.jar out/port -o new-classes.dex
This is because we are recompiling the files in our PORT, and it will create a file in the root of your USER folder called new-classes.dex. Rename the file classes.dex, unzip the CM9 framework.jar and replace the original classes.dex, rezip it, then rename framework.zip to framework.jar.
This concludes the tutorial. Once you have everything setup, if you follow protip #2, the matter of baksmali/smali is a quick copy/paste into command prompt, so modifying a jar file will take less than 5 minutes. Push the resulting jar file into the appropriate folder on your phone, reboot your phone, run a logcat(I have a good guide linked in the BIBLE in my signature how to logcat like a pro), and see if data(for this example, you could be working on GPS or whatever) is working any better.
Protip #3: You've just learned quite a bit, the same can be done to most apk's- rename whatever.apk to whatever.zip, unzip it, then baksmali the resulting classes.dex file- this is how many programs are backported to older versions of android, hacked, etc. If you want to see the simple edit that was made to the ext.jar using this same process that got data working, you can see it here: http://forum.xda-developers.com/showpost.php?p=25786037&postcount=13
If anyone wants to try to push the file I just created and attached, feel free.. if you have major issues, create a logcat, if not, post your result. My changelog:
In android/net I copied over ConnectivityManager.smali and each file beginning with "NetworkState"
In android/telephony I copied over all the files
There was no com/android/internal/telephony directory, so it was skipped
Click to expand...
Click to collapse
This is all I have time for at the moment, I have to go to work soon so I cannot test the file.. this tutorial took a bit to do, so I am hoping someone at least gives it a try to make it worth my time. I can give some assistance, but would prefer that if it is something you can figure out on your own with some basic googling, please do so.
I will update on different methods to pull a proper logcat in the near future, for right now please post what rom you are on, and what you expect the log to contain such as "I was enabling data"..
Also reserved just in case
As posted in the previous thread, there are probably 250+ more constants in the base rom than there is the in the cm9 RILConstants.smali file. Are these the kinds of glaring differences we need to look for, or is this just the difference between sense/aosp...
I'm pushing your framework.jar and seeing how it works out. I'll get back to you in a moment.
Just boot loops...
Hey, just wanted to throw this out there. I found an amazing studio that makes digging around in apk and jar files incredibly easy to do.
You can check it out here - http://www.virtuousrom.com/p/ten-studio.html
I haven't tried any jar files with it but it says they are supported. Might be worth checking out.
Ok I just tried switching it our with your framework.jar and it got to upgrading the 82 apps now it's stuck in a bootloop after that
Sure wish we could get some if those Kats over here. The virtuous team always had something cool for the g2
Sent from my HTC_Amaze_4G using xda app-developers app
craigtut said:
Hey, just wanted to throw this out there. I found an amazing studio that makes digging around in apk and jar files incredibly easy to do.
You can check it out here - http://www.virtuousrom.com/p/ten-studio.html
I haven't tried any jar files with it but it says they are supported. Might be worth checking out.
Click to expand...
Click to collapse
Yep, I saw that and saved it to my read it later account.. but I never even boot into windows anymore, lol. If someone wants to try it out, if it streamlines things.. would definitely be pretty awesome. I didn't know it did jars, I thought it just did apks.
Learning how to do it still has its own value I think tho Thanks for sharing craig
bos2333 said:
Ok I just tried switching it our with your framework.jar and it got to upgrading the 82 apps now it's stuck in a bootloop after that
Click to expand...
Click to collapse
I noticed afterwards that I included a few too many files, I should have done just the one file rather than 3.. I think we will have much more success by making single changes, seeing if it improves things, or at LEAST continues to boot, rather than making broad sweeping changes.
Even if it gets stuck in a bootloop, see if it will post a logcat, the errors it puts out will help figure out what was too much.
Also, I think the mentioned guide would be MUCH more direct for porting sense4- as both have all proprietary htc files, and therefor the different flags in the smali file will help a ton.. as far as porting cm9, we will likely have to be much more concise about the changes- it likely won't take much, just a few changes here and there.
bos2333 said:
Ok I just tried switching it our with your framework.jar and it got to upgrading the 82 apps now it's stuck in a bootloop after that
Click to expand...
Click to collapse
Here's the logcat from replacing framework.jar with the one you supplied...I had to zip it though because it's too big apparently
Silentbtdeadly said:
Yep, I saw that and saved it to my read it later account.. but I never even boot into windows anymore, lol. If someone wants to try it out, if it streamlines things.. would definitely be pretty awesome. I didn't know it did jars, I thought it just did apks.
Learning how to do it still has its own value I think tho Thanks for sharing craig
Click to expand...
Click to collapse
i guess ill give it a go
ill mess with it too once i get my straight talk plan. (cause right now i dont have a plan so i cant check data )
you can use Winrar to extract .jar files so you don`t have to rename to .zip http://www.rarlab.com/download.htm download it here
Ok, so again, very new to this...I just merged the 4 MobileDataStateTracker files from Android/net from speedrom 5.1 to the cm9...same thing, boot loops.
bos2333 said:
Ok, so again, very new to this...I just merged the 4 MobileDataStateTracker files from Android/net from speedrom 5.1 to the cm9...same thing, boot loops.
Click to expand...
Click to collapse
Then you likely have the cause of the original boot loop. Two things you can do, check the logcat - it may tell you something useful.. another thing to do is get software to compare the files, I think for windows there's a free one called winmerge... The output files are usually text, and you may see some specific lines that would help us from the stock file and change those(things relating to data), leaving everything else alone.
Someone recently posted how to do a log for data errors, but I have a really good tutorial in the bible in my signature, logcat like a pro.
Sent from my HTC_Amaze_4G using xda app-developers app
i'm trying to learn my ways around the android ecosystem... please correct me if I have any incorrect info below
bascially, what you're doing for this tutorial is trying to decompile and debug problems, only going up to the assembly level (smali)
jar/apk = container like a zip... contains resources like compiled binaries and images etc
dex = compiled binary for the android system
you first disassemble the dex files to smali ("assembly") files
-> a developer here would make changes to the smali... lets say you don't make any
you reassemble back to dex, gather it into a jar/apk file to put on the phone
-------------
for porting a phone to use CM9/10/aokp, you basically use the base CM9/10/aokp system, copy over relevant jar/apk, and debug to fix any problems (like function calls, data etc)?
using logcat, you can see where function calls fail (or when you have a exception), and then try to fix it?
how good is debugging? basically you can see most of the source code?
would it be also possible to go dex->smali->java? like this post, though it says its not ideal either http://stackoverflow.com/questions/5582824/decompile-smali-files-on-an-apk
Silentbtdeadly said:
Then you likely have the cause of the original boot loop. Two things you can do, check the logcat - it may tell you something useful.. another thing to do is get software to compare the files, I think for windows there's a free one called winmerge... The output files are usually text, and you may see some specific lines that would help us from the stock file and change those(things relating to data), leaving everything else alone.
Someone recently posted how to do a log for data errors, but I have a really good tutorial in the bible in my signature, logcat like a pro.
Sent from my HTC_Amaze_4G using xda app-developers app
Click to expand...
Click to collapse
Yeah, I attached a logcat last page and looked at it, saw the errors. I'll do some searching tomorrow to see if I can work my way through some of them.
Sent from my HTC Ruby using xda app-developers app
paperWastage said:
i'm trying to learn my ways around the android ecosystem... please correct me if I have any incorrect info below
bascially, what you're doing for this tutorial is trying to decompile and debug problems, only going up to the assembly level (smali)
jar/apk = container like a zip... contains resources like compiled binaries and images etc
dex = compiled binary for the android system
you first disassemble the dex files to smali ("assembly") files
-> a developer here would make changes to the smali... lets say you don't make any
you reassemble back to dex, gather it into a jar/apk file to put on the phone
-------------
for porting a phone to use CM9/10/aokp, you basically use the base CM9/10/aokp system, copy over relevant jar/apk, and debug to fix any problems (like function calls, data etc)?
using logcat, you can see where function calls fail (or when you have a exception), and then try to fix it?
________________________________________________________________________________________________
how good is debugging? basically you can see most of the source code?
would it be also possible to go dex->smali->java? like this post, though it says its not ideal either http://stackoverflow.com/questions/5582824/decompile-smali-files-on-an-apk
Click to expand...
Click to collapse
Everything above the line=yes(ish). That is a fair explanation of things. If you mean how good is the debugging on smali'd files.. you should do it to some and find out
I'm not sure I understand what you mean by dex>smali>java.. dex is the compiled, smali is decompiled, it can't be more decompiled than smali to the best I can see. What that link you posted was talking about was different tools to get the job done- some can be helpful, tho many don't work properly with ICS as of yet.
Sorry if my answers are unclear, I wasn't sure of the questions perhaps..
So there are some smali edits in this miui4 porting guide that can be looked at to help understand how/what files matter.. furthermore, all ril specific edits could be looked at for our phone http://forum.xda-developers.com/showpost.php?p=28885450&postcount=2
Also, the third post has some great info on debugging and reading logs.. http://forum.xda-developers.com/showpost.php?p=28885450&postcount=3
That entire guide is extremely comprehesive, and the language isn't more complex than what you are already doing, so you will learn quite a bit. I may pull relevant info from that guide to the second post when I have more time.
Silentbtdeadly said:
Everything above the line=yes(ish). That is a fair explanation of things. If you mean how good is the debugging on smali'd files.. you should do it to some and find out
I'm not sure I understand what you mean by dex>smali>java.. dex is the compiled, smali is decompiled, it can't be more decompiled than smali to the best I can see. What that link you posted was talking about was different tools to get the job done- some can be helpful, tho many don't work properly with ICS as of yet.
Sorry if my answers are unclear, I wasn't sure of the questions perhaps..
Click to expand...
Click to collapse
my question is whether we decompile all the way back to the Java source instead of stopping at the assembly(smali) stage
from doing more searching, it looks like you might be able to get readable Java source code, but you can't recompile them as it'll be incomplete and as you said might not work on ics
I assume one would need to to flash the cm9/10 and then get those logcats
Silentbtdeadly said:
Then you likely have the cause of the original boot loop. Two things you can do, check the logcat - it may tell you something useful.. another thing to do is get software to compare the files, I think for windows there's a free one called winmerge... The output files are usually text, and you may see some specific lines that would help us from the stock file and change those(things relating to data), leaving everything else alone.
Someone recently posted how to do a log for data errors, but I have a really good tutorial in the bible in my signature, logcat like a pro.
Sent from my HTC_Amaze_4G using xda app-developers app
Click to expand...
Click to collapse
Ok, so I tried again this morning by only adding "HtcMobileDataStateReceiver.smali" to the port in the android/net, and I got the boot loops again. Checked the logcat and found this...
I/ServiceManager( 144): service 'media.audio_flinger' died
I/ServiceManager( 144): service 'media.camera' died
I/ServiceManager( 144): service 'media.player' died
I/ServiceManager( 144): service 'media.audio_policy' died
I/Netd ( 496): Netd 1.0 starting
D/AndroidRuntime( 497):
D/AndroidRuntime( 497): >>>>>> AndroidRuntime START com.android.internal.os.ZygoteInit <<<<<<
D/AndroidRuntime( 497): CheckJNI is OFF
I/dalvikvm( 497): Zip is good, but no classes.dex inside, and no valid .odex file in the same directory
D/dalvikvm( 497): Unable to process classpath element '/system/framework/framework.jar'
I/ ( 498): ServiceManager: 0x1293958
E/JNIHelp ( 497): Native registration unable to find class 'android/debug/JNITest', aborting
Any ideas? It seems like it's not taking my new classes.dex file for some reason.

[Q] Modifying SystemUI.apk xml file

I am using kyanROM and love it! One little tweak I was looking to make was in the notification it has kyanROM along the bottom. I was looking to replace that with my nickname. I am new to modding Android, so any help or tips would be appreciated.
Here are the steps I took and the issues I encountered:
Using NinjaMorph I extracted/decompiled SystemUI
I copied the files over to my PC
Looking through the files (not an exhaustive search mind you), I found one, tw_status_bar_tracking.xml, that had android:text="@string/kyanROM and android:layout_gravity="bottom". This looked promising to me, so I changed kyanROM to the name I wanted to use.
After saving, I copied this file back to my phone and opened the projected in NinjaMorph and said replace the original xml file with my new xml file.
"Finished" the project and closed out NinjaMorph.
Immediately experienced issues. SystemUI stopped working. Rebooting did nothing. So I restored my nandroid backup in order to start over. Back in NinjaMorph, I extracted SystemUI again and copied all files to my PC. Searching the contents of all files (a more exhaustive search) I found 4 instances of the phrase kyanROM:
First was the original in tw_status_bar_tracking.xml and said android:text="@string/kyanROM"
Second is in values\public.xml and says <public type="string" name="kyanROM" id="0x7f0800cd" />
The last two hits are from the same line in values\strings.xml and say <string name="kyanROM">kyanROM</string>
Now, assuming I'm correct that I need to mod SystemUI, after looking at the search results I'm thinking the change I need to make is to the last hit on my search, thus making it <string name="kyanROM">myName</string>. Then, when tw_status_bar_tracking.xml looks for the string kyanROM, it will display myName.
So, am I correct that in order to make this change I need to be in SystemUI? And If that is correct, is my proposed change correct - modifying the strings.xml file to show <string name="kyanROM">myName</string>?
If I do those, go into NinjaMorph and say to replace the original file with my new file I then should see myName along the bottom of the notification dropdown. Thoughts???
So I started over, this time I pulled the SystemUI.apk using adb. Then using apktool I did "apktook if SystermUI.apk". Then, apktool d SystermUI.apk ./mod". Found the file I *think* I need to modify (\values\strings.xml) and replaced kyanROM with myName. Saved the file.
Now I'm trying to recompile the file. I run the following apktool b -f -d mod. When I run this I get the error: Exception in thread "main" brut.androlib.AndrolibException: brut.directory.PathNotExist: apktool.yml.
1) Am I modifying the correct file to place myName at the bottom of the notification screen?
2) How do I fix the PathNotExist error? I've looked at some solutions, but none seem to have worked.
Actually you need framework-res.apk from /system/framework installed through apk tool.
Pull framwork-res.apk and install it as you did for systemui.
After installing framework,type
apktool d systemui.apk
Now make the necessary changes and type
apktool b systemui
To recompile it back.
Note:after you recompile,you need to add meta-inf folder from original apk to your new recompiled apk to make it work.
Sent from my GT-N7000 using xda app-developers app
OK, I think I'm with you.
I need both SystemUI and framework-res in order to modify SystemUI
Install both (apktool if NameOfApk.apk)
decompile (apktool d SystemUI.apk)
make changes
recompile (apktool b SystemUI) but not the framework-res since I made no changes to it
And thanks for the tip about adding the meta-inf folder. I knew this, but since I never gotten that far to test, I'd probably forget to do that.
cyberpac9 said:
OK, I think I'm with you.
I need both SystemUI and framework-res in order to modify SystemUI
Install both (apktool if NameOfApk.apk)
decompile (apktool d SystemUI.apk)
make changes
recompile (apktool b SystemUI) but not the framework-res since I made no changes to it
And thanks for the tip about adding the meta-inf folder. I knew this, but since I never gotten that far to test, I'd probably forget to do that.
Click to expand...
Click to collapse
Installing framework-res.apk alone is enough if you have Samsung phone and have the latest apktool...
Sent from my GT-N7000 using xda app-developers app
vijai2011 said:
Installing framework-res.apk alone is enough if you have Samsung phone and have the latest apktool...
Sent from my GT-N7000 using xda app-developers app
Click to expand...
Click to collapse
OK, I installed both - no harm I guess. So I have made all my changes, updated the apk with the meta folder, etc. I'm ready to push this over to my phone. Using adb, do I need to remount or can I just do the following: adb push S:\apk\SystemUI.apk /system/app/
Well, I took a shot and just did the adb push without remount. I think it worked. We'll see if there are any issues moving forward. Yay! Many thanks....
edit: I noticed it reset my wallpaper, easy fix. Wonder if anything else would've been reset by this change?

[Q] Recompiling system framework

Was wondering if anyone has been able to recompile the framework from the stock rom so far.
I have been working with the apk multi tool that I have done for many previous devices and worked okay.
This time I just get a lot of errors.
I have even tried just decompiling it and recompiling it without any changes and it still has the same problem.
I also did copy in the framework and twframework to other and have them "installed" with the setup script.
Any ideas what I am doing wrong if anything?
The errors I get are many different forms of somthing like this:
Code:
C:\APK-Multi-Tool S5 Stock\other\..\projects\framework-res.apk\res\values\public
.xml:5786: error: Public symbol string/wifi_display_notification_connected_messa
ge declared here is not defined.
TheArtiszan said:
Was wondering if anyone has been able to recompile the framework from the stock rom so far.
I have been working with the apk multi tool that I have done for many previous devices and worked okay.
This time I just get a lot of errors.
I have even tried just decompiling it and recompiling it without any changes and it still has the same problem.
I also did copy in the framework and twframework to other and have them "installed" with the setup script.
Any ideas what I am doing wrong if anything?
The errors I get are many different forms of somthing like this:
Code:
C:\APK-Multi-Tool S5 Stock\other\..\projects\framework-res.apk\res\values\public
.xml:5786: error: Public symbol string/wifi_display_notification_connected_messa
ge declared here is not defined.
Click to expand...
Click to collapse
have you tried installing SystemUI as well? which apktool.jar are you using? tried beta 009?
No I didn't grab systemUI
Didn't think to grab that as I didn't in the past.
I will try that and get the newer jar.
I just was using what ever came with the toolkit.
Thanks
Tried to pull the SystemUI and compile again and still had problems.
I tried a newer apktool.jar from here:
http://connortumbleson.com/2014/02/apktool-2-0-0-beta-9-released/
And then it would not even decompile files anymore.
I think that might be too much of a missmatch to the apkmultitool script.
Anyone have any luck with doing this yet?
Grab the latest aapt tool from the Android SDK. It's under build-tools now.
You will need to modify line 1793 in the strings.xml file from frameworks-res:
replace "%d" --> "%1$d"
final line:
Code:
<string name="wifi_p2p_enter_pin_dialog_message">Enter the PIN and tap Connect within %1$d seconds to connect to %2$s.</string>
now apktool should build.

Categories

Resources