[UTIL][JAN 20, 2024] Apktool - Tool for reverse engineering apk files

Search This thread

Pneuma1985

Senior Member
Jan 5, 2011
903
1,069
Around
Still not working properly on sense 4.0.3 apk files... Still throws tons of integer mismatches and doesnt decompile the dialer which is what we were hoping for...
The current error for everyone that Im aware of is

C:\Android\Apktool 1.4.7>apktool d HtcDialer.apk
I: Loading resource table...
Exception in thread "main" brut.androlib.AndrolibException: Arsc files with zero
or multiple packages
at brut.androlib.res.AndrolibResources.loadMainPkg(AndrolibResources.jav
a:67)
at brut.androlib.res.AndrolibResources.getResTable(AndrolibResources.jav
a:43)
at brut.androlib.Androlib.getResTable(Androlib.java:45)
at brut.androlib.ApkDecoder.getResTable(ApkDecoder.java:151)
at brut.androlib.ApkDecoder.decode(ApkDecoder.java:101)
at brut.apktool.Main.cmdDecode(Main.java:128)
at brut.apktool.Main.main(Main.java:65)
 
Last edited:

iBotPeaches

Recognized Developer
Apr 8, 2011
951
4,500
Tampa
connortumbleson.com
Still not working properly on sense 4.0.3 apk files... Still throws tons of integer mismatches and doesnt decompile the dialer which is what we were hoping for...
The current error for everyone that Im aware of is

PHP:
C:\Android\Apktool 1.4.7>apktool d HtcDialer.apk
I: Loading resource table...
Exception in thread "main" brut.androlib.AndrolibException: Arsc files with zero
 or multiple packages
        at brut.androlib.res.AndrolibResources.loadMainPkg(AndrolibResources.jav
a:67)
        at brut.androlib.res.AndrolibResources.getResTable(AndrolibResources.jav
a:43)
        at brut.androlib.Androlib.getResTable(Androlib.java:45)
        at brut.androlib.ApkDecoder.getResTable(ApkDecoder.java:151)
        at brut.androlib.ApkDecoder.decode(ApkDecoder.java:101)
        at brut.apktool.Main.cmdDecode(Main.java:128)
        at brut.apktool.Main.main(Main.java:65)

God, that is a nasty error. Send me that APK please? ibotpeaches (at) gmail (dot) com.

I'll step through it and see why its doing that.
 

furniel

