[Q] Recompiling framework-res.apk problem - Android Software/Hacking General [Developers Only]

Hello,
Was following http://forum.xda-developers.com/showthread.php?t=1109962&page=8# to try and get SIP support on an SG SII running 4.0.3 LPQ [Polish] build.
I had to use another method to decompile and recompile my framework-res.apk due to a bug in apktool. That works well and it recompiles. I followed the instructions in the thread above to the letter, including removing info from the keep folder and eventually get a signed APK.
I copy the APK to my device, restart and suddenly I get loads of force close errors before it eventually restarts. This loops. At the moment I'm copying it in via ES File Explorer or manual 'cp' command in Terminal Emulator.
Please can anyone give some insight into what I'm doing wrong?
Thanks

I don't know what the cause is actually, but here is how I edit framework-res.apk.
If i want to make changes to the code, I extract classes.dex from the package and decompile it with baksmali
"java -jar baksmali-1.3.2.jar -o dexout/ classes.dex "
then i make the changes to the code and i recompile it
"java -Xmx512M -jar smali-1.3.2.jar dexout/"
Then i rename the out.dex file to classes.dex and add it to the framework-res.apk package
And if you need to add/change images just drag n drop the files inside the apk
Hope that helps you

very very sorry wrong post

Try pushing the apk to your phone in recovery mode, with the system partition mounted. Changing framework-res.apk while the phone's running can cause all kinds of odd bugs.
Sent from my U20i using xda premium

Have you updated your SDK tools? I thought that with rev.17 they fixed the bugs with re-compiling. If not, the easiest way I fixed it was to de-compile, then search and open all the plurals.xml files in notepad++, then at the end of almost all the files there will be a line of code that has two(2) %'s in the same line. That's what kicks up the error. all you have to do is add a second % to the last one. Using notepad++ makes this really easy, just use find and replace: FIND- %d</item> REPLACE- %%d</item>
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
To this:
Then I re-compile. I then go to framework-res/build/apk/ and pull out the resources.arsc and any other files I edit(res\values\bools.xml, in your case) and copy them back into the original framework-res.apk, that way I don't have to mess with any signatures or anything else. reboot to recovery, mount system, adb push framework-res.apk, adb reboot.
p.s. This is the only way I have been able to edit, build, and flash framework-res.apk in ICS without problems like fc's and other things. I hope this helps a little bit. and all I use is
Code:
apktool d framework-res.apk
and
Code:
apktool b framework-res newframework.apk
but with this method it always works.

Interesting. I'll bear that in mind but I wouldn't have thought that would cause any bugs. The syntax is technically correct, it's just a little odd.
Sometimes this code makes no sense..lol
Sent from my U20i using xda premium

Ticklefish said:
Interesting. I'll bear that in mind but I wouldn't have thought that would cause any bugs. The syntax is technically correct, it's just a little odd.
Sometimes this code makes no sense..lol
Sent from my U20i using xda premium
Click to expand...
Click to collapse
Yeah a guess it was a "feature" they add in aapt for ICS, but like I said I think they fixed it in rev 17, but I haven't confirmed this yet.
Sent from my Ice Creamed 3D

Ah, that could be right. I'm not on ICS yet. Guess I need to pay more attention when I do!
Sent from my U20i using xda premium

Related

Problems Porting X10 ROM to G1

