Recompling apk using apktool wont work - Android Q&A, Help & Troubleshooting

I'm decompiling and recompiling framework-res.apk without any changes using apktool but new apk wont work after recompiling.
Steps I have follow is below
java -jar apktool.jar d framework-res.apk
java -jar apktool.jar b framework-res framework-res_new.apk
java -jar signapk.jar testkey.x509.pem testkey.pk8 framework-res_new.apk framework-res.apk
I have copied signed framework-res.apk to /system/framework but after this I'm getting boot animation even I have rebooted my system but always got bootanimation screen
I'm using Apktool v1.5.2 and aapt v0.2.
Which thing I'm doing wrong here?

Related

Unable to deodex SystemUI.odex

I have not been able to deodex the SystemUI.odex to be able to modify smali, I always get the below error. I've been able to successfully deodex the Settings.odex, but every SystemUI.odex I've tried always gives me the same error. I was originally using baksmali-1.3.0, then tried 1.3.2 and even tried a 1.3.3 jar that m!k3 over in the One S forums compiled, but all give the same result. Anyone know how to get around this error?
C:\Android Stuff\Phones\EVO LTE\working1>baksmali -d framework -x SystemUI.odex
Error occured while loading boot class path files. Aborting.
org.jf.dexlib.Code.Analysis.ClassPath$ClassNotFoun dException: Could not find superclass Lcom/htc/fusion/fx/MessageListener;
at org.jf.dexlib.Code.Analysis.ClassPath$ClassDef.loa dSuperclass(ClassPath.java:832)
at org.jf.dexlib.Code.Analysis.ClassPath$ClassDef.<in it>(ClassPath.java:685)
at org.jf.dexlib.Code.Analysis.ClassPath.loadClassDef (ClassPath.java:282)
at org.jf.dexlib.Code.Analysis.ClassPath.initClassPat h(ClassPath.java:163)
at org.jf.dexlib.Code.Analysis.ClassPath.InitializeCl assPathFromOdex(ClassPath.java:110)
at org.jf.baksmali.baksmali.disassembleDexFile(baksma li.java:104)
at org.jf.baksmali.main.main(main.java:293)
Error while loading class Lcom/android/systemui/recent/RecentAppFxActivity$10; from file SystemUI.odex
Error while loading ClassPath class Lcom/android/systemui/recent/RecentAppFxActivity$10;
I suggest to you that you use this pack for deodex...
or use the baksmali.jar inside...is better and works fine for me with my cellular.
first copy the entire folder from your \system\framework to the same path of the baksmali.jar
and use this command to deodex
java -Xmx1024m -jar baksmali.jar -c :framework.jar -x SystemUI.odex
java -Xmx1024m -jar smali.jar out -o classes.dex
http://forum.xda-developers.com/showthread.php?t=1208320
debarron said:
I have not been able to deodex the SystemUI.odex to be able to modify smali, I always get the below error. I've been able to successfully deodex the Settings.odex, but every SystemUI.odex I've tried always gives me the same error. I was originally using baksmali-1.3.0, then tried 1.3.2 and even tried a 1.3.3 jar that m!k3 over in the One S forums compiled, but all give the same result. Anyone know how to get around this error?
C:\Android Stuff\Phones\EVO LTE\working1>baksmali -d framework -x SystemUI.odex
Error occured while loading boot class path files. Aborting.
org.jf.dexlib.Code.Analysis.ClassPath$ClassNotFoun dException: Could not find superclass Lcom/htc/fusion/fx/MessageListener;
at org.jf.dexlib.Code.Analysis.ClassPath$ClassDef.loa dSuperclass(ClassPath.java:832)
at org.jf.dexlib.Code.Analysis.ClassPath$ClassDef.<in it>(ClassPath.java:685)
at org.jf.dexlib.Code.Analysis.ClassPath.loadClassDef (ClassPath.java:282)
at org.jf.dexlib.Code.Analysis.ClassPath.initClassPat h(ClassPath.java:163)
at org.jf.dexlib.Code.Analysis.ClassPath.InitializeCl assPathFromOdex(ClassPath.java:110)
at org.jf.baksmali.baksmali.disassembleDexFile(baksma li.java:104)
at org.jf.baksmali.main.main(main.java:293)
Error while loading class Lcom/android/systemui/recent/RecentAppFxActivity$10; from file SystemUI.odex
Error while loading ClassPath class Lcom/android/systemui/recent/RecentAppFxActivity$10;
Click to expand...
Click to collapse

[Q] Unable to deodex SystemUI.odex

