[Q/SOLVED] Decompiling Gallery2.apk (4.2.2 CM rom) - Galaxy S III Q&A, Help & Troubleshooting

Hey guys, trying to recompile Gallery2.apk from a 4.2.2 custom ROM but I can't seem to find the appropriate framework to compile against.
Using apktool, tried pulling the framework-res.apk from the ROM itself but still can't get it to compile. The error I keep getting is:
Gallery2.apk\res\values\styles.xml:148: error: Error retrieving parent for item: No resource found that matches the given name 'TextAppearance'.
Tried various framework files but still no luck.
Any ideas?
EDIT: Now I feel stupid for opening this thread, found an answer: go to the aforementioned file (res\values\styles.xml) line 148 and edit where:
<style name="TextAppearance.DialogWindowTitle"> change to : <style name="TextAppearance.DialogWindowTitle" parent="@*android:style/TextAppearance.DialogWindowTitle"> Have no idea why this is the way it is but it works for me :|

Related

[Q] Help with ApkTool and WhatsApp

Hi people!!
I followed some tutorials to try to customize my WhatsApp app, just wanted to change the icon to start.
I'm doing this, I put whatsapp.apk inside apktool directory and this to cmd:
Code:
apktool.bat d WhatsApp.apk app
this makes a folder app that inside have de decompiled code of whatsapp and works ok.
Then, i go to res, and open icon.png, make a color change, and then save changes.
So, when I'm trying to recompile with:
Code:
apktool.bat b c:\apktool\app whats.apk
fails and shows this:
Code:
I: Building resources...
c:\apktool\app\res\layout-large\abs__action_mode_close_item.xml:5: error: No res
ource identifier found for attribute 'textAllCaps' in package 'android'
.....
And more errors.
It's the first app I'm trying to decompile, i have the latest android sdk-apktool and java jdk.
Thanks You.

[Q]Compile Error / Statusbar transparent [Q]

Hello XDA-Team,
I've got a Problem with the APK-Multi tool.
I want my Statusbar Transparent and decompile the Systemui.apk and write the new code into the status_bar.xml and status_bar_expand.xml.
The Code are in this thread http://forum.xda-developers.com/showthread.php?t=2168515
And now my Problem is, the APK-Multi-tool don't compile the source into a apk.
"An Error Occured, Please Check The Log <option 21>"
The Option 21 is for selecting compression level for apk's.
In the log file the Code:
W: Could not find Sources
I: Checking whether resources has changed..
I: Building resources..
I don't know what a can do now.
I set the level from 0 to 9 but the compile process failure always.
Sorry for my bad english
Phone: Samsung Galaxy S3 With Root access
Version : 4.2.2 FME7
Kernel: Stock
Thank you

Need Help to recompile custom-framwork-res.apk