Senior Member
May 10, 2010
144
193
Kiev
iBotPeaches
Can`t decompile systemui from Sony Ericsson XPERIA ray 4.0.4 rom.
Getting this error:
Code:
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 1
	at sun.awt.image.ByteInterleavedRaster.getSamples(Unknown Source)
	at brut.androlib.res.decoder.Res9patchStreamDecoder.decode(Res9patchStreamDecoder.java:60)
	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:94)
	at brut.androlib.ApkDecoder.decode(ApkDecoder.java:101)
	at brut.apktool.Main.cmdDecode(Main.java:128)
	at brut.apktool.Main.main(Main.java:65)
Apktool 1.4.3 decompiles systemui without errors.
 

Attachments

  • SystemUI.apk
    1.9 MB · Views: 382
  • framework_res.apk
    7.1 MB · Views: 627

iBotPeaches

Recognized Developer
Apr 8, 2011
951
4,500
Tampa
connortumbleson.com
v1.4.8 (Beta – Released July 8th – 2012) Codename: yyj
  • Fixes for HTC Sense 4.0.4 apks that have an extra com.htc package
  • Fixes merged from yyj (https://github.com/yyjdelete)
  • Reverted 9patch fix due to errors

http://miui.connortumbleson.com/other/apktool/apktool_1.4.8.jar (v1.4.8) - 8e5cc3c3d4f513cba8d53d64674e4b3c

(THIS IS A BETA. I'm no longer doing this "private" beta stuff. Everyone can test future versions now). Make sure you have the newest APPT.
 

a-id

Senior Member
Oct 9, 2010
160
180
makesmarterlife.blogspot.ru
Hi, iBotPeaches! What could be wrong?

Code:
I: Checking whether sources has changed...
I: Smaling...
I: Checking whether resources has changed...
I: Building resources...
D:\ROM\TOOLS\ApkTools\Phone\res\values-de\strings.xml:194: error: Multiple substitutions specified in non-positional format; did you mean to
 add the formatted="false" attribute?
D:\ROM\TOOLS\ApkTools\Phone\res\values-de\strings.xml:195: error: Unexpected end tag string
D:\ROM\TOOLS\ApkTools\Phone\res\values-es\strings.xml:194: error: Multiple substitutions specified in non-positional format; did you mean to
 add the formatted="false" attribute?
D:\ROM\TOOLS\ApkTools\Phone\res\values-es\strings.xml:195: error: Unexpected end tag string
D:\ROM\TOOLS\ApkTools\Phone\res\values-es-rUS\strings.xml:197: error: Multiple substitutions specified in non-positional format; did you mea
n to add the formatted="false" attribute?
D:\ROM\TOOLS\ApkTools\Phone\res\values-es-rUS\strings.xml:198: error: Unexpected end tag string
D:\ROM\TOOLS\ApkTools\Phone\res\values-it\strings.xml:194: error: Multiple substitutions specified in non-positional format; did you mean to
 add the formatted="false" attribute?
D:\ROM\TOOLS\ApkTools\Phone\res\values-it\strings.xml:195: error: Unexpected end tag string
Exception in thread "main" brut.androlib.AndrolibException: brut.common.BrutException: could not exec command: [aapt, p, -F, C:\Users\User\A
ppData\Local\Temp\APKTOOL3107178834914996807.tmp, -I, D:\User\apktool\framework\1.apk, -S, D:\ROM\TOOLS\ApkTools\Phone\res, -M, D:\ROM\TOOLS
\ApkTools\Phone\AndroidManifest.xml]
        at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.java:193)
        at brut.androlib.Androlib.buildResourcesFull(Androlib.java:302)
        at brut.androlib.Androlib.buildResources(Androlib.java:249)
        at brut.androlib.Androlib.build(Androlib.java:172)
        at brut.androlib.Androlib.build(Androlib.java:155)
        at brut.apktool.Main.cmdBuild(Main.java:182)
        at brut.apktool.Main.main(Main.java:67)
Caused by: brut.common.BrutException: could not exec command: [aapt, p, -F, C:\Users\User\AppData\Local\Temp\APKTOOL3107178834914996807.tmp,
 -I, D:\User\apktool\framework\1.apk, -S, D:\ROM\TOOLS\ApkTools\Phone\res, -M, D:\ROM\TOOLS\ApkTools\Phone\AndroidManifest.xml]
        at brut.util.OS.exec(OS.java:83)
        at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.java:191)
        ... 6 more

 !!!Aborted!!!
 

Attachments

  • ApkTools.rar
    4.5 MB · Views: 716
  • Phone.apk
    1 MB · Views: 173
Last edited:

iBotPeaches

Recognized Developer
Apr 8, 2011
951
4,500
Tampa
connortumbleson.com
Hi, iBotPeaches! What could be wrong?


!!!Aborted!!![/CODE]


Yeah, looks like its not catching single quotes or the regex pattern for %1$x etc. I'll work on this some more.

http://pastebin.com/e4vEReKK

Thanks for reporting/supporting things guys. Hopefully we can get this stable soon.

EDIT: Yeah lots of errors with non-English languages. I would advise not to use v1.4.8 in release productions of anything. Working on re-doing some of the code that maps unicode, etc.
 
Last edited:

v5HMeca

Senior Member
Dec 7, 2007
451
144
Los Angeles
My XMLs come out all funky. Lots of superfluous white space. Is this intentional?

Code:
<?xml version="1.0" encoding="utf-8"?>















<PreferenceScreen android:title="@string/display_settings_title"
  xmlns:android="http://schemas.android.com/apk/res/android"
>
    <com.android.settings.BrightnessPreference android:title="@string/brightness" android:key="brightness" android:dialogTitle="@string/brightness"


 />

    <CheckBoxPreference android:title="@string/accelerometer_title" android:key="accelerometer"
 />

    <ListPreference android:title="@string/screen_timeout" android:key="screen_timeout" android:summary="@string/screen_timeout_summary" android:persistent="false" android:entries="@array/screen_timeout_entries" android:entryValues="@array/screen_timeout_values"




 />

    <ListPreference android:title="@string/battery_style" android:key="battery_styles" android:persistent="false" android:entries="@array/battery_style_entries" android:entryValues="@array/battery_style_values"



 />

    <ListPreference android:title="@string/pref_nightmode_title" android:key="nightmode" android:entries="@array/render_entries" android:entryValues="@array/render_values" android:defaultValue="@string/config_night_modes"



 />

    <PreferenceCategory />

    <ListPreference android:title="@string/animations_title" android:key="animations" android:persistent="false" android:entries="@array/animations_entries" android:entryValues="@array/animations_values"



 />

    <ListPreference android:title="@string/pref_alertdiaog_sytle_title" android:key="alterdialogstyle" android:entries="@array/alertdialog_sytle" android:entryValues="@array/alertdialog_values" android:defaultValue="@string/config_alertdiaog_styles"



 />


    <CheckBoxPreference android:title="@string/pref_electron_beam_animation_on" android:key="electron_beam_animation_on"
 />
    <CheckBoxPreference android:title="@string/pref_electron_beam_animation_off" android:key="electron_beam_animation_off"
 />

</PreferenceScreen>

It's messing up some of my automated scripts. Reverting to 1.4.7 for now until I find out whether this is a feature or a bug. lol
 

Attachments

  • Settings.apk
    1.3 MB · Views: 432

Pneuma1985

Senior Member
Jan 5, 2011
903
1,069
Around
On the new 1.4.8 I get this error when trying to decompile the 4.0.3 HtcDialer.apk and I get no images or xmls I get a manifest and an apktool.yml... Its gotten more of it in the compiler but Im guessing something still needs tweaked.. Not sure if you got it decompiled or not Ibot and if so how and what do I have to change to get it decompiled and recompiled?

Code:
C:\Android\Apktool 1.4.8>apktool d HtcDialer.apk
I: Decoding AndroidManifest.xml with only framework resources...
I: Loading resource table from file: C:\Users\pneuma\apktool\framework\1.apk
I: Loaded.
I: Loading resource table from file: C:\Users\pneuma\apktool\framework\2.apk
I: Loaded.
W: Could not decode attr value, using undecoded value instead: ns=android, name=
description, value=0x7f0b0035
W: Could not decode attr value, using undecoded value instead: ns=android, name=
label, value=0x7f0b0032
W: Could not decode attr value, using undecoded value instead: ns=android, name=
theme, value=0x7f0d0026
W: Could not decode attr value, using undecoded value instead: ns=android, name=
label, value=0x7f0b003c
W: Could not decode attr value, using undecoded value instead: ns=android, name=
theme, value=0x7f0d0029
W: Could not decode attr value, using undecoded value instead: ns=android, name=
theme, value=0x7f0d002b
W: Could not decode attr value, using undecoded value instead: ns=android, name=
theme, value=0x7f0d002a
W: Could not decode attr value, using undecoded value instead: ns=android, name=
theme, value=0x7f0d002a
W: Could not decode attr value, using undecoded value instead: ns=android, name=
theme, value=0x7f0d002a
W: Could not decode attr value, using undecoded value instead: ns=android, name=
theme, value=0x7f0d0048
W: Could not decode attr value, using undecoded value instead: ns=android, name=
theme, value=0x7f0d002a
W: Could not decode attr value, using undecoded value instead: ns=android, name=
theme, value=0x7f0d002a
I: Copying assets and libs...
 
Last edited:

fisha21

Senior Member
Nov 23, 2007
2,331
4,379
Thanks for the new version. Am now able to decompile HTCDialer, although r.9.pngs get converted to 9.pngs.

Still unable to decompile com.HTC.resources.apk without the --keep-broken-res tag, so still can't get at resources.arsc. Not sure if you're already aware of this, but can post the error log and apk if needed.


On the new 1.4.8 I get this error when trying to decompile the 4.0.3 HtcDialer.apk and I get no images or xmls I get a manifest and an apktool.yml... Its gotten more of it in the compiler but Im guessing something still needs tweaked.. Not sure if you got it decompiled or not Ibot and if so how and what do I have to change to get it decompiled and recompiled?

Pnuema, using 1.4.8, I was able to decompile and recompile HTCDialer. The only thing I did differently to you was to leave the apk with its full name, ie not delete all the letter groups in the name. Dont see why that should make a difference but worth a try?



Sent from my HTC One X using xda premium
 

Ticklefish

Recognized Themer
Oct 27, 2011
6,773
8,627
Hampshire, UK
I feel a little bad about saying this, especially after all the hard work you've been doing, but I'm sorry to say I'm getting errors with this. I've got a Sony Ericcson Xperia Mini Pro SK17i and my stock framework-res.apk doesn't recompile.

All I get is a long list of 'Multiple Substitution' errors to do with my values.xml.

My SystemUI.apk recompiles without any issues at all.

Looks like my work internet connection won't let me attach the file, but I'll try later.
 

iBotPeaches

Recognized Developer
Apr 8, 2011
951
4,500
Tampa
connortumbleson.com
Yeah, I understand there was a few problems with v1.4.8 Beta. However, it was a big re-write in some areas, so its a step in the right direction. This time I'll more throughly test v1.4.8 Beta 2 before I release it.

I've already had some people send me some APKs and associated frameworks. So I will work on getting those fixed.
 

EvanVanVan

Senior Member
Jun 27, 2009
394
50
Hi, I'm getting this error when trying to decompile an apk (which didnt happen with 1.4.3):

Code:
Error occured while loading boot class path files. Aborting.
org.jf.dexlib.Code.Analysis.ClassPath$ClassNotFoundException: Could not find sup
erclass Ljava/lang/Object;
        at org.jf.dexlib.Code.Analysis.ClassPath$ClassDef.loadSuperclass(ClassPa
th.java:832)
        at org.jf.dexlib.Code.Analysis.ClassPath$ClassDef.<init>(ClassPath.java:
685)
        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.InitializeClassPath(ClassPath.j
ava:131)
        at org.jf.baksmali.baksmali.disassembleDexFile(baksmali.java:111)
        at brut.androlib.src.SmaliDecoder.decode(SmaliDecoder.java:44)
        at brut.androlib.src.SmaliDecoder.decode(SmaliDecoder.java:33)
        at brut.androlib.Androlib.decodeSourcesSmali(Androlib.java:72)
        at brut.androlib.ApkDecoder.decode(ApkDecoder.java:85)
        at brut.apktool.Main.cmdDecode(Main.java:128)
        at brut.apktool.Main.main(Main.java:65)
Error while loading class La/a/a/a; from file C:\Users\EvanVanVan\Desktop\apktool\targetapp.apk
Error while loading ClassPath class La/a/a/a;

I'll email you the apk if you'd like.

Thanks for the continued work


edit: I guess it was a problem with the apk or my command using the -d (debug) option from the other thread

apktool d -d targetapk.apk == Error
apktool d targetapk.apk == Decompiles fine

Just isn't debuggable
 
Last edited:

iBotPeaches

Recognized Developer
Apr 8, 2011
951
4,500
Tampa
connortumbleson.com
Hi, I'm getting this error when trying to decompile an apk (which didnt happen with 1.4.3):

I'll email you the apk if you'd like.

Thanks for the continued work


edit: I guess it was a problem with the apk or my command using the -d (debug) option from the other thread

apktool d -d targetapk.apk == Error
apktool d targetapk.apk == Decompiles fine

Just isn't debuggable

O yeah. I might of completely forgotten about debugging stuff. I'll have to look into it some more. Send me that apk please (connor (dot) tumbleson (@) gmail (dot) com)
 

Pneuma1985

Senior Member
Jan 5, 2011
903
1,069
Around
Thanks for the new version. Am now able to decompile HTCDialer, although r.9.pngs get converted to 9.pngs.

Still unable to decompile com.HTC.resources.apk without the --keep-broken-res tag, so still can't get at resources.arsc. Not sure if you're already aware of this, but can post the error log and apk if needed.




Pnuema, using 1.4.8, I was able to decompile and recompile HTCDialer. The only thing I did differently to you was to leave the apk with its full name, ie not delete all the letter groups in the name. Dont see why that should make a difference but worth a try?



Sent from my HTC One X using xda premium
Yeah I tried that I get the same error as before and I also pulled the HtcDialer.apk out of a stock LTE build and I still have no luck I get the same error as before... I posted the dialer on the last page I want someone to be able to decompile and compile lol I just want to know the procress lol... If anyone has any luck let me know please...
 

Top Liked Posts