yashsingh1/xdaforums huggingface dataset:
[Android Software Development] Ticklefish:
I have a little feature request....that may be a massive pain to implement, so feel free to ignore it if it is.

Is it possible for apktool to detect which version of smali was used for the files it's recompiling? And, if so, is it possible for apktool to automatically change to that version?

The reason I ask is that there are a lot of mods in the depths of xda which use smali files encoded with smali 1. They won't work with apktool 2 as that's using smali 2, but most users won't know how to convert the files to make them compatible. They might not even know that such a thing is possible.

I've made a small, dummy APK file which I can decompile with apktool 1.5.2., add smali files to, recompile then decompile with apktool 2.0.3 but it'd be nice if apktool could do that sort of thing automatically.

Again, if that's too much of a pain to do, it's not a problem. It's just an idea. :good:

I'm guessing not. Looking at the github, that's still something to be worked on. Give it time.
[Android Software Development] Carotix:
please [MENTION=3924617]iBotPeaches[/MENTION] find your time for all of us !! :(
[Android Software Development] iBotPeaches:
The Marshmallow issue is a regression connected to another bug, which is also somehow connected to a Dexguard bug. It's all connected to something that I haven't quite understood.

Not easily. There is nothing in the ASCII versions of smali that says, "I'm version y". This means you'd have to read each file looking for certain patterns to deem the version, which the array structure / param structure is the only one that comes to mind. At that point you have to build something robust enough that can find the and identity differences, but correctly fail if a bogus file is provided. At that point (Since it wouldn't be smart to maintain an old/new version of smali). You'd rewrite the changes in 2.0 syntax programmatically. All in all, unfortunately not worth the time when someone outside of apktool can do what you mentioned.

Compared to the all the bug report triaging and testing bugs I do and responding to emails/forum posts. I'd say I'm doing fine :o
[Android Software Development] Ticklefish:
Yeeeeeess...that sounds more complex than my little mind can cope with. Oh well, thanks for your reply!

Oh, and we do all appreciate your hard work on apktool. Especially since you have stuff to do in the real world..and especially since apktool is FREE!

We're all eager to see you beat Samsung, but I'm sure we can wait. :highfive:
[Android Software Development] chandarakk:
err recompile framwork 5.1.1 on stock rom s6 G920t please help me

here the link apk https://mega.nz/#!LBEhVIxJ!E0bnkraGj9WtFjbD_BPlJEtQ2WdiGqdxrZa8dYzvfqE
[Android Software Development] Thebear j koss:
Search and read the thread, there are some proprietary device OS that may have some issues, Samsung being 1 of them. Not sure if there is a workaround, i presume there is but you would need to read and search this thread...

Hail ?
[Android Software Development] chandarakk:
thanks bro sorry for my bad eng mebay from my os not from apktool
[Android Software Development] rtfpessoa:
Thanks to @iBotPeaches i fixed the deodex script and all is working ok now.

Keep the good work!!!
[Android Software Development] Pneuma1985:
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
[Android Software Development] iBotPeaches:
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.
[Android Software Development] Pneuma1985:
HtcDialer

http://www.mediafire.com/?2ba1acea9n8e19s

Give me a sec uploading resources and framework for you...In case you dont have the 4.0.3 resources and framework...http://www.mediafire.com/?zu4jc43fy7qd996
[Android Software Development] iBotPeaches:
Thanks. I'll look into it tonight. Just bought an SGS3 :)
[Android Software Development] raziel23x:
I look forward to your findings and further improvements as your and brut.all have worked on a great tool.
[Android Software Development] furniel:
iBotPeaches