Hi Guys..
I have not been able to deodex the SystemUI.odex to be able to modify smali, I always get the below error.
Code:
C:\I9300>java -Xmx1024m -jar baksmali-1.3.3.jar -d framework -x systemui.od
ex
Error occured while loading boot class path files. Aborting.
org.jf.dexlib.Code.Analysis.ClassPath$ClassNotFoundException: Could not find int
erface Lcom/sec/android/app/minimode/manager/MiniModeAppCallback$OnFocusChangedC
allback;
at org.jf.dexlib.Code.Analysis.ClassPath$ClassDef.loadAllImplementedInte
rfaces(ClassPath.java:867)
at org.jf.dexlib.Code.Analysis.ClassPath$ClassDef.<init>(ClassPath.java:
692)
at org.jf.dexlib.Code.Analysis.ClassPath.loadClassDef(ClassPath.java:282
)
at org.jf.dexlib.Code.Analysis.ClassPath.initClassPath(ClassPath.java:16
3)
at org.jf.dexlib.Code.Analysis.ClassPath.InitializeClassPathFromOdex(Cla
ssPath.java:110)
at org.jf.baksmali.baksmali.disassembleDexFile(baksmali.java:104)
at org.jf.baksmali.main.main(main.java:297)
Error while loading class Lcom/android/systemui/statusbar/tablet/MiniModeAppsPan
el$1; from file systemui.odex
Error while loading ClassPath class Lcom/android/systemui/statusbar/tablet/MiniM
odeAppsPanel$1;
I've been able to successfully deodex the SecSettings.odex, but every SystemUI.odex I've tried always gives me the same error.
Anyone know how to get around this error?
I was trying to deodex SecContacts.odex. I received same error. I put only SecContacts.apk and SecContacts.odex in the dir. is that the problem? what file else do I need to put?
Error occured while loading boot class path files
~~
a bug of the baksmali, that it won't load certain classes when using -x option
so you should add the code "-c :what-you-need.odex"
ie. : java -Xmx1024m -jar baksmali-1.3.3.jar -d framework -c :minimode.odex -x systemui.odex
make sure you have copy the needed odex file to the folder within systemui.odex...
and sorry for my bad english...

Need Help Modifying and Recompiling Settings.APK

