What is the correct procedure for decompiling system APKs? - Samsung Galaxy S7 Edge Questions and Answers

Hey guys.
Having some difficulty here with modifying system APKs without leaving them 'corrupt'.
Specifically with SecSettings and SamsungCamera6.
Only looking to simply modify the qmg icons for the time being.
Ticklemyandroid didn't really want to know with SecSettings. Tried using apktool manually after installing the framework-res.apk and still doesn't seem quite right. Also tried apk multi took. Even went as far as simply trying to past the qmg files into the existing APK with winrar but that really broke things.
I believe my issue is partly that things aren't decompiling properly, but also that I'm a little unclear of the correct procedure to recompile them afterwards without any errors or corruption if tapping on them to install (I'm not actually trying to install them this way, but I'm looking to get to package conflicts rather than package corrupt).
Edit: NVM. Seems like some kind of protection to prevent you from modifying and installing said APKS

Related

Apktool and Rosie.apk

Okay I am trying to make some changes to my Rosie. I'm not going to ask how to make the changes I want I will hopefully figure it out myself....My question is about apktool. I keep getting FC on startup after trying to decompile and the build the rosie apk without making changes. What I've done
1) apktool d Rosie.apk
no errors ( Yes I have put the correct htc framework into apktool fw)
2)I Made no changes at all
cd Rosie
apktool b
3)I go to the build dir and the apk is there from here I have tried two different things
3a) Sign the apk using
java -jar signapk.jar testkey.x509.pem testkey.pk8 Rosie.apk your_app_signed.apk
3b)Leave the apk alone withouot signing it since it's a system app I dont think it needs to be signed, but I'm not sure
4) I put into a flashable file, in my update script I wipe dalvik cache as well, everything installs fine and I know this step isn't the issue
5) I reboot nand get constant FC so I have to pull the battery
I can't figure out why I'm getting this error so If anyone can help I would appreciate it alot....Thanks
it's not just Rosie I cant get to work....It's any apk...I decompile and build and they dont work with non changes....any ideas?
Hey bro I just started a thread on this in the theming section I'm with you on the Rosie.apk can't get it to work.
I haven't done system apps before, but I have successfully used apktool. There is (if it's different or maybe I'm just losing my mind) and additional tool called apk manager that utilizes the apk tool. That's what I've used that's so successful. It basically just gives you a list of choices with what to do with your apk. All you do is place the apk in the specific folder where the script can reach it and then run he script, make your choices, and bam. You have what you want. That could be either a system apk, regular apk, or a folder that's been decompiled. (I used a tool after that called j2gui that let's you take the .classes file and see a near perfect reproduction of the original java code).
Jack Attack!
I have had my fair share of dealings with Rosie, but apktool can do the job.
Everything up to Step 3 is good, although I don't 'cd' into Rosie, I just run:
apktool b Rosie from the previous folder.
Anyway, system files like Rosie do not need to be signed so scrap that route. The issue you have is with the new Rosie.apk that's been compiled not containing the original META-INF folder so won't be accepted by the system.
Check out this post that describes in full what I am trying to say. You'll want to focus on Step 3 and onwards in that post
i'm trying to do the same thing and i'm having a ton of different problems.
I believe about a month ago I checked the Apktool website and checked their list of bugs. There is a really nasty bug in the newest version (at the time I read it) where if you generated your .apk, then some things would be written incorrectly and of course would be the reason why your apps no longer work.
I'm gonna suggest you all check what versions you have and go to the previous version which worked great, or they might have fixed that already.

[REQ] Need help decompiling/recompiling framework-res.apk

