[Q] APK Manager cant decompile Settings.apk - Motorola Milestone Android Development

Hey there,
I want to edit the Settings.apk (stock from FroyoMOD 2.8.0.b) but there is a error given :/
Log is the following:
Code:
java version "1.6.0_26"
Java(TM) SE Runtime Environment (build 1.6.0_26-b03)
Java HotSpot(TM) Client VM (build 20.1-b02, mixed mode, sharing)
Der Befehl "adb" ist entweder falsch geschrieben oder
konnte nicht gefunden werden.
D:\apk_manager_4.9\place-apk-here-for-modding\../place-apk-here-for-modding/sign
edSettings.apk konnte nicht gefunden werden
D:\apk_manager_4.9\place-apk-here-for-modding\../place-apk-here-for-modding/unsi
gnedSettings.apk konnte nicht gefunden werden
I: Baksmaling...
I: Loading resource table...
W: Skipping "android" package group
I: Loaded.
I: Loading resource table from file: D:\apktool\framework\1.apk
I: Loaded.
I: Decoding file-resources...
I: Decoding values*/* XMLs...
Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String ind
ex out of range: 17
at java.lang.String.charAt(Unknown Source)
at brut.androlib.res.xml.ResXmlEncoders.findNonPositionalSubstitutions(R
esXmlEncoders.java:165)
at brut.androlib.res.xml.ResXmlEncoders.enumerateNonPositionalSubstituti
ons(ResXmlEncoders.java:142)
at brut.androlib.res.data.value.ResStringValue.encodeAsResXmlValue(ResSt
ringValue.java:45)
at brut.androlib.res.data.value.ResArrayValue.serializeToResValuesXml(Re
sArrayValue.java:55)
at brut.androlib.res.AndrolibResources.generateValuesFile(AndrolibResour
ces.java:264)
at brut.androlib.res.AndrolibResources.decode(AndrolibResources.java:137
)
at brut.androlib.Androlib.decodeResourcesFull(Androlib.java:93)
at brut.androlib.ApkDecoder.decode(ApkDecoder.java:98)
at brut.apktool.Main.cmdDecode(Main.java:120)
at brut.apktool.Main.main(Main.java:57)
Can you help me?
I tried different apktool.jar, but didnt help.
Thanks!
Nik

You should first use the command given below before you can decompile system apps.
Code:
apktool if framework-res.apk
Put the framework-res.apk in the same folder as apktool and give the command in cmd. Then try decompiling system.apk.

Thanks for your help so far!
My structure looks like:
c:\ apkmanager\ other\ apktools stuff
c:\ apkmanager\ place-apk-here-for-modding\ Settings.apk
c:\ apkmanager\ other\ framework-res.apk
I ran
Code:
apktool if framework-res.apk
and I was told that the framework was installed.
In apkmanager I have choosen my project (#22), selected the Settings.apk (#1) and wanted to decompile (#9).
Thats what the log tells me
Code:
java version "1.6.0_26"
Java(TM) SE Runtime Environment (build 1.6.0_26-b03)
Java HotSpot(TM) Client VM (build 20.1-b02, mixed mode, sharing)
Der Befehl "adb" ist entweder falsch geschrieben oder
konnte nicht gefunden werden.
C:\apk_manager\place-apk-here-for-modding\../place-apk-here-for-modding/signedSettings.apk konnte nicht gefunden werden
C:\apk_manager\place-apk-here-for-modding\../place-apk-here-for-modding/unsignedSettings.apk konnte nicht gefunden werden
I: Baksmaling...
I: Loading resource table...
W: Skipping "android" package group
I: Loaded.
I: Loading resource table from file: C:\Dokumente und Einstellungen\Hiwi.HIWI-PC\apktool\framework\1.apk
I: Loaded.
I: Decoding file-resources...
I: Decoding values*/* XMLs...
Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: 17
at java.lang.String.charAt(Unknown Source)
at brut.androlib.res.xml.ResXmlEncoders.findNonPositionalSubstitutions(ResXmlEncoders.java:165)
at brut.androlib.res.xml.ResXmlEncoders.enumerateNonPositionalSubstitutions(ResXmlEncoders.java:142)
at brut.androlib.res.data.value.ResStringValue.encodeAsResXmlValue(ResStringValue.java:45)
at brut.androlib.res.data.value.ResArrayValue.serializeToResValuesXml(ResArrayValue.java:55)
at brut.androlib.res.AndrolibResources.generateValuesFile(AndrolibResources.java:264)
at brut.androlib.res.AndrolibResources.decode(AndrolibResources.java:137)
at brut.androlib.Androlib.decodeResourcesFull(Androlib.java:93)
at brut.androlib.ApkDecoder.decode(ApkDecoder.java:98)
at brut.apktool.Main.cmdDecode(Main.java:120)
at brut.apktool.Main.main(Main.java:57)
I have no problems in decompiling a GB framework...
Thanks for any help!