Hello there, as of late, I've been trying to exploit the Settings.APK on the HTC One M9 (specifically the verizon version, although the APKs are the same there is just a value on the device itself that is different which triggers the "block" on the APK), as you can see here:
http://forum.xda-developers.com/ver...verizon-enable-oem-lock-t3281994#post64568917
I've discovered that it is possible to patch/overwrite the existing Settings.APK with adb install -r -d (overwrite and downgrade), even a modified one I've worked on with APKTools (without root). However, I've run into several issues, mainly modifying the java code and getting it to recompile (with the APK Multi-Tool I'm using to compile "system APK files) WITH the apk.
What I mean to say is that when I place the java code in /src it will compile but I don't see the changes taking effect.
EDIT: Now when I try to compile I get an error.
Code:
Building Apk
I: Using Apktool 2.0.1-825476-SNAPSHOT
I: Checking whether sources has changed...
I: Building java sources...
"An Error Occurred, Please Check The Log (option 26)"
Press any key to continue . . .
java version "1.8.0_66"
Java(TM) SE Runtime Environment (build 1.8.0_66-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.66-b17, mixed mode)
A subdirectory or file modified-system-apk-files-here already exists.
Exception in thread "main" java.lang.UnsupportedOperationException: Not yet implemented
at brut.androlib.java.AndrolibJava.build(AndrolibJava.java:32)
at brut.androlib.Androlib.buildSourcesJava(Androlib.java:390)
at brut.androlib.Androlib.buildSources(Androlib.java:299)
at brut.androlib.Androlib.build(Androlib.java:282)
at brut.androlib.Androlib.build(Androlib.java:256)
at brut.apktool.Main.cmdBuild(Main.java:225)
at brut.apktool.Main.main(Main.java:84)
EDIT EDIT: Apparently I need the smali code instead. I'm going to try to convert java to smali and hopes this works. Fingers crossed!
APKTools is having an issue decompiling the resources in the first place,
Code:
C:\Program Files (x86)\Minimal ADB and Fastboot\modified settings>java -jar apktool.jar d Settings.apk
I: Using Apktool 2.0.2 on Settings.apk
I: Loading resource table...
Exception in thread "main" brut.androlib.AndrolibException: Multiple resources: spec=0x7f100000 bool/config_allow_edit_carrier_enabled, config=[DEFAULT]
at brut.androlib.res.data.ResConfig.addResource(ResConfig.java:63)
at brut.androlib.res.data.ResConfig.addResource(ResConfig.java:56)
at brut.androlib.res.decoder.ARSCDecoder.readEntry(ARSCDecoder.java:223)
at brut.androlib.res.decoder.ARSCDecoder.readConfig(ARSCDecoder.java:191)
at brut.androlib.res.decoder.ARSCDecoder.readType(ARSCDecoder.java:159)
at brut.androlib.res.decoder.ARSCDecoder.readPackage(ARSCDecoder.java:116)
at brut.androlib.res.decoder.ARSCDecoder.readTable(ARSCDecoder.java:78)
at brut.androlib.res.decoder.ARSCDecoder.decode(ARSCDecoder.java:47)
at brut.androlib.res.AndrolibResources.getResPackagesFromApk(AndrolibResources.java:544)
at brut.androlib.res.AndrolibResources.loadMainPkg(AndrolibResources.java:63)
at brut.androlib.res.AndrolibResources.getResTable(AndrolibResources.java:55)
at brut.androlib.Androlib.getResTable(Androlib.java:65)
at brut.androlib.ApkDecoder.setTargetSdkVersion(ApkDecoder.java:197)
at brut.androlib.ApkDecoder.decode(ApkDecoder.java:96)
at brut.apktool.Main.cmdDecode(Main.java:165)
at brut.apktool.Main.main(Main.java:81)
which leaves me with a resources.arsc presumably containing many files I need. I've downloaded APKtoJava_RC2, and managed to decompile it into java code using that (and I'm not sure if the classes.dex matters), and modify the APK to where I can enable the OEM unlock feature, but I need to recompile it. I'm trying to recompile the thing, but I'm running into issues (I've tried putting the modified java in src and deleting the resources.arsc when compiling) when installing.
EDIT EDIT EDIT: I've just been trying to edit the SMALI code to let me access the OEM unlock, I guess it's going to be trial and error for me. :v
So, here's what I need to do, in all essentiality:
1. Decompile Settings.APK to the point where I can modify it.
2. Recompile Settings.APK with the same signature.
I'm not sure if this is possible (editing the java while keeping the same signature), but root is NOT an option.
If anyone is willing to give me some insight, I'd really appreciate it.
Ok, so I know how to modidy the .smali, everything would work fine, if not for this final step.
I'm getting [INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION] when I extract the .smali files from the classes.dex, and then recompile the .smali files into my own classes.dex-- EVEN IF I DON'T MODIFY THE .SMALI files. There is either an issue with extraction or compilation (maybe both)-- and I've tried several programs, and several methods.
EDIT: http://leonjza.github.io/blog/2015/...re-into-android-reversing-and-smali-patching/
Shows me that it has something to do with the signature. I'll see what I can do.
EDIT EDIT: Further research shows http://www.herongyang.com/Android/Project-META-INF-Files-Digest-Signature-and-Certificate.html that I MIGHT have to somehow get the certificate to work with the modified file properly. God help me now. I assume I'm not the first person to run into the certificate roadblock. Must find a way.
For all the heavens I can't seem to find a way to edit the .dex file in a way that leaves the certificate intact-- I suppose this is why the system was developed in the first place. Back to square one again, I suppose. (Or to giving up and buying a XTC 2 Clip)

Reverse Engineer apk and install again

I'm having trouble modifying an app and installing it again
Here are the steps I've taken to modify the app "AppToModify"
Copy the apk file from my phone in data/app location to my laptop
Use apktool to unpack the app
Code:
java -jar apktool.jar d AppToModify.apk
Go in the AppToModify folder and make a change (there's a Strings.xml file and I simply changed a text just to see if it works)
Pack the app with apktool
Code:
java -jar apktool.jar b apptomodify -o ~/Downloads/SignApk/app_to_modify_new_unsigned.apk
Either sign the app with signapk
Code:
java -jar signapk.jar certificate.pem key.pk8 /app_to_modify_new_unsigned.apk
or with uber-apk-signer
Code:
java -jar uber-apk-signer-1.1.0.jar -a apktool_workstation/app_to_modify_new_unsigned.apk
Move the app back to my phone and install
Error: App not installed
Am I missing something?
Tools and Specs
OS: Mac Sierra
Apktool v2.4.1
uber-apk-signer-1.1.0.jar
SignApk
Java(TM) SE Runtime Environment (build 1.8.0_111-b14)
Click to expand...
Click to collapse
sorry had it in the wrong section, I hope this section can help me

Android 12, possible to decompile framework-res.apk?

EDIT: This was a apktool problem (multi-package resources), when decoding framework-res.apk from lineageOS 19.1(android 12).
When I use apktool 2.7 to decompile framework-res.apk I get the following.
apktool d framework-res.apk
gives a res/values folder but with 3 files with with hardly any data.
apktool d -r -s framework-res.apk
gives lost of files and folders but no res/values folder
Does res/values/arrays.xml exist in Android 12? Is it possible to decompile and view the arrays.xml using apktool?

Categories

Resources