priv-app APK modification - Android Q&A, Help & Troubleshooting

Hello All,
I am trying to add/edit xml files found inside "assets", "vendor" directories of an APK included in system.img (priv-app directory) of a ROM.
The APK is available at
system/priv-app/CarrierConfig/CarrierConfig.apk
system/priv-app/CarrierConfig/oat/arm64/CarrierConfig.odex
system/priv-app/CarrierConfig/oat/arm64/CarrierConfig.vdex
I have used apk tool to decompile and re-compile the apk. I also zipaligned, signed with my own key. I copied the file to priv-app directory in the phone and restarted the phone. This did not work. I did have 644 permission for apk file after replacing. Also, I did clear the dalvik cache and cache after APK replacement.
1. Do I need to change the odex or vdex files? I did not touch them since my changes were in xml files.
2. Should I sign with originally signed signature?
3. I could not see the odex and vdex file in the priv-app directory in the phone after the ROM install(when I tried to replace the APK). Why is that?
4. Should I build a rom zip file to flash(along with existing odex and vdex files) as opposed to replacing the APK in the device?
Any help?

http://www.w3.org/2001/XMLSchema

I was looking into this as well. Everything I read said you have to be registered as carrier to make modifications to carrier config.apk , unfortunately:-/ Let me know if you did find a solution, though.

Related

[Q] Deodex my rom

Hallo guys, I trying deodex my rom a week but it did not work as well. Successful only half the rom. Please help me, I have tried many ways to including XUltimate exactly.
Rom here: http://www.mediafire.com/?qj9hllq7cp6uuqj
Sorry for ugly english
What is your phone?
If is an Motorola, here is the tutorial:
Deodexing Explained + How To
So you want to theme… but you keep hearing about all this deodexing stuff… so whats that all about?
Stock android implements an odex file structure; for every (well…most) system app(s) (.apk file) and framework files (.jar) there is a corresponding .odex file, so for example you have;
/system/app/Phone.apk
/system/app/Phone.odex
/system/framework/com.motorola.android.mediasync.jar
/system/framework/com.motorola.android.mediasync.odex
What do the .odex files do?
All of your apps on your device are packaged as .apk files; these files are compiled from google source code and can interchangeably be viewed/thought of as a compressed folder (like a .zip or a .rar); and all of your framework components (well most…) are packaged as .jar files which literally stands for Java Archive (so again this can be compared to a .zip or a .rar).
When the android OS want’s to run your apps or utilize its framework components, it has to parse (read/interpret) the compressed data held within your .apk and/or.jar files. What the odex file structure aims to do, is to expedited this process by utilizing another file (.odex file) to compliment every.apk file (and .jar file); the odex file, includes the most critical data in an uncompressed format so the android os can quickly interpret that important information before parsing through the rest of the data held within the compressed .apk files (and .jar files). So subsequently, in an .odex file structure the .apk & .jar files don’t include all of the applications/framework-components data; Essentially, two files are acting as one; for your apps there are .apk files + their corresponding .odex file and for your framework components there are .jar files + their corresponding .odex file. This works nicely as an optimized file structure, except in the circumstance when the user want’s to theme; theming requires a modification to your .apks; the image files (.pngs) held within the pngs are replaced with different ones. However it is impossible to theme an application if it exists as two files. So that is why it is said you need to be DeOdexed in order to theme; DeOdexing is the process of re-bundling that uncompressed critical data (.odex files) back into your compressed .apk (& .jar) files, so that now all of the data is included in the .apk files necessary to run your applications without the presence of .odex files; in addition all the data is now included within the .jar files necessary to utilize your framework components without .odex files. In a DeOdexed file structure, there are no odex files present.
What are the benefit’s of DeOdexing?
Simple. To be able to theme a stock ROM.
Deodexing doesn’t speed your phone up or do anything of the sort.
It is simply something that is necessary to be able to theme a stock ROM.
How do you DeOdex?
One way you can deodex is to use the application xUltimate which actually rebundles that information for you. Another way, is to use a pre-made DeOdexer Update.zip; this zip already has all the repackaged fully compressed .apk files and utilizes code in the update script to delete all of the odex files present. So essentially all it’s doing is overwriting all your old semi data inclusive .apk files with fully inclusive ones and then deleting the (now) superfluous .odex files. This is the easiest way to do it, since all the work is already done for you. Just flash it in clockwork as you would for any theme:
Download it
Place it on your sdcard
Open Droid X Bootstrap
Hit Bootstrap Recover > Ok > Reboot Recovery
Navigate to ‘Install zip from sdcard’ with volume keys and select with camera button
Navigate to ‘Choose zip from sdcard’ and select
Navigate to the directory containing the above deodexer zip
Select it > Yes
Wait for it to do its thing > reboot system
You are now deodexed.
How can you check to see if you DeOdexed successfully?
Open a file explorer (like Root Explorer or Astro)
Navigate to the directory /system/app
Check for the presence of .odex files
Navigate to the directory /system/framework
Check for the presence of .odex files
If there are no odex files present then you are deodexed!
Now you can theme!
Will DeOdexing slow you down?
Technically it should, but in actuality its really quite negligible to notice, however… In my opinion, it’s rather silly to DeOdex and stay on stock ROM; you should just make the switch to a custom ROM. Why? Because custom ROMs are already deodexed and they zipalign your apps on boot; zipaliging is the process of reorganizing the manner in which the .apk is packaged to optimized it for being parsed faster by the android OS, it is comparable if not better than the odex file structure, so you get the best of both worlds; a themed ROM and the speed of an optimized file structure. That is why Stock is lame and custom ROMS pwn (IMO of course…)