I found a apktool.jar that works fine for me!
Sadly i cant find the thread anymore, so I uploaded it, just for other guys havin trouble with apk manager like me...
https://rapidshare.com/files/2340789700/apktool.jar

The last time i downloaded apktool from here, and i got same problem as your. Then i used the old package and every thing work fine!

When I try to run the code below in the command window
apktool if framework-res.apk
I get
'apktool' is not recognized as an internal or external command,
operable program or batch file.
What am I doing wrong? I need to decompile a settings.apk without errors.

jboxer said:
When I try to run the code below in the command window
apktool if framework-res.apk
I get
'apktool' is not recognized as an internal or external command,
operable program or batch file.
What am I doing wrong? I need to decompile a settings.apk without errors.
Click to expand...
Click to collapse
Did you download apktool? Also use apktool 1.4.2.
Sent from my GT-I9100 using Tapatalk

sileshnair said:
Did you download apktool? Also use apktool 1.4.2.
Sent from my GT-I9100 using Tapatalk
Click to expand...
Click to collapse
hehe could you please share apktool 1.4.2. ? please...

jboxer said:
When I try to run the code below in the command window
apktool if framework-res.apk
I get
'apktool' is not recognized as an internal or external command,
operable program or batch file.
What am I doing wrong? I need to decompile a settings.apk without errors.
Click to expand...
Click to collapse
be sure to cd to the directory which contains apktool before running that command. sounds like youre somewhere else

pandaweb said:
be sure to cd to the directory which contains apktool before running that command. sounds like youre somewhere else
Click to expand...
Click to collapse
Here are my structure:
apk manager/other/apktool.jar
apk manager/other/framework-res.apk
when i cd> apktool if framework-res.apk
'apktool' is not recognized as an internal or external command, operable program or batch file.
please help!

Code:
cd path_to_apktool_program
apktool input_params

Thanks for posting Ive been stuck with the settings.apk from Xperia Play and grabbed the apktool.jar from OP the app decompiles/recompiles without problems , thanks for sharing !

Related

[Help] Problems with APK Manager.