Can`t decompile systemui from Sony Ericsson XPERIA ray 4.0.4 rom.

Getting this error:

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.
[Android Software Development] iBotPeaches:
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.
[Android Software Development] a-id:
Hi, iBotPeaches! What could be wrong?

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!!!
[Android Software Development] iBotPeaches:
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.
[Android Software Development] v5HMeca:
My XMLs come out all funky. Lots of superfluous white space. Is this intentional?

<?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
[Android Software Development] iBotPeaches:
Yeah, just saw that too.

Bugs to fix

formatted="false" is back :(

Non-English Langs aren't escaping ' (single quotes)

new manifest decoder makes a helluva a lot of whitespace
[Android Software Development] Pneuma1985:
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?

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...
[Android Software Development] fisha21:
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?
[Android Software Development] Ticklefish:
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.
[Android Software Development] iBotPeaches:
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.
[Android Software Development] EvanVanVan:
Hi, I'm getting this error when trying to decompile an apk (which didnt happen with 1.4.3):

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
[Android Software Development] djdarkknight96:
Just wanted to report, this saved my ass decompiling jellybean for the Toro and Toro plus......this was the only thing that worked flawless! Thanks again for your update!

Sent from my DarkICE Skanky CM9 Gnex using the app!
[Android Software Development] iBotPeaches:
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)
[Android Software Development] Pneuma1985:
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...
[Android Software Development] freidel1:
Thanks your hard work! You're perfect !!! :D
[Android Software Development] iBotPeaches:
A new version has been released!

v1.5.0 (Released September 2 - 2012 ) Codename : Pikmin

Fix for colours being decompiled with improper hex colours

Fix for <string-array> being treated as array on occasion

Support for Mac OS X user:home, instead of dumping frames into /home

Updated internal framework.jar to API16

Added <user-sdk> reading to insert into apktool.yml to help with aapt building

Supported -d mode

Added --verbose mode to output contents of AAPT (note this is a HUGE output). Only used for debugging.

Ignore bootclasspath on debug mode. (Causes some classes in smali to be fail decompile)

New AAPT (Linux only) - http://miui.connortumbleson.com/other/apktool/aapt/linux/aapt

Let me break some things down. Read this, and then read it again.

1) These "multi" tools.. I do not support them. At all. Decompiling with one version of apktool and recompiling with another is very hacky and actually produces a very bad APK. It may work, but its not right to put it blunt, you've basically screwed that APK for all future development. Apktool v1.5.0 is a step in the right direction and I will not chase bug reports when people are doing stuff like that.

2) Problems that may occur. The issue lies in the fact that literally almost every APK has been decompiled by someone at least once. Unless you grabbed APKs directly from your device or a stock RUU its probably been decompiled. Point being, if someone possibly did #1 or something else to that APK that disrupted its structure then apktool won't work on it. I've tested these fixes on stock APKs and they work. So if they don't work for you. I will more than likely look at the APK and say "Sorry, the developers did something wrong.".

3) HTC APKs HTC uses a non-stock build process. I am convinced after 40 hours of testing. If you want to decompile an APK that won't go. Simply use --keep-broken-res and then figure out what the problem is and aid me in development. I will work to finally squash this bug

4) Debug mode? It works barely. Throws lots of NullPointers, except this crosses into java decompiling (What JesusFreke is amazing at, I am not). I'm not exactly thrilled to be having to fix this. It took me 5 months to even understand the resource side of things. Don't really want to mess with debug mode.

5) Bugs? If your experienced with apktool and you know its not you, but the program. Here is the bug area: https://github.com/iBotPeaches/brut.apktool/issues

6) Donations? Always appreciated :) I spend a lot of times debugging and trying to fix this.

7) Help? I'm writing a detailed Wiki. I'll post the links when its done.
[Android Software Development] robm1911:
Thank you, Thank you, Thank you!!!!!! just tried 1.5.0, I decompiled a contacts.apk I've been having issues with and worked like a charm. I got a few sheckels coming your way, it's not much I just wanted to show a little appreciation.

Confirmation # 0US71839KE297645X

Thanks again:D
[Android Software Development] freidel1:
Hi iBotPeaches!

Hi iBotPeaches.

First thanks your hard work!. I have 2 question :)

1. You have released Apktool 1.5.0. http://xdaforums.com/showpost.php?p=30859978&postcount=359 i have this error, 1.5.0 fix this?

Can you try decompile and recompile my SystemUI :)

2. I using Huawei Ideos x5. We have Miui 4 Unofficial by Genoklar. But its too slow, i want port miui Apps from there. How can i port Miui applications? (MMS, gallery etc.)

Thanks your answers!:D
[Android Software Development] iBotPeaches:
Don't use apktool multi tools. It uses improper methods that causes this problem..

Sent from my SGS3 AT&T Variant
[Android Software Development] freidel1:
i tried apktool.jar on console but same error. I tried 1.4.10.
[Android Software Development] iBotPeaches:
Then you messed up editing your smali. This isn't a bug.

Sent from my SGS3 AT&T Variant
[Android Software Development] evol4g:
for whatever reason i can NEVER recompile on linux..

i'm using kubuntu 12.04, i'm using your patched aapt

http://paste.ubuntu.com/1182408/
[Android Software Development] iBotPeaches:
You don't have aapt.

Caused by: java.io.IOException: Cannot run program "aapt": java.io.IOException: error=2, No such file or directory

aapt is in the Android SDK. Until you can run "aapt" at the command line, doing anything apktool related is useless. You NEED aapt.
[Android Software Development] evol4g:
weird because it's right there in my apktool folder along with the apktool.jar, i'll try using it with the standard apktool in the sdk, not the patched one you provided
[Android Software Development] iBotPeaches:
Doesn't matter where aapt is. It has to be in the $PATH variable. So that you can call it anywhere. EX: If your in /home you should be able to call aapt, just as well as if your in /wrwa/fasfsa/fasdf/
[Android Software Development] evol4g:
got it, so i have to edit my bash.rc and my .profile to call on aapt from whereever?

EDIT: YUP! that did it! thanks ibot, you rock! :) no more having to use windows VB just to mess with apks HALLEJUAH!!
[Android Software Development] raziel23x:
Where can I find the custom aapt source code so I can compile for windows

PS I tried to download the Linux version and gotten file not found
[Android Software Development] iBotPeaches:
I'll generate diff after work. Here is Linux

http://miui.connortumbleson.com/other/apktool/aapt/linux/aapt aapt

Sent from my SGS3 AT&T Variant
[Android Software Development] espaciosalter20:
I just wait for the Windows version because the guide that I made for make changes over SystemUI, is made to function only on Windows. Btw, thanks for your hard work!!

Enviado desde mi MB525 usando Tapatalk 2
[Android Software Development] iBotPeaches:
http://pastebin.com/tUrnrWR9

The only changes I made was applying this MIUI fix to the newest aapt. So we get the functionality and fixes of the newest aapt even with the required changes to handle MIUI APKs. I also increased the version number to 0.3, to help debug users who are not running my aapt version. (That is optional though).
[Android Software Development] steal25:
I'm noticing with 1.5.0 that any time @android comes up after decompiling it decompiles as @*android, havent noticed any issues from it yet just bringing it to your attention.
[Android Software Development] iBotPeaches:
If resources are defined as private this little fix allows a recompile to take place, and since apktool can't effectively determine private vs public if the public.xml file is wrong then my only choice was to make all resources public.

I tested that change and noticed no problems. Let me know if anything occurs. The change was on purpose.

Sent from my SGS3 AT&T Variant
[Android Software Development] steal25:
Thanks for the explanation, and all the hard work your putting into this!
[Android Software Development] espaciosalter20:
sorry for the noob question but... how to compile this?
[Android Software Development] deadwolf666:
Hello,

Im getting :

Can't find framework resources for package of id: 3. You must install proper framework files, see project website for more info.

on lg h815, Ive installed frameork-res and lge-res which file is the 3rd ?
[Android Software Development] Ticklefish:
Do you have any other APK in your framework folder with "res" in the filename?
[Android Software Development] deadwolf666:
Yes I tried all of them but they are installed as id:2.

Ive tried few other models like the D855,D851 and so, and The LgStartupWizard is missing the id:3 in all of them