[Q] Classes.dex inside apk and dalvik cache

Hi
Is the file classes.dex found inside the apk and the [email protected]@classes.dex file found in /data/dalvik-cache that corespondes to that same apk, are the same file? Meanning I can extract the clssses.dex file from an apk rename it to [email protected]@classes.dex and copy it to /data/dalvik-cache to restore dalvik cache for that app? (Assuming my rom is deodexed of course)
Thanks
EB10000 said:
Hi
Is the file classes.dex found inside the apk and the [email protected]@classes.dex file found in /data/dalvik-cache that corespondes to that same apk, are the same file? Meanning I can extract the clssses.dex file from an apk rename it to [email protected]@classes.dex and copy it to /data/dalvik-cache to restore dalvik cache for that app? (Assuming my rom is deodexed of course)
Thanks
Click to expand...
Click to collapse
I assume but what are you trying to accomplish by doing this? I mean that app can create it's own Dalvik-Cache when it is running so no need to do it manually.
Thank you for the help. What I'm trying to accomplish is permanently patch an apk or jar file creating a new one.. You may be familiar with an app called Lucky patcher that can disable ads of many free apps by patching their dalvik cache. So i was thinking, if the dalvik cache file is simply the classes.dex extracted from the apk and renamed, one this *.dex file is patched, I copy and renamed it back to classes.dex and inject it into the apk file, overwriting the original, so I'll end up with a new pre-patched ad free apk file that I can use any time to reinstall the app... Will this work?
Thanks

[SOLVED] Edit .ogg in camera.apk