I have all my paths set to this.
C:\Program Files\Java\jdk1.6.0_27\bin;C:\Program Files\Java\jre6\bin;C:\Program Files\Android\android-sdk;C:\Program Files\Android\android-sdk\platform-tools;C:\Program Files\Android\android-sdk\tools
Click to expand...
Click to collapse
And when I go to decompile SystemUI.apk I get this error.
--------------------------------------------------------------------------
|Tue 10/18/2011 -- 15:36:00.89|
--------------------------------------------------------------------------
'mode' is not recognized as an internal or external command,
operable program or batch file.
java version "1.6.0_27"
Java(TM) SE Runtime Environment (build 1.6.0_27-b07)
Java HotSpot(TM) Client VM (build 20.2-b06, mixed mode, sharing)
Could Not Find C:\APK Manager\place-apk-here-for-modding\../place-apk-here-for-modding/signedSystemUI.apk
Could Not Find C:\APK Manager\place-apk-here-for-modding\../place-apk-here-for-modding/unsignedSystemUI.apk
I: Baksmaling...
I: Loading resource table...
I: Loaded.
I: Loading resource table from file: C:\Documents and Settings\WirelessZone\apktool\framework\1.apk
I: Loaded.
I: Decoding file-resources...
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: Coordinate out of bounds!
at sun.awt.image.ByteInterleavedRaster.setDataElements(ByteInterleavedRaster.java:529)
at java.awt.image.BufferedImage.setRGB(BufferedImage.java:971)
at brut.androlib.res.decoder.Res9patchStreamDecoder.drawVLine(Res9patchStreamDecoder.java:99)
at brut.androlib.res.decoder.Res9patchStreamDecoder.decode(Res9patchStreamDecoder.java:58)
at brut.androlib.res.decoder.ResStreamDecoderContainer.decode(ResStreamDecoderContainer.java:34)
at brut.androlib.res.decoder.ResFileDecoder.decode(ResFileDecoder.java:100)
at brut.androlib.res.decoder.ResFileDecoder.decode(ResFileDecoder.java:68)
at brut.androlib.res.AndrolibResources.decode(AndrolibResources.java:132)
at brut.androlib.Androlib.decodeResourcesFull(Androlib.java:93)
at brut.androlib.ApkDecoder.decode(ApkDecoder.java:98)
at brut.apktool.Main.cmdDecode(Main.java:120)
at brut.apktool.Main.main(Main.java:57)
I: Framework installed to: C:\Documents and Settings\WirelessZone\apktool\framework\127.apk
I: Framework installed to: C:\Documents and Settings\WirelessZone\apktool\framework\127.apk
I: Baksmaling...
I: Loading resource table...
I: Loaded.
I: Loading resource table from file: C:\Documents and Settings\WirelessZone\apktool\framework\1.apk
I: Loaded.
I: Decoding file-resources...
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: Coordinate out of bounds!
at sun.awt.image.ByteInterleavedRaster.setDataElements(ByteInterleavedRaster.java:529)
at java.awt.image.BufferedImage.setRGB(BufferedImage.java:971)
at brut.androlib.res.decoder.Res9patchStreamDecoder.drawVLine(Res9patchStreamDecoder.java:99)
at brut.androlib.res.decoder.Res9patchStreamDecoder.decode(Res9patchStreamDecoder.java:58)
at brut.androlib.res.decoder.ResStreamDecoderContainer.decode(ResStreamDecoderContainer.java:34)
at brut.androlib.res.decoder.ResFileDecoder.decode(ResFileDecoder.java:100)
at brut.androlib.res.decoder.ResFileDecoder.decode(ResFileDecoder.java:68)
at brut.androlib.res.AndrolibResources.decode(AndrolibResources.java:132)
at brut.androlib.Androlib.decodeResourcesFull(Androlib.java:93)
at brut.androlib.ApkDecoder.decode(ApkDecoder.java:98)
at brut.apktool.Main.cmdDecode(Main.java:120)
at brut.apktool.Main.main(Main.java:57)
Could Not Find C:\APK Manager\place-apk-here-for-modding\../place-apk-here-for-modding/signedSystemUI.apk
Could Not Find C:\APK Manager\place-apk-here-for-modding\../place-apk-here-for-modding/unsignedSystemUI.apk
I: Baksmaling...
I: Loading resource table...
I: Loaded.
I: Loading resource table from file: C:\Documents and Settings\WirelessZone\apktool\framework\1.apk
I: Loaded.
I: Decoding file-resources...
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: Coordinate out of bounds!
at sun.awt.image.ByteInterleavedRaster.setDataElements(ByteInterleavedRaster.java:529)
at java.awt.image.BufferedImage.setRGB(BufferedImage.java:971)
at brut.androlib.res.decoder.Res9patchStreamDecoder.drawVLine(Res9patchStreamDecoder.java:99)
at brut.androlib.res.decoder.Res9patchStreamDecoder.decode(Res9patchStreamDecoder.java:58)
at brut.androlib.res.decoder.ResStreamDecoderContainer.decode(ResStreamDecoderContainer.java:34)
at brut.androlib.res.decoder.ResFileDecoder.decode(ResFileDecoder.java:100)
at brut.androlib.res.decoder.ResFileDecoder.decode(ResFileDecoder.java:68)
at brut.androlib.res.AndrolibResources.decode(AndrolibResources.java:132)
at brut.androlib.Androlib.decodeResourcesFull(Androlib.java:93)
at brut.androlib.ApkDecoder.decode(ApkDecoder.java:98)
at brut.apktool.Main.cmdDecode(Main.java:120)
at brut.apktool.Main.main(Main.java:57)
Click to expand...
Click to collapse
Can anyone please help? I've looked everywhere for hours.
ForeverSupra said:
I have all my paths set to this.
And when I go to decompile SystemUI.apk I get this error.
Can anyone please help? I've looked everywhere for hours.
Click to expand...
Click to collapse
try the apkmanager thread in regular development...ur best bet for help
No luck so far but thanks man.