So the guys over in the X10 Forum got the system dump from the X10 posted
Forum:
http://forum.xda-developers.com/forumdisplay.php?f=617
System Dump Post:
http://forum.xda-developers.com/showpost.php?p=6089394&postcount=23
I'm working on porting bits of it to my G1 as a side project/learning experiment. I'm using Cyanogen's latest release as a base and I got some various parts moved over, but I'm getting the error "E:Can't find update script" when flashing, even though I have the script at META-INF\com\google\android\update-script. It's unmodified from Cyan's base.
Is there something I need to add to the update-script to include the parts from the X10 system dump I added?
Mr17 said:
So the guys over in the X10 Forum got the system dump from the X10 posted
Forum:
http://forum.xda-developers.com/forumdisplay.php?f=617
System Dump Post:
http://forum.xda-developers.com/showpost.php?p=6089394&postcount=23
I'm working on porting bits of it to my G1 as a side project/learning experiment. I'm using Cyanogen's latest release as a base and I got some various parts moved over, but I'm getting the error "E:Can't find update script" when flashing, even though I have the script at META-INF\com\google\android\update-script. It's unmodified from Cyan's base.
Is there something I need to add to the update-script to include the parts from the X10 system dump I added?
Click to expand...
Click to collapse
is your meta-inf folder intact? there should be other files in there besides the com folder.
Yup, heres the structure:
META-INF
-com
--google
---android
----update-script
-CERT.RSA
-CERT.SF
-MANIFEST.MF
i had some errors like this... try changing the name of your update.zip
I managed to port it over, but it was just a themed 1.6, couldn't get any of the X10 apps to work (do you have to do something differently with the .odex files?) It booted fine though.
I can send you my update-script if that will help at all?
Thanks for the reply, the original file name was x10-test-1-signed.zip, I changed it to test.signed.zip and it did the same thing. I also tried update.zip with the same result.
Hey Meltus, that would be helpful, then i can compare the 2 and see what im missing.
also: if you leave the odex files out, the system will create them automatically, that might help?
ah i'll try that, thanks.
Here's the update-script file i'm using. [attached, remove .txt] I nicked it from some ROM, can't remember which lol (sorry )
Also, does anyone know how to change the resolution? It is SERIOUSLY messed up lol.
Meltus said:
Also, does anyone know how to change the resolution? It is SERIOUSLY messed up lol.
Click to expand...
Click to collapse
I thought it was in the build prop? I didnt see it in there though. not in the one i have anyway.
actually, i bet if you changed this line in the build prop:
ro.sf.lcd_density=240
to
ro.sf.lcd_density=160
it would probably help
I tried your update-script and I got the same err :/
Mr17 said:
actually, i bet if you changed this line in the build prop:
ro.sf.lcd_density=240
to
ro.sf.lcd_density=160
it would probably help
Click to expand...
Click to collapse
nah tried that, didn't help
Not sure why it's not finding the file. Try redoing the folder layout.
I tried rebuilding, no go. would you mind sending me what you have? maybe we can get that working?
Well, my update.zip doesn't do anything atm. (gonna deodex all the files first and see if that works) but it flashes. It only works if you fastboot all the .img's first and then flash the update.zip though.
I often found that you don't ZIP the main folder you keep your data, system and other folders in, but the ones inside it. You select all of them, ZIP and name it "update". Then sign. Try using this method.
What are you using the zip the archive? Try using 7-zip? Sounds like Android doesn't know how to unzip your zip file.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
boldfilter said:
Click to expand...
Click to collapse
That's precisely what I was trying to express
roccodaone said:
That's precisely what I was trying to express
Click to expand...
Click to collapse
I was doing the exact same thing yesterday lol

[i9003][MOD] Remove Status Bar Clock

This mod will remove the time from the notification bar on your Galaxy S i9003.
YouR Phone Must Be Deodexed and Rooted for this Mod
Instructions:
1) First download smali-1.2.6.jar and baksmali-1.2.6.jar from here http://code.google.com/p/smali/downloads/list Rename them to just smali.jar and baksmali.jar.
2) You'll need to pull the services.jar from the /system/framework/ directory on your phone to your PC. Open the services.jar file for example with winzip, 7z, winRar, or whatever. Unzip the classes.dex file to a new folder and place the baksmali and smali file there too. After that open a new command window within that folder and run following line:
Code:
java -jar baksmali.jar -o out/ classes.dex
3) You'll have a new folder now called "out". Browse to "out/com/android/server/status" and open the file called StatusBarPolicy.smali with a text editor. I personally prefer "Notepad++".
4) Search for:
Code:
invoke-direct {p0}, Lcom/android/server/status/StatusBarPolicy;->updateClock()V
5) It should be under ".line 592". Now add this line underneath the line you just searched for from above:
Code:
invoke-virtual {p2, v3, v6}, Lcom/android/server/status/StatusBarService;->setIconVisibility(Landroid/os/IBinder;Z)V
6) Save the file.
7) Open a new command window within the folder you created before or maximize the same command window you used before and run this:
Code:
java -Xmx512M -jar smali.jar out/ -o edited-classes.dex
8) Now you'll have a new dex file called "edited-classes.dex". Rename the old dex file to classes_old.dex and rename the new file to "classes.dex".
9) Open again the services.jar file with any zip tool and overwrite the classes.dex file with the one just created.
10) Push the updated services.jar back to the /system/framework/ directory on your phone and set the file permissions to rw-r--r--. Reboot!
I am also sharing my services.jar file for those who wants this mod.
just replace it with your services.jar present in system/framework using ROOT EXPLORER
WARNING : DO THIS MOD AT YOUR RISK I AM NOT RESPONSIBLE FOR BRICKING YOUR DEVICE ( ONLY WORKS ON XXKB3 F.W HAVENT TESTED ON OTHER DDKB1 or KB2 F.W)
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
THANKS TO TONECREATIONZ FOR THIS GUIDE
IF YOU LYK THIS MOD THEN KINDLY PRESS THE THANKS BUTTON
good...but I like the clock
Sent from my GT-I9003 using XDA Premium App
it depends on you whether you like the clock or not
Hi i would like to know if there is any way that i can disable the default battery icon? Cos i am already having another app that shows the battery percentage and thus would be redundant to have both. Thanks in advance!
i think no
thanks
hey dude cool theme bt want to know that my firmware version is kb2 and want to upgrade it yo kb3 how this can b done plz help
sameer.biosam said:
hey dude cool theme bt want to know that my firmware version is kb2 and want to upgrade it yo kb3 how this can b done plz help
Click to expand...
Click to collapse
See the thread http://forum.xda-developers.com/showthread.php?t=1004622

[Tutorial]Decompiling Or Editing Android's APK

How To Decompiling Or Editing Android's APK
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
step 1 : first apk file rename and last .zip to create zip file.
step 2 : then open *.zip file and classes.dex copy to dex2jar-0.0.9.9 folder.
step 3 : then folder on shift+right aerow and click open command window here.\
step 4 : then write on cmd in dex2jar classes.dex and enter press. this process is given on images.
step 5 : then getting classes_dex2jar file.
step 6 : then open jd-gui application and open file-> open file and open classes_dex2jar file.
step 7 : getting the code of application.
For Download This Software::
Click Here...
If You liked my work,Atleast Click Thanks Button,its Free,It encourages me.
awesome guide
helped me get a source code to popular android game so i can create my own game using the touch feature of source code:highfive::good:
Its the most complex guide I have ever seen
iamareebjamal said:
Its the most complex guide I have ever seen
Click to expand...
Click to collapse
It really is. Lol. I'm not going to keep looking at the screenshot and i'll just see if I can make it work on my own.
how do you get the resulting .zip from saving all sources of jd-gui since jd-gui doesnt actually allow modifications you have to save all sources wll end up with .java in a zip file, after editing the java files in the zip how do i get that zip back into the jar file to re dex it>?????
fieldsweeper said:
how do you get the resulting .zip from saving all sources of jd-gui since jd-gui doesnt actually allow modifications you have to save all sources wll end up with .java in a zip file, after editing the java files in the zip how do i get that zip back into the jar file to re dex it>?????
Click to expand...
Click to collapse
There are other, more straight forward guides to help.
its not hard, its impossible to understand!
FAILED!!!
Thank you so much, took. I will act.

[GUIDE][GB] Change path thickness of Pattern Lockscreen to ICS style