I have a rooted Galaxy M Style phone with stock Gingerbread 2.3.4 firmware. I am trying to customize my stock camera app, but am not sure what I'm doing wrong. I plan to replace the autofocus_ok.ogg with a different tune from my phone. I checked the properties of the autofocus_ok.ogg and saw it's a mono, 44100hz, and 96 bitrate file. The tune that I have has the same properties. So this is what I have done so far:
I backed up camera.apk to /system/app/camera.apk.bak and the camera.odex to /system/app/camera.odex.bak. I left a copy of camera.odex in /system/data. I copied the camera.apk to my memory card and placed the file on my computer. I renamed the file to a .rar. I then deleted the autofocus_ok.ogg and placed the tune that I wanted in that directory. Then I renamed it to autofocus_ok.ogg. I renamed the file back to .apk and transferred the file back to the memory card, then over to /system/app. The camera app will not install/not showing up on my phone. I am transferring the files through root explorer on my phone.
I worked with the original apk file again with apktool. I was able to decompile and replaced and renamed the files that I needed again. I compiled the file and transferred the file to /system/app again, but the apk will still not install. I checked the complied apk file and noticed that the file didn't have the META-INF folder, so I copied that over to. Tried to install it again by copying the file to /system/app, but it still won't show up on my phone. Is there anyway for me to change the autofocus_ok.ogg without a custom rom?
Thanks.
ImAhNoBoDy said:
I have a rooted Galaxy M Style phone with stock Gingerbread 2.3.4 firmware. I am trying to customize my stock camera app, but am not sure what I'm doing wrong. I plan to replace the autofocus_ok.ogg with a different tune from my phone. I checked the properties of the autofocus_ok.ogg and saw it's a mono, 44100hz, and 96 bitrate file. The tune that I have has the same properties. So this is what I have done so far:
I backed up camera.apk to /system/app/camera.apk.bak and the camera.odex to /system/app/camera.odex.bak. I left a copy of camera.odex in /system/data. I copied the camera.apk to my memory card and placed the file on my computer. I renamed the file to a .rar. I then deleted the autofocus_ok.ogg and placed the tune that I wanted in that directory. Then I renamed it to autofocus_ok.ogg. I renamed the file back to .apk and transferred the file back to the memory card, then over to /system/app. The camera app will not install/not showing up on my phone. I am transferring the files through root explorer on my phone.
I worked with the original apk file again with apktool. I was able to decompile and replaced and renamed the files that I needed again. I compiled the file and transferred the file to /system/app again, but the apk will still not install. I checked the complied apk file and noticed that the file didn't have the META-INF folder, so I copied that over to. Tried to install it again by copying the file to /system/app, but it still won't show up on my phone. Is there anyway for me to change the autofocus_ok.ogg without a custom rom?
Thanks.
Click to expand...
Click to collapse
erm... is the permissions set correctly rw-r--r-- ?
MoonBlade said:
erm... is the permissions set correctly rw-r--r-- ?
Click to expand...
Click to collapse
Yup, permissions were set correctly like rw-r--r--. Owner is root:root. Those are the permission that I set on the apk file like they were on the original file. I just realized that the compiled apk's from apktools doesn't show up on my phone. The apk that I created by opening up winrar and just replacing the .ogg files do show up, but I get the error "The application Camera (process com.sec.android.app.camera) has stopped unexpectedly. Please try again."
Anything else I can try or a thread to refer to?
ImAhNoBoDy said:
Yup, permissions were set correctly like rw-r--r--. Owner is root:root. Those are the permission that I set on the apk file like they were on the original file. I just realized that the compiled apk's from apktools doesn't show up on my phone. The apk that I created by opening up winrar and just replacing the .ogg files do show up, but I get the error "The application Camera (process com.sec.android.app.camera) has stopped unexpectedly. Please try again."
Anything else I can try or a thread to refer to?
Click to expand...
Click to collapse
why dont you try to push the modified apk manually using root explorer or so instead of pushing via adb ..
after decompiling apk and modifying it, compile it into some folder and then copy it into you sd card then use root explorer and manually push(copy) the apk into system/app .. give proper permissions and then reboot your phone..
Here are some guides to use apktool
http://forum.xda-developers.com/showthread.php?t=1891686
http://forum.xda-developers.com/showthread.php?t=1989533
MoonBlade said:
why dont you try to push the modified apk manually using root explorer or so instead of pushing via adb ..
after decompiling apk and modifying it, compile it into some folder and then copy it into you sd card then use root explorer and manually push(copy) the apk into system/app .. give proper permissions and then reboot your phone..
Here are some guides to use apktool
http://forum.xda-developers.com/showthread.php?t=1891686
http://forum.xda-developers.com/showthread.php?t=1989533
Click to expand...
Click to collapse
I have been pushing the modified apk through root explorer all this time. I don't even have adb install, haha. The procedure you explained have been the way I have been doing it the whole time, lol. I read the threads you posted and the procedure is the same as I've been doing it, except for the second thread. I can't grab the apktool from 4shared because I don't have an account. I am using the latest apktool 1.5.2. Also, I didn't understand what PulseDroid was talking when he said "We are NOT done just yet, we cannot use the new apk's... we have to take what we did and add it back to the original apk file to keep proper signature use something like 7zip, take the 'resources.arcs' file and any other xml files you edited out of the "-new" apk and copy them into Original apk". So I'm suppose to replace the resources.arcs and the .ogg files that I created from the new apk to the old apk? I didn't mess with any xml file.
Anyways, is there anything else I can try?
EDIT: ........I feel so embarrassed. I checked out this thread http://forum.xda-developers.com/showthread.php?t=2378177 and saw this post "Drag your replacement files into WinRAR and (here's the important part) in the Compression Method drop-down choose "Store"." All this time I have been compressing the file as "Normal" in Winrar, instead of "Store".
All in all, I did not need apktool at all. I used the original apk and opened it up in Winrar. I deleted the files that I wanted to replaced and put in the files that I wanted. Each time I put something in the file in Winrar I get a prompt for compression and instead of "Normal" compression just use "Store". It was that simple.
This helped me, thank you!