Decompiling Settings.apk on Xperia V - Android 4.3

I'm using android 4.3 stock version of framework-res.apk to decompile Settings.apk but Apktool 1.5.2 & Apktool 2.0 beta are giving me this error :
"Can't find framework resources for package of id: 2. You must install proper framework files, see project website for more info."
any help ?
Found the Problem & fixed apktool
apparently I needed to install SemcGenericUxpRes.apk before decompiling the Settings.apk file, another problem presented itself at this point..
installing SemcGenericUxpRes.apk using apktool 2.0 beta 7 resulted an error :
Exception in thread "main" brut.androlib.AndrolibException: Multiple types: <emp
ty>
at brut.androlib.res.data.ResPackage.addType(ResPackage.java:168)
at brut.androlib.res.decoder.ARSCDecoder.readType(ARSCDecoder.java:131)
at brut.androlib.res.decoder.ARSCDecoder.readPackage(ARSCDecoder.java:10
9)
at brut.androlib.res.decoder.ARSCDecoder.readTable(ARSCDecoder.java:81)
at brut.androlib.res.decoder.ARSCDecoder.decode(ARSCDecoder.java:49)
at brut.androlib.res.decoder.ARSCDecoder.decode(ARSCDecoder.java:40)
at brut.androlib.res.AndrolibResources.installFramework(AndrolibResource
s.java:686)
at brut.androlib.Androlib.installFramework(Androlib.java:640)
at brut.apktool.Main.cmdInstallFramework(Main.java:249)
at brut.apktool.Main.main(Main.java:91)
so I did some research and fixed the 'Multiple types' bug in apktool (I'll attach the fixed version at the end of the post) ,and now every thing worked just fine ^_^
C:\apk>java -jar apktool-fixed.jar if framework-res.apk
I: Framework installed to: C:\Users\User\apktool\framework\1.apk
C:\apk>java -jar apktool-fixed.jar if SemcGenericUxpRes.apk
I: Framework installed to: C:\Users\User\apktool\framework\2.apk
C:\apk>java -jar apktool-fixed.jar d Settings.apk
I: Using Apktool 2.0.0-Beta7 on Settings.apk
I: Loading resource table...
I: Decoding AndroidManifest.xml with resources...
I: Loading resource table from file: C:\Users\User\apktool\framework\1.apk
I: Regular manifest package...
I: Decoding file-resources...
I: Decoding values */* XMLs...
I: Loading resource table from file: C:\Users\User\apktool\framework\2.apk
Cleaning up unclosed ZipFile for archive C:\Users\User\apktool\framework\2.apk
I: Loading resource table...
Cleaning up unclosed ZipFile for archive C:\Users\User\apktool\framework\1.apk
I: Copying assets and libs...
I: Copying unknown files/dir...
I: Copying original files...
fixed apktool 2.0 beta 7 (remove spaces from the url) : http :// www . mediafire . com /?cnstb97sszm476y
delete as I found the answer, please ignore

EMERGENCY, please help with Apk Easy Tool, trying to compile an app but it shows this

07/09/2019 18:20:25
Compiling APK file... (CMD mode: WriteLine)
/c "java -Xmx1024m -jar "C:\Program Files (x86)\APK Easy Tool\Apktool\apktool_2.4.0.jar" b -f -o "C:\Users\madani\Desktop\APK Easy Tool\recompiled\tyblate-recompiled.apk" "C:\Users\madani\Desktop\APK Easy Tool\decompiled\tyblate" "
I: Using Apktool 2.4.0
I: Smaling smali folder into classes.dex...
I: Building resources...
S: WARNING: Could not write to (C:\Users\madani\AppData\Local\apktool\framework), using C:\Users\madani\AppData\Local\Temp\ instead...
S: Please be aware this is a volatile directory and frameworks could go missing, please utilize --frame-path if the default storage directory is unavailable
W: ERROR: 'C:\Users\madani\AppData\Local\Temp\APKTOOL7465868708093004443.tmp' exists (use '-f' to force overwrite)
brut.directory.DirectoryException: java.util.zip.ZipException: zip file is empty
------------------------------------------

Smali Patcher

I just rooted my phone twice now. First I got a Loopboot after I installed Smalipatcher but know it show me this problem. Can anyone help me pls?
fOmey @ XDA
Patcher version: 0.0.7.3
==> Detected java: 1.8.0_281
==> Dumped framework
==> Processing framework
I: Using Apktool 2.5.0 on services.jar
I: Baksmaling classes.dex...
I: Baksmaling classes2.dex...
I: Baksmaling classes3.dex...
I: Copying assets and libs...
I: Copying unknown files...
I: Copying original files...
==> Patched mock location boolean
==> Patched mock providers function
==> Patched knox function
==> Patched knox function
==> Patched knox function
==> Patched high volume warning function
I: Using Apktool 2.5.0
I: Checking whether sources has changed...
I: Smaling smali folder into classes.dex...
java.io.FileNotFoundException: C:\Users\liamb\Desktop\[email protected]\tmp\build\apk\classes.dex (Zugriff verweigert)
!!! ERROR: Compile failed - services.jar not found.
SalIlz said:
I just rooted my phone twice now. First I got a Loopboot after I installed Smalipatcher but know it show me this problem. Can anyone help me pls?
fOmey @ XDA
Patcher version: 0.0.7.3
==> Detected java: 1.8.0_281
==> Dumped framework
==> Processing framework
I: Using Apktool 2.5.0 on services.jar
I: Baksmaling classes.dex...
I: Baksmaling classes2.dex...
I: Baksmaling classes3.dex...
I: Copying assets and libs...
I: Copying unknown files...
I: Copying original files...
==> Patched mock location boolean
==> Patched mock providers function
==> Patched knox function
==> Patched knox function
==> Patched knox function
==> Patched high volume warning function
I: Using Apktool 2.5.0
I: Checking whether sources has changed...
I: Smaling smali folder into classes.dex...
java.io.FileNotFoundException: C:\Users\liamb\Desktop\[email protected]\tmp\build\apk\classes.dex (Zugriff verweigert)
!!! ERROR: Compile failed - services.jar not found.
Click to expand...
Click to collapse
Make sure your services.jar is deodexed. At least, that's what I got out of reading the smali patcher thread.
Hallo, ik heb een versie nodig die werkt op een Windows 32bit, kan iemand me helpen
thnx
Hallo, ik heb een versie nodig die werkt op een Windows 32bit, kan iemand me helpen
thnx

How do I compile Apktool into a Linux binary ?

Hello, I'm posting that thread because I need help to compile the Apktool JAR file into a Linux binary.
I need to compile it into a binary because my VPS can't run Java, when running Java, there is a lot of problems, maybe that because my portable Java installation is wrong, I dont know.
(my VPS provider dont provide Java and has disabled tools like APT, YUM, PACMAN, SNAP or DPKG...)
I thought it could be a better idea to compile the Apktool JAR file into a native Linux binary, and I've done it, but there is a problem in the binary.
Since my server is on Linux x86_64 (Unknown distribution) and my PC is on Linux x86_64 (MX Linux, Debian-based), it could work.
After a lot of searching, I finally installed GraalVM Native Image and made a command to compile the JAR file into a binary.
And after 15 minutes on my (bad) computer it generated a Linux binary file, but when trying to decompile an APK on my computer with it, it gaves:
$ ./apktool d myapp.apk -f
I: Using Apktool 2.7.0 on myapp.apk
I: Loading resource table...
Exception in thread "main" java.nio.charset.UnsupportedCharsetException: CESU8
at [EMAIL][email protected][/EMAIL]/java.nio.charset.Charset.forName(Charset.java:537)
at brut.androlib.res.decoder.StringBlock.<init>(StringBlock.java:277)
at brut.androlib.res.decoder.StringBlock.read(StringBlock.java:52)
at brut.androlib.res.decoder.ARSCDecoder.readTableHeader(ARSCDecoder.java:79)
at brut.androlib.res.decoder.ARSCDecoder.decode(ARSCDecoder.java:51)
at brut.androlib.res.AndrolibResources.getResPackagesFromApk(AndrolibResources.java:780)
at brut.androlib.res.AndrolibResources.loadMainPkg(AndrolibResources.java:64)
at brut.androlib.res.AndrolibResources.getResTable(AndrolibResources.java:56)
at brut.androlib.Androlib.getResTable(Androlib.java:74)
at brut.androlib.ApkDecoder.getResTable(ApkDecoder.java:251)
at brut.androlib.ApkDecoder.decode(ApkDecoder.java:109)
at brut.apktool.Main.cmdDecode(Main.java:175)
at brut.apktool.Main.main(Main.java:79)
But if on my computer I run the same command but with the JAR file, it gaves:
$ java -jar apktool.jar d myapp.apk -f
I: Using Apktool 2.7.0 on myapp.apk
I: Loading resource table...
I: Decoding AndroidManifest.xml with resources...
I: Loading resource table from file: /home/hg/.local/share/apktool/framework/1.apk
I: Regular manifest package...
I: Decoding file-resources...
I: Decoding values */* XMLs...
I: Baksmaling classes.dex...
I: Baksmaling classes2.dex...
I: Copying assets and libs...
I: Copying unknown files...
I: Copying original files...
(so it works on the same APK with the JAR file but not with the binary)
In this message, there will be the binary I've compiled. (for Linux x86_64 only)
Please note that I'm new to XDA Developers, but also to Java and GraalVM Native Image: I never touched one single line of Java code.
I made Python programms, but I never made any Java code. And I discovered GraalVM yesterday.
Can someone help me please ?
And, it is possible that I have problems with APK frameworks when running the binary on my server ?
I can only access to files under my home directory, will I need to install frameworks manually in an "apktool" directory on my home directory ?
Thanks in advance, HGStyleOfficial (my real nickname is HGStyle but it was allready taken on the forum by a random guy registered in 2010 and who didnt had many activities on the forum...)
Apktool version 2.7.0 (latest)
OpenJDK 11.0.18 for Debian
GraalVM 20.0.1 (Java 20, Linux x64)
native-image 20.0.1 2023-04-18

Categories

Resources