Guide to changing path thickness of Pattern Lockscreen to ICS style​
I wandered places searching this off. I found some traces in direction of my destiny but none of them worked fully correctly
So, as stated, I searched a lot for this mod and came face to face with failures and smali errors. So, I had to figure it out myself some modification to do in it to make it work.
Note: IT is not COMPLETELY my mod but I have done modifications in it to make it work. This is based on a guide for Froyo outside of XDA.
Pre-Requisites:
1. PC with Java JDK or JRE
2. Deodexed ROM
3. 7-Zip
4. classes.dex decompiling tool
5. Notepad++
6. Patience
7. Carefulness for editing smali files
Let's Start
1. First we would have to decompile classes.dex inside framework.jar
For that, you can use my Tool ROM Tool v2
First using 7zip, Right click on your framework.jar and open it as archive and drag and drop classes.dex in input folder of the tool
(Note: If you don't have classes.dex in framework.jar [only META-INF and preloaded-classes.dex], then your framework isn't deodexed)
Now, open Script.bat and choose 1 (Decompile classes.dex)
2. Now, we will make the changes. Go to decompiled folder and go to \classout\com\android\internal\widget and open LockPatternView.smali in Notepad++
Search for mDiameterFactor:F [Ctrl+F]​
See the code above it.
It should be like this:-
Code:
const[COLOR="Red"]/high16[/COLOR] v2, 0x3f00
If it is, then you will have to remove red part /high16
Because it will not allow the change of code we will be doing which will have a different hexadecimal value which will not be supported till this code is in effect
Now, it will look like this:-
Code:
const v2, 0x[COLOR="Red"]3f00[/COLOR]
Now, we will change the thickness value 3f00 to 3dcccccd
Final code will look like this
Code:
const v2, 0x3dcccccd
Save it
I am attaching final and before smali for comparison below.
View attachment Smali.zip
(Note: If you don't have /high16, it's good , then just just change the value and save)
3. Go to Script.bat again and choose 2 (Recompile classes.dex) and after it's done, you will get classes.dex
Drop it in framework.jar
4. Push framewotk.jar in /system/framework
Eg:
Copy it in platform-tools folder of android SDK and type following with pressing Enter after each command
Code:
adb remount
adb push framework.jar /system/framework/
adb shell chmod 644 /system/framework/framework.jar
adb shell killall system_server
Last command will Hot Reboot your phone to apply changes. It is fast and better than rebooting phone.
5. Enjoy
Screenshots
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Before
After
Credits​
A member from other forum to answer a question to other member of that forum
Google for letting me search somethings
Samsung Galaxy Ace s5830i members for supporting me so much
RESERVED
Very nice, made here and was show!
thank

[GUIDE] Adding Extra Details in About Phone in Settings.apk [NOOB-FRIENDLY]

Hi guyz,
Today I want to share something about settings.apk mod….
Its about adding small details in about phone section…
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
NOTE: I have not copied it... Actually I was playing with some codes and got success. I don’t know if there is any guide about this… There is guides about this, but those are hard for newbies because those are complex and there is some work in strings.xml... But in my guide there are no work of that .... I think this is the easiest way.....
So lets start…
Requirments
Apktool, Java Runtime
NotePad++, 7zip
Knowledge about decompiling, recompiling
A little respect (must)
And your Settings.apk & framework-res.apk
Step 1..
Decompile your Settings.apk
Step 2..
Go to res > xml
Open device_info_settings.xml
Now Copy This Code
Code:
<Preference android:title=" TITLE " android:summary=" SUMMARY " style="?android:preferenceInformationStyle" />
And paste it before </PreferenceScreen>
See the Image… I have added 2 lines… And You can write there anything……
Step 3..
Now Recompile your settings
Step 4..
Open decompiled Settings folder then go to build/apk, there u will find AndroidManifest.xml file…
Now open original Settings.apk using 7zip then copy the META-INF folder and AndroidManifest.xml file…
paste both the files in build/apk folder, if asked to replace, click yes..
now go to a folder in settings folder named dist, there u will find Settings.apk which u compiled.....
now delete it. We never use the first Settings.apk that we compile, because we need to add the META-INF and AndroidManifest.xml files for signing purposes.
Once you have deleted the 1st compiled Settings.apk, return to the command prompt and again compile the Settings using this code
Code:
apktool b Settings
After it is compiled go to dist folder there u will find new and fresh compiled Settings.apk which u can use it…
Step 5..
Using Root Explorer push it into system/app folder and set permissions to rw-r-r-
That's it!
Credit goes to YOU if you get success :fingers-crossed:
Nice tut sir

Categories

Resources