[Q] How should I de/recompile a system app? What did I do wrong?

Hi,
So the situations is like this:
Just got a new LG Nexus 4, NFC enabled, GREAT!!!!
But then I start using it, and the NFC sound (everytime the phone reads a nfc-tag it makes an sound) annoys me beyond belief.
So I start looking around, it seems there's no solution, except recompiling the app.
So I learn how to compile an app (noob here), using this guide: http://forum.xda-developers.com/showthread.php?t=1860115
I'm up to the point where my apk is decompiled, and I have modified the sound files, located in my decompiled files folder respectively at res/raw/start.ogg & res/raw/end.ogg.
I modded the files using audacity, lowering the volume to zero, used them to replace the original .ogg files. The file size is a bit smaller as the original ones (1Kb difference).
Next I use the recompile command: apktool b decompiled_apk_folder_with_modified_files modded_apk_file.apk
So now I have the new nfc apk file, called NfcNci.apk, with which I replace the original file in /system/app.
Next up I reboot my phone into recovery, wipe all cache and dalvik cache, and reboot again.
First thing that pops up on my screen is a force-close message, saying that the nfc-service force closed.
Anyone who can tell me what I did wrong? Or how I can fix this?
Attached are: my decompiled-files-folder (compressed to zip)
the original NfcNci.apk file
my modded NfcNci.apk file which causes the FC's.
Any help will be greatly appreciated!!!!
S.
Looks like you're still on 4.2
The latest NfcNci.apk has some more files.
And your apk is missing the META-INF folder.
I guess that this is the problem.
But you should use "adb logcat" to ensure we're on the right track.
Micky
1 thing i would recomend is not using the actual apk you just built. instead, open your new apk with a file manager such as 7zip and remove your newly compiled files out of it, then put them into the original apk from your rom using 7zip as well! thus keeping the apk's original signature
try to copy the least amount of files from one to another, so to be safe only pull out your new .ogg files, then put them into your original apk! hope this helps
ldrifta said:
1 thing i would recomend is not using the actual apk you just built. instead, open your new apk with a file manager such as 7zip and remove your newly compiled files out of it, then put them into the original apk from your rom using 7zip as well! thus keeping the apk's original signature
try to copy the least amount of files from one to another, so to be safe only pull out your new .ogg files, then put them into your original apk! hope this helps
Click to expand...
Click to collapse
Hi, I tried this, installed 7zip, and double clicked the original apk, I opende the res/raw/ directory, and only copied the files I was using: start.ogg & end.ogg. Then I close 7zip, and send the file to my phone. But as soon as I it them to /system/apps on my phone, and reboot to recovery, wiping the dalvik cache. I get FC's on reboot (NFC-service has FC'd).
Any reasons for this?
Thanks for the help, both of you!
BTW: I'm on Android 4.3 JB

How To Odex Non-System Apps

Hi, Deodexing an Odexed App is very simple. There are many tools for deodexing like the Famous Ultimate Deodexer . How about Odexing back an App without its original odex file? How could we odex it? Here's what I did to get all our problem solved:
1.) First of all, explore your Apk file using WinRar or 7zip, search for its classes.dex file. When you see one, proceed to the other step. When there's no classes.dex in your .apk file, I'm sorry, that App cannot be odexed.
2.) The next step is to extract the classes.dex file from that Apk by dragging it out. Then rename it to ["Appname".odex](Make sure you name Appname.odex the same as your Package Name.
Ex. CHATOn_MARKET.odex--->CHATOn_MARKET.apk
3.)Download Deodexer-Odexer-Tool_v1.00. I can't share the link. Just google it
4.) Extract the downloaded files. Pull framework dependencies. (I feel lazy about this common sense needed
5.) Move the .apk and .odex file you've just made in the "put-file-here" folder of Deodexer-Odexer-Tool_v1.00. Copy again the .apk file to the "finish" folder and rename it to "Deodexed_Appname.apk".
6.) Open "Deodexer-Odexer-Tool.bat" now deodex your apk file. Its just simple, read and understand the onscreen instructions.
7.) Last Step: Push your .apk file to your phone.
Hope I helped you.
For odexing apps i recommend Lucky Patcher, is the only app that actually odex my apps

Categories

Resources