[Q] Modify java code in framework.jar - Android Q&A, Help & Troubleshooting

Hey everyone,
My stock rom on my phone has issues with MVNO's (mobile virtual network operator). Basically this means that my data connection only works when Roaming. This is a know issue that has already been fixed on several roms (but not on mine).
To fix this I would like to modify the source of the framework.jar file (`/system/framework/framework.jar`), more specific the file : `/com/android/internal/telephony/gsm/GsmServiceStateTracker.java`
To start I will list the steps I have take to show you where I'm stuck at the momoment:
- I have fully deodexed my stock rom, both the JAR files and the APK files in both /system/framework/ and /system/app
- I have downloaded the deodexed framework.jar file and extracted the classes.dex file from it
- I have decompiled the classes.dex file using baksmali to end up with several *.class files
- I have converted these *.class files to a .jar file using dex2jar
- I have unpacked opened this jar file using jdqui to end up with several *.java files
This is where I'm stuck, I need to figure out how to edit the java file I want and end up with a working framework.jar again that I can upload to my phone.
Am I doing this the wrong way? Any other way to resolve my issue? I hope to get some help from people who have experience in doing this...
Any help would be appreciated!

Bump, anyone?

Related

Problem modifying apk

Hi, i am trying to modify the classes.dex file in an apk but it is giving me problems.
if i decompile the apk and recompile it after modifying the app installs but crashes after one minute. also some functionality in the app is also lost.but when i binary edited the classes.dex file and replaced it in the apk ( i have used different methods for replacing the .dex such as direct replacing in archive and replacing in the decompiled archive) the app doesn't install and the phone or emulator reboots. i have done this with other apps and they are working fine after editing so i couldn't understand what's going wrong. please help
You should use a decompiler and achive to the java code. Than you can easily modify and recompile the app. You will need an Linux virtual machine to do this.
In linux, after you found you .apk file use this to decompile it to a .jar file. http://siis.cse.psu.edu/ded/installation.html. After that, you can use http://java.decompiler.free.fr/?q=jdgui to browse the code. With this method you will need a Linux machine and would give you the best result.
If you want to use windows, follow this tutorial http://androidorigin.blogspot.com/2011/02/dex-format-to-jar-format.html but I warn you, its likely to be faulty.
Hope this will help you.
thanks for replying
i used apktool to decompile and modify the smali code. i had even tried converting the smali code to java but no help.the problem is that the recompiled app runs only for one minute and then crashes without any error message even logcat log is not of help it just says that the process xxx has died but no err msg or exception is logged. if i replace the classes.dex with the patched one and then re-sign it it does not install and crashes the emulator but when i again decompile and then recompile the modified file it return to the same old problem of crashing. do you know how apktool packages the compiled files?
You should follow one of the tutorials posted in my last post. I did not used apktool and I don't know how it works.c the method with that decompiler will work. If you want your application signed just sign it as a normal one.
this particular apk loses about 20-30 kb in filesize on decompiling and then recompiling with apktool while this is not seen in any other apk. maybe this means that this file has some overlay data that goes missing on modifying and creats problems.7-zip is unable to show any extra data in the file.does anyone know how to add and extract overlay data on/from an apk?

[Q] Modifying QuickSnote.apk for Jelly 'Beans' build 4

Hi,
I'm trying to figure out why a modified QuickSnote.apk doesn't work on Jelly 'Beans' Rom - Build 4->http://forum.xda-developers.com/showthread.php?t=2032447
This is a problem (for me) because it used to work on build 3 just two days ago.
Here is what I did,
0. Install framework-res.apk, SystemUI.apk, and twframework-res.apk that I extracted from root (build 4)
1. Download and decompile the '/system/app/QuickSnote.apk' using 'apktool'
2. Overwrite QuickSnote/res/raw/popupnote_sound.ogg with a dummy ogg file.
3. Recompile the 'QuickSnote.apk' using 'apktool'
4. Copy&paste jar-res directory from the original apk into newly created apk (it's missing from the new apk for some reason)
5. Sign the apk using 'signapk'
6. Finally, overwrite /system/app/QuickSnote.apk with the new&signed apk
After doing this, I assumed that the only difference in the MANIFEST.MF files would be the SHA1Digest of the 'popupnote_sound.ogg' file. However, many other digests seem to be different.
Could this be the reason why it's not working?
Please assist me with this.
Thanks.
Have you tried to copy :
assets
META-INF
android-manifest.xml
from the original to the new one?
I had same problem with framework-res.apk and it solved it

[Q] Internal/Hidden files

I'm trying to extract internal and hiddent files for my Bionic 4.1.2.
The instructions I found online said to basically
1.) extract the framework.jar (adb pull /system/framework/framework.jar - not a problem)
2.) rename it to framework.zip and unzip - not a problem
3.) retrieve classes.dex - problem there is no classes.dex
I can't move any further because classes.dex is not in my framework.jar on the emulator or physical device.
Is the file Classes.dex located somewhere else for this version of Andorid?
Is there another or better method to get internal and hidden files to utilize in applications?
I need this so I can build some special needs applications for my father who has ALS.
Any help provided would be appreciated. Thanks.
Utilizing Android Internal/Hidden files
Is there another or better method to get internal and hidden files to utilize in applications?
sbrammer said:
I'm trying to extract internal and hiddent files for my Bionic 4.1.2.
The instructions I found online said to basically
1.) extract the framework.jar (adb pull /system/framework/framework.jar - not a problem)
2.) rename it to framework.zip and unzip - not a problem
3.) retrieve classes.dex - problem there is no classes.dex
I can't move any further because classes.dex is not in my framework.jar on the emulator or physical device.
Is the file Classes.dex located somewhere else for this version of Andorid?
Is there another or better method to get internal and hidden files to utilize in applications?
I need this so I can build some special needs applications for my father who has ALS.
Any help provided would be appreciated. Thanks.
Click to expand...
Click to collapse

[Q] Bionic 4.1.2 Internal/Hidden files

I'm trying to extract internal and hiddent files for my Bionic 4.1.2.
The instructions I found online said to basically
1.) extract the framework.jar (adb pull /system/framework/framework.jar - not a problem)
2.) rename it to framework.zip and unzip - not a problem
3.) retrieve classes.dex - problem there is no classes.dex
I can't move any further because classes.dex is not in my framework.jar on the emulator or physical device.
Is the file Classes.dex located somewhere else for this version of Andorid?
Is there another or better method to get internal and hidden files to utilize in applications?
I need this so I can build some special needs applications for my father who has ALS.
Any help provided would be appreciated. Thanks.

SystemUI.apk compiling error - solved

SystemUI compiling error on stock Android 4.3 roms
This is not actually a fix just a work around to allow the compiling of the SystemUI.apk
The problem is that apktool isn’t decompiling the SystemUI.apk resources.arsc values correctly, download the attached zip and copy the enclosed values-sw720dp folder to your res folder.
This should solve the compiling error but do not replace the newly compiled resources.arsc to you phone as it could cause the SystemUI.apk to crash.
Changes to other xml or png files should work as normal if you are flashing via vrthemeing or similar methods but would suggest that after compiling your SystemUI.apk you extract the files you changed and only flash those files to your phone not the full apk
Thanks for this, it solved my compiling issues instantly.
Thank you very much

Categories

Resources