Could someone help walk me through this? I've decompiled/recompiled plenty of apks, however the framework-res.apk is being relatively stubborn. After recompiling the apk I get force closes in random areas of settings, etc.
I use apktool (as I need to edit an xml file's value), to decode, then build.
Are there any random steps I'm missing?
I've tried this over and over to get the same results everytime.
Someone said it is because of corrupted xml, and if so how do I prevent the problem from happening?
Anyway, thanks in advance.
Check out the theme guides in epic themes and apps forum, grab apk manager, the op says to decompile and recompile without making any changes as some apks can just be problematic and error. But you should be able to edit xmls (no pngs! Drag and drop after!) And recompile with no prob, use like notepad++ as windows notepad adds junk characters tat cause issues too.
Sent from my SPH-D700 using Tapatalk

Can't decompile SecSettings ApkTool

Hi
I try to decompile SecSettings by apktool and i get this:
Code:
C:\apktool>apktool d secsettings.apk SecSettings23
I: Baksmaling...
I: Loading resource table...
Exception in thread "main" brut.androlib.AndrolibException: Multiple resources:
spec=0x7f020052 drawable/avatar_default_6, config=-hdpi
at brut.androlib.res.data.ResConfig.addResource(ResConfig.java:65)
at brut.androlib.res.data.ResConfig.addResource(ResConfig.java:58)
at brut.androlib.res.decoder.ARSCDecoder.readEntry(ARSCDecoder.java:196)
at brut.androlib.res.decoder.ARSCDecoder.readConfig(ARSCDecoder.java:165
)
at brut.androlib.res.decoder.ARSCDecoder.readType(ARSCDecoder.java:130)
at brut.androlib.res.decoder.ARSCDecoder.readPackage(ARSCDecoder.java:10
5)
at brut.androlib.res.decoder.ARSCDecoder.readTable(ARSCDecoder.java:82)
at brut.androlib.res.decoder.ARSCDecoder.decode(ARSCDecoder.java:48)
at brut.androlib.res.AndrolibResources.getResPackagesFromApk(AndrolibRes
ources.java:315)
at brut.androlib.res.AndrolibResources.loadMainPkg(AndrolibResources.jav
a:50)
at brut.androlib.res.AndrolibResources.getResTable(AndrolibResources.jav
a:43)
at brut.androlib.Androlib.getResTable(Androlib.java:44)
at brut.androlib.ApkDecoder.getResTable(ApkDecoder.java:148)
at brut.androlib.ApkDecoder.decode(ApkDecoder.java:98)
at brut.apktool.Main.cmdDecode(Main.java:128)
at brut.apktool.Main.main(Main.java:65)
What to do ??
Thanks
Please any help?
Same issue here
osherdadon said:
Please any help?
Click to expand...
Click to collapse
Using a Note 3 from T-Mobile, I pulled the file with the adb command, with root explorer, and extracted it from the stock ROM file all giving me the same error. For some reason I also don't get any smali files out of my SystemUI.apk which has been driving me crazy. I can't seem to find any working answers yet... Fail...
Basically bumping this thread a half a year later...
SOMEONE HELP US
You have the relevant frameworks installed and java in your path?
Learned a lot in 24 hours
DSA said:
You have the relevant frameworks installed and java in your path?
Click to expand...
Click to collapse
Summary/Lessons Learned in the last 24 hours:
I must have been too tired, went to sleep got up again and went at it. I realized a few things, main thing was deodexing, I learned all about that. Converting the .odex file to a class.dex file inside the SystemUI.apk and SecSettings.apk so decompiling would work properly (I was originally missing the smali folder without deodexing my app). Second I needed to pull all the framework files from my device instead of just the two I had, then I used "apktool if framework-res.apk" then "apktool if twframework-res.apk" then "apktool d SystemUI.apk" then "apktool d SecSettings.apk". This time it actually worked, I proceeded to try and re-compile them just to test. The SystemUI.apk worked flawlessly but the the SecSettings.apk had errors then I realized I needed to copy the AndroidManifest.xml and resources.arsc from the original app to the decompiled folder and the SecSettings.apk compiled with no issues. I had to get the original file out of the stock ROM, it had gotten damaged somehow with zipping/raring/7zipping so quicktip no one should be zipping the files you're about to work on get it fresh from the ROM.
Current Issue:
Now that all that's done I'm onto what I was trying to get at when I started this whole project. I need to modify both of these apps which are now perfectly deodexed and on my stock device. Every time I try to modify these files I lose my status bar and my settings stop working, I'm obviously breaking it, this is the XDA guide I was following.
Any help or redirection on where to post would be greatly appreciated, thanks
Easiest thing - put your mod back in and get the status bar to disappear/fc whatever
Then, pull a log (catalog from appstore works fine)
Post that log at pastebin and link it here
We won't be able to solve your issue without knowing what it is, in the first place
Like this?
This was before I restarted: Log 1
Then I recorded for a little after I restarted probably pointless but that's where the error would have been: Log 2
DSA said:
Easiest thing - put your mod back in and get the status bar to disappear/fc whatever
Then, pull a log (catalog from appstore works fine)
Post that log at pastebin and link it here
We won't be able to solve your issue without knowing what it is, in the first place
Click to expand...
Click to collapse
Not sure exactly how to record it and send it to you, I pressed record but when the phone finished rebooting CatLog was closed so I reopened it and it keeps scrolling endlessly.
Research progressed a little
I came across a post here in the Flashlight Mod development thread which made me realize I'm not getting the ID's correct. They suggest compiling the modded SystemUI.apk to get the ID's into the apk file under the /res/values/public.xml file, then decompiling it to read the ID values. I'm missing a step or doing something wrong, I can't replicate it to find the ID values I need so I can add them to the .smali file and recompile a final time. I'm sure this is the only reason for the missing status bar and the force closes. I guess I need help understanding, a different set of instructions or just more detailed?
I can't post in that thread yet so I'm getting my posts up over here, I already posted in the Q&A thread but no one has responded yet, any help is greatly appreciated!
I get this when decompiling the modded apk: Modded SystemUI ApkTool Decompile
All these errors look like the file is broken now or something, I'm just lost at this point. I tried ApkTool 1.5.2 and 2.0 as well.
EDIT:
Additional info below for troubleshooting purposes since it seems my issue recompiling at the end to get the values for my public.xml
STEPS:
1. deodex (universal deodexer v5)
2. decompile (apktool 1.5.2 & 2.0 separate tests)
3. modify (add flashlight .png's and .smali file from 4.4kk flashlight mod files)
4. recompile (apktool)
5. decompile (apktool)
=
Errors <<<<< These errors solved in edit below
EDIT:
I forgot to use "apktool if SystemUI.apk" when loading "framework-res.apk" & "twframework-res.apk" now I get through decompiling and recompiling like I thought I should be and I even located the values int he public.xml, replaced them in the .smali and everything went peachy. Only problem is I never get the status bar after I reboot, not really getting any FC's but the status bar, if my goal were to get it to be invisible I would be so happy omg lol If you're curious I've also tested by signing and even another test with zipalign, nothing zip/zero/zilch...
EDIT... Again I know still no sleep, durp durp:
So my main issue was not using apktool v1.5.2 to decompile and v2.0 to compile EVERY SINGLE TIME, NO EXCEPTIONS. When I followed that simple rule I get it onto my device and she has no status bar... Hmmmmm..... And a logcat for anyone smart enough to help me
EDIT:
Maybe I'm in the right direction with an error I saw in the log at this post? I thought it was so I installed the DisableSignatureVerification Mod from the Xposed Modules and still nothing.
Calling All Developers
It's been like 2 weeks just curious if anyone has even looked at this, I haven't been able to make any progress so I started learning how to develop apps. I made two small apps basic flashlight and a counter app but I really want to know why I'm totally unable to mod a file on my phone. I can't get the ink effect to work with finger input either I've been really trying to get this flashlight mod and the ink effect for months. If I could get pointed in the direction of a developer that can actually help me I don't see why I couldn't donate like $10 or $20 to the one who helps me. I'm on android 4.4.2 (NK3) on my Note 3 from T-Mobile.

[GUIDE] Remove/change gradient on navbar and statusbar- Change navbar icons [ROOT]

A very simple guide on removing the disgusting shadow effect on the homescreen, plus changing the icons in the navbar.
EDIT: Useless guide. Every change can be made using themes. Coming from a N5 confuses me too much. Thanks @vobiscum
Since usually we would make this changes in xposed, and since xposed is not aviable (for now, I hope), we need to change some png images in the SystemUi.apk container located in #/system/priv-app/systemui folder.
This is just one way to achieve our goal, I made it supereasy for beginners.
Attention: don't extract and compress again any system apks with 7zip or similar programs: it will result in a bootloop. Just replace the needed images directly in the container. If you need to do something else, google APK-Tool.
1)Get a root explorer from googleplay. I'm using FX File Manager (it needs a plugin for root privileges);
2)Go to #/system/priv-app/systemui folder and copy systemui.apk;
3)Paste it in a pc-redeable partition or in the external sd;
4)Get the file and extract it with 7zip or winrar. Don't delete the systemui.apk imported.
5)Navigate in the excracted folder and get the files you want.
---Gradients are located in res/drawable-xxhdpi-v4, their names are: nav_background.9.png and status_background.9.png.
---Navbar Icons are located in res/drawable-xxhdpi-v4 and drawable-ldrtl-xxhdpi-v4.
6)Open the files with Photoshop or Gimp and edit them on your taste. Want a ghost navbar? Do it.
7) Drag and drop the modified files in the Systemui.apk according to their original locations;
8)Put the modified file on your sd/phone;
9)IMPORTANT: DO A BACKUP VIA TWRP
10)Copy-paste via root-explorer the SystemUi.apk back in place. It may be requested to remount the folder in r/w.
11) DONE! If you get some lag/problems, just reboot. If it bootloops, go for twrp.
nice work there, some genuinely earned thanks :good:
it will result in a bootloop
Click to expand...
Click to collapse
i guess this is to do with the odexed apk's..?
sminki said:
i guess this is to do with the odexed apk's..?
Click to expand...
Click to collapse
I think that is to do with zipaligning, but don't ask me further, I'm pretty noob about this. I know that many apks works well even after they are recompiled as a zip; but some resources need a particular procedure. This way avoids any problem due to recompiling.
For editing xml, I generally use APKtool and replace the original META-INF folder and AndroidManifest.xml, this is the proper way to recompile it (http://forum.xda-developers.com/showthread.php?t=2203166).
Smokehrbar88 said:
I think that is to do with zipaligning, but don't ask me further, I'm pretty noob about this. I know that many apks works well even after they are recompiled as a zip; but some resources need a particular procedure. This way avoids any problem due to recompiling.
For editing xml, I generally use APKtool and replace the original META-INF folder and AndroidManifest.xml, this is the proper way to recompile it (http://forum.xda-developers.com/showthread.php?t=2203166).
Click to expand...
Click to collapse
Man made a theme is too easy no need root
https://plus.google.com/+MassimoBotta/posts/27CAAv91Lth
vobiscum said:
Man made a theme is too easy no need root
https://plus.google.com/+MassimoBotta/posts/27CAAv91Lth
Click to expand...
Click to collapse
So you can change navbar icons with a theme? Well, damn me. Damn Haweii. How about other pngs in SystemUi.apk (for example the gradient?)
Not useless, and to be honest, I prefer getting my hands dirty pulling things apart rather than relying on other people, gives you a better understanding of how things work

Need Help Trying to Modify and Recompile SystemUI APK [Android 7.1.1] [Stock]

Hey all.
I'm trying to modify my SystemUI.apk on stock Android 7.1.1 to remove the regular system clock and add the text clock, as well as hiding the VPN icon. On previous versions of Android, I simply used apktool to decompile the SystemUI.apk and framework-res.apk, made my necessary modifications to the res folder, and then recompiled with apktool.
However, I couldn't get that to work on Android 7.1.1, and I started following this guide: http://chromloop.com/2016/11/guide-how-to-port-pixel-navigation-bar-animation-to-your-phone/
Except I still can't get my modifications to work. When I follow the necessary steps and replace my SystemUI.apk, the statusbar and navigation bar are no longer rendered on my phone. And flashing back to stock SystemUI causes the phone to crash repeatedly with an error message of "SystemUI failed to start."
Can anyone kindly point me in the right direction?
Thanks!
SiliconMage said:
Hey all.
I'm trying to modify my SystemUI.apk on stock Android 7.1.1 to remove the regular system clock and add the text clock, as well as hiding the VPN icon. On previous versions of Android, I simply used apktool to decompile the SystemUI.apk and framework-res.apk, made my necessary modifications to the res folder, and then recompiled with apktool.
However, I couldn't get that to work on Android 7.1.1, and I started following this guide: http://chromloop.com/2016/11/guide-how-to-port-pixel-navigation-bar-animation-to-your-phone/
Except I still can't get my modifications to work. When I follow the necessary steps and replace my SystemUI.apk, the statusbar and navigation bar are no longer rendered on my phone. And flashing back to stock SystemUI causes the phone to crash repeatedly with an error message of "SystemUI failed to start."
Can anyone kindly point me in the right direction?
Thanks!
Click to expand...
Click to collapse
You'll need to flash stock img, nothing else i tried worked. I was farting around with both files and systemui stopped working for me after as well. I was just trying to change the framework-res colors. But using the recompiled apk crashed the UI even after replacing it.
StarRavier said:
You'll need to flash stock img, nothing else i tried worked. I was farting around with both files and systemui stopped working for me after as well. I was just trying to change the framework-res colors. But using the recompiled apk crashed the UI even after replacing it.
Click to expand...
Click to collapse
Cool, thanks. Did that get your colors working as well, or no?
SiliconMage said:
Cool, thanks. Did that get your colors working as well, or no?
Click to expand...
Click to collapse
I can change them with zips provided here. http://forum.xda-developers.com/nexus-6p/themes-apps/mod-theme-nmf26f-various-framework-res-t3515739
But I want to do it myself at least so i understand how to modify systemui instead of using user provided zips
Same here, man, same here. Thanks.
I received a response from sharkie405 and I was able to fix my issue by simply adding the -c command to the end of the apktool build command. The "-c" preserves the signing of the original jar, which is necessary for validating the recompiled jar file.
So after I made the necessary modifications to my xml files, I did: java -jar apktool b SystemUI -c

Categories

Resources