Whenever i tried to recompile any custom framework-res.apk (like oppo-framework-res.apk, oxygen-framework-res.apk, lenovo-res.apk, vivo-res.apk) i got error
errors are like:
W: Could not find sources
oxygen-framework-res.apk\res\layout\preference_dialog_colorpicker.xml:4: error: Error: No resource found that matches the given name (at 'id' with value '@id/colors_row_1').
preference_dialog_colorpicker.xml:6: error: Error: No resource found that matches the given name (at 'id' with value '@id/check_0'
oxygen-framework-res.apk\AndroidManifest.xml]
at brut.androlib.Androlib.buildResourcesFull(Androlib.java:465)
at brut.androlib.Androlib.buildResources(Androlib.java:403)
at brut.androlib.Androlib.build(Androlib.java:291)
at brut.androlib.Androlib.build(Androlib.java:261)
at brut.apktool.Main.cmdBuild(Main.java:225)
at brut.apktool.Main.main(Main.java:84)
No issue with decompile
I can decompile and recompile any other apps including framework-res.apk, just problem xxxy-framework-res.apk
please help...
how decompile framwork-res.apk?
pradeepsmehra said:
Whenever i tried to recompile any custom framework-res.apk (like oppo-framework-res.apk, oxygen-framework-res.apk, lenovo-res.apk, vivo-res.apk) i got error
errors are like:
W: Could not find sources
oxygen-framework-res.apk\res\layout\preference_dialog_colorpicker.xml:4: error: Error: No resource found that matches the given name (at 'id' with value '@id/colors_row_1').
preference_dialog_colorpicker.xml:6: error: Error: No resource found that matches the given name (at 'id' with value '@id/check_0'
oxygen-framework-res.apk\AndroidManifest.xml]
at brut.androlib.Androlib.buildResourcesFull(Androlib.java:465)
at brut.androlib.Androlib.buildResources(Androlib.java:403)
at brut.androlib.Androlib.build(Androlib.java:291)
at brut.androlib.Androlib.build(Androlib.java:261)
at brut.apktool.Main.cmdBuild(Main.java:225)
at brut.apktool.Main.main(Main.java:84)
No issue with decompile
I can decompile and recompile any other apps including framework-res.apk, just problem xxxy-framework-res.apk
please help...
Click to expand...
Click to collapse
ARe you installing all the frameworks files? Could be that apktool is not updated to work with that os. It is a common thing with china based OS that they make changes that apktool cant and wont support.
zelendel said:
ARe you installing all the frameworks files? Could be that apktool is not updated to work with that os. It is a common thing with china based OS that they make changes that apktool cant and wont support.
Click to expand...
Click to collapse
Thanks for reply ,
buddy i am using latest apktool version 2.02
only two framework are available in ROM both are installed.
yes ..i was thinking same that they are modding apk so that apktool not able to do re-engineering.
i also post error in apktool thread in github lets see if iBoatPaches will add support in next version of apktool ...
Have you tried installing systemui as well as the frameworks? It might be worth a shot usually helps with dummy files
Sent from my SM-N920C using Tapatalk
sawdoctor said:
Have you tried installing systemui as well as the frameworks? It might be worth a shot usually helps with dummy files
Sent from my SM-N920C using Tapatalk
Click to expand...
Click to collapse
yes buddy, i also tried that..
if i tried recompile in normal way its giving very log error log. then i tried to rename framework-res.apk into 1.apk and oxygen-framework-res.apk into 2.apk and place them c:/apktool/
now the error log is short, only 4xml value showing no resource.
C:\apktool\oxygen-framework-res\res\values\styles.xml:40: error: Error retrieving parent for item: No resource found that matches the given name '@android:style/Theme.Material.BaseDialog'.
C:\apktool\oxygen-framework-res\res\values\styles.xml:44: error: Error retrieving parent for item: No resource found that matches the given name'@android:style/Theme.Material.Dialog.BaseAlert'.
C:\apktool\oxygen-framework-res\res\values\styles.xml:51: error: Error retrieving parent for item: No resource found that matches the given name '@android:style/Theme.Material.SearchBar'.
C:\apktool\oxygen-framework-res\res\values\styles.xml:54: error: Error retrieving parent for item: No resource found that matches the given name '@android:style/Theme.Material.CompactMenu'.
pradeepsmehra said:
yes buddy, i also tried that..
if i tried recompile in normal way its giving very log error log. then i tried to rename framework-res.apk into 1.apk and oxygen-framework-res.apk into 2.apk and place them c:/apktool/
now the error log is short, only 4xml value showing no resource.
C:\apktool\oxygen-framework-res\res\values\styles.xml:40: error: Error retrieving parent for item: No resource found that matches the given name '@android:style/Theme.Material.BaseDialog'.
C:\apktool\oxygen-framework-res\res\values\styles.xml:44: error: Error retrieving parent for item: No resource found that matches the given name'@android:style/Theme.Material.Dialog.BaseAlert'.
C:\apktool\oxygen-framework-res\res\values\styles.xml:51: error: Error retrieving parent for item: No resource found that matches the given name '@android:style/Theme.Material.SearchBar'.
C:\apktool\oxygen-framework-res\res\values\styles.xml:54: error: Error retrieving parent for item: No resource found that matches the given name '@android:style/Theme.Material.CompactMenu'.
Click to expand...
Click to collapse
Have you tried a different apktool? I had to switch back to android 2.00 to decompile marshmallow framework
Sent from my SM-N920C using Tapatalk
sawdoctor said:
Have you tried a different apktool? I had to switch back to android 2.00 to decompile marshmallow framework
Sent from my SM-N920C using Tapatalk
Click to expand...
Click to collapse
yes i tried 2.0 also...
pradeepsmehra said:
yes i tried 2.0 also...
Click to expand...
Click to collapse
if any body can help, please here is the uploaded framework files. and error log
http://pastebin.com/KPbExsRE
https://drive.google.com/file/d/0B4wqBB_yOlMwNGh0YzZoWlFmSEk/view?usp=sharing

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)

[Question] How to remove the Discover page on Snapchat ?

Hello,
I would like to remove Snapchat Discover and stories.
I found that it might be possible by reverse engineering Snapchat's code, so I installed apktool, dex2jar and jd-gui and I converted the apk to a jar file, but I ran into issues that I couldn't fix :
- can not merge I and Z (best solution I found, but I don't know how to modify the dex by hand or modify the dex2jar code)
- and when I tried to decompile the apk using apktool, the command prompt displayed this :
I: Using Apktool 2.5.0 on Snapchat.apk
I: Loading resource table...
Exception in thread "main" brut.androlib.AndrolibException: Invalid chunk type: expected=0x00000200, got=0x00000203
at brut.androlib.res.decoder.ARSCDecoder.checkChunkType(ARSCDecoder.java:544)
at brut.androlib.res.decoder.ARSCDecoder.readTablePackage(ARSCDecoder.java:88)
at brut.androlib.res.decoder.ARSCDecoder.readTableHeader(ARSCDecoder.java:82)
at brut.androlib.res.decoder.ARSCDecoder.decode(ARSCDecoder.java:48)
at brut.androlib.res.AndrolibResources.getResPackagesFromApk(AndrolibResources.java:790)
at brut.androlib.res.AndrolibResources.loadMainPkg(AndrolibResources.java:67)
at brut.androlib.res.AndrolibResources.getResTable(AndrolibResources.java:59)
at brut.androlib.Androlib.getResTable(Androlib.java:66)
at brut.androlib.ApkDecoder.setTargetSdkVersion(ApkDecoder.java:236)
at brut.androlib.ApkDecoder.decode(ApkDecoder.java:118)
at brut.apktool.Main.cmdDecode(Main.java:179)
at brut.apktool.Main.main(Main.java:82)
Click to expand...
Click to collapse
All in all... I have no idea what I'm doing and since I'd rather not waste time with trial and error, I would really appreciate it if someone could tell me if this is even possible and give me some advice.
Thanks in advance, cheers

Categories

Resources