yashsingh1/xdaforums huggingface dataset:
[Android Software Development] iBotPeaches:
Testing v2

Hi everyone, I have all 3 platforms (mac, windows and unix) aapt's available for testing. Just to make sure the next release goes without a hitch, I want to get a quick public test of these binaries.

How to test

Windows

Download aapt.exe (http://connortumbleson.com/apktool/aapt/10_11_2015-test/win/aapt.exe)

Open a command window in the directory in which you downloaded aapt.exe

run "aapt.exe". If the usage output comes up. You are good to go. If an error comes up, let me know.

Mac

Download aapt (http://connortumbleson.com/apktool/aapt/10_11_2015-test/darwin/aapt)

Open a terminal window in the directory in which you downloaded aapt

run "chmod a+x aapt; ./aapt". If the usage output comes up. You are good to go. If an error comes up, let me know.

Unix

Download aapt (http://connortumbleson.com/apktool/aapt/10_11_2015-test/unix/aapt)

Open a terminal window in the directory in which you downloaded aapt

run "chmod a+x aapt; ./aapt". If the usage output comes up. You are good to go. If an error comes up, let me know.

For those curious. These are aapt binaries built on the android-6.0.0_r1 tree, with libc++ statically built. In addition to all of the required apktool patches included. Our goal here is to make sure they run across all platforms like previous versions of aapt.
[Android Software Development] djdarkknight96:
Yep works like you said. Carry on with the GREATNESS.

Oops, Windows 10 success.
[Android Software Development] Ticklefish:
The Windows one worked fine for me on Windows 7. :good:
[Android Software Development] laura almeida:
[MENTION=3924617]iBotPeaches[/MENTION]

Works perfectly fine in Windows 7, 8.1 and 10

Not working in Xubuntu. Terminal shows the following error

laura@Clearwater:~/Desktop/Test$ chmod a+x aapt; ./aapt
Segmentation fault (core dumped)
laura@Clearwater:~/Desktop/Test$
[Android Software Development] exodius48:
It works like you said. I tested it in Windows 7 Enterprise x86 and showing usage stats like this http://pastebin.com/raw.php?i=8WQcBhMk
[Android Software Development] iBotPeaches:
Hm. Can you run the following?

uname -m
ldd aapt
md5sum aapt
[Android Software Development] laura almeida:
laura@Clearwater:~/Desktop/Test$ uname -m
x86_64
laura@Clearwater:~/Desktop/Test$ ldd aapt
statically linked
laura@Clearwater:~/Desktop/Test$ md5sum aapt
da00c4a8ce3ba3cac6c09efff1f6cbaa aapt
[Android Software Development] iBotPeaches:
Try this one: http://connortumbleson.com/apktool/aapt/10_11_2015-test/unix/aapt

new md5: 425d39be89e6385c4a1c865baa7c63f4
[Android Software Development] laura almeida:
Well done! :good:

This one works!
[Android Software Development] fhem:
aapt test links dead now?
[Android Software Development] iBotPeaches:
Yes those retired, for a hopefully soon public push - http://connortumbleson.com/apktool/aapt/

Those were updated this morning with the aapt binaries that will be in 2.0.2. Feel free to test with those, but I believe they are stable.
[Android Software Development] Er. Aditya:
i am getting these errors while simple decompile/compile of note 5 systemUI

http://pastebin.com/MFCvA4Kk
[Android Software Development] iBotPeaches:
That looks like that apk has a lot of files that require no compression. Part of a new fix passes all those files to aapt as parameters to (-o). This seems to be an error on Windows as max string length of the command line command is exceeding 8196 characters.

I'll have to dig into the build tools in Android Studio and see how they handle this.
[Android Software Development] Er. Aditya:
so any work arounds for now ?? this is note 5 systemUi apk and such errors occured with couple of more apks

but have been told by a xda member they have sucessfully recompiled the systemUI apk
[Android Software Development] fhem:
FYI --- works fine on my linux builds and windows 10 ------ thanks you
[Android Software Development] iBotPeaches:
Workaround? Use Linux/Mac as their command limit is far larger, I believe at 64k.

A real fix? No idea yet. Not sure aapt allows a base directory so all files can be relative to that directory. I'll have to research things, but right now I have more pressing bugs to figure out like proguard enterprise and AndoResGuard which both are quickly affecting more apks daily.
[Android Software Development] Er. Aditya:
thank you for taking into consideration... I'll wait a i don't have / use Linux r mac
[Android Software Development] iBotPeaches:
Okay, I took look at this while sitting in class - https://github.com/iBotPeaches/Apktool/pull/1020 (read latest comments)

Basically, might be a lot easier to fix than I thought. Though, I'm not sure if the same extension (in your stacktrace if .qmg is used in both a compressed and non-compressed manor). Since we currently iterate each file to be sure we only skip compression on needed files, but with apps with 500+ assets, this limit is quickly reached.

We could read the extensions of those files, which for your stacktrace was just .qmg. That means the command to aapt would be just -0 arsc -0 qmg, which is only 15 characters vs 32,000+ characters.
[Android Software Development] Er. Aditya:
simply removing DoNotCompress line from apktool.yml manually does the trick as well

then it builds the apk , i havnt tested the build apk but yes it does build
[Android Software Development] iBotPeaches:
A new version has been released!

v2.0.2 (Released October 12, 2015)

On my immediate radar now is the following.

Proguard Enterprise bugs

Decoding failing with ArrayIndexOutOfRange (new obfuscation technique)

Regression from adding of noCompress (command length over 32k chars)

Handling large numbers in AndroidManifest

I hope to get 2.0.3 out very soon (after fixing the above problems).

Download: https://bitbucket.org/iBotPeaches/apktool/downloads/apktool_2.0.2.jar

Details of Release: http://connortumbleson.com/2015/10/12/apktool-v2-0-2-released/
[Android Software Development] gkalen:
So now it will work for Miui7 also , i'm i right ??

Στάλθηκε από το Lenovo A328 μου χρησιμοποιώντας Tapatalk
[Android Software Development] iBotPeaches:
For the most part. I patched the new MIUI qualifier (godzillaui) and fixed the problematic package names. Any other issues are edge cases and quite complicated and involved to fix, even if I knew what the fix was :p Though, I can't spend much time on MIUI anymore. I have to treat it like other OEMs (like Huawei). If they continue to modify their ROM outside of AOSP configurations it will continue to make it more difficult to patch. I have to spend time on bugs that affect the greatest number of apks.
[Android Software Development] gkalen:
I can understand you very well with miui , though i like it very much i think that on every update they go from bad to badest.

Thanks a lot for your great work !!!!!

Στάλθηκε από το Lenovo A328 μου χρησιμοποιώντας Tapatalk
[Android Software Development] laura almeida:
[MENTION=3924617]iBotPeaches[/MENTION]

Cannot install latest CM12.1 framework with apktool v2.0.2 throws the following exception

C:\Users\Laura\Desktop\Apktool>apktool if framework-res.apk
Exception in thread "main" brut.androlib.AndrolibException: Multiple resources: spec=0x0103035e style/Theme.DeviceDefault.Resolver, config=-round
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.decoder.ARSCDecoder.decode(ARSCDecoder.java:39)
at brut.androlib.res.AndrolibResources.installFramework(AndrolibResources.java:599)
at brut.androlib.res.AndrolibResources.installFramework(AndrolibResources.java:581)
at brut.androlib.Androlib.installFramework(Androlib.java:676)
at brut.apktool.Main.cmdInstallFramework(Main.java:240)
at brut.apktool.Main.main(Main.java:87)

It was working in apktool v2.0.1 with the following warnings.

C:\Users\Laura\Desktop\Apktool>apktool if framework-res.apk
W: Config flags size > 48. Exceeding bytes: 0x2000000.
W: Invalid config flags detected: style-ERR0
W: Config flags size > 48. Exceeding bytes: 0x2000000.
W: Invalid config flags detected: style-v21-ERR1
W: Config flags size > 48. Exceeding bytes: 0x2000000.
W: Invalid config flags detected: color-ERR2
W: Config flags size > 48. Exceeding bytes: 0x2000000.
W: Invalid config flags detected: drawable-ERR3
W: Config flags size > 48. Exceeding bytes: 0x2000000.
W: Invalid config flags detected: drawable-v21-ERR4
W: Config flags size > 48. Exceeding bytes: 0x2000000.
W: Invalid config flags detected: drawable-xhdpi-ERR5
W: Config flags size > 48. Exceeding bytes: 0x2000000.
W: Invalid config flags detected: drawable-xxhdpi-ERR6
W: Config flags size > 48. Exceeding bytes: 0x2000000.
W: Invalid config flags detected: bool-ERR7
I: Framework installed to: C:\Users\Laura\apktool\framework\1.apk
[Android Software Development] iBotPeaches:
C:\Users\Laura\Desktop\Apktool>apktool if framework-res.apk
Exception in thread "main" brut.androlib.AndrolibException: Multiple resources: spec=0x0103035e style/Theme.DeviceDefault.Resolver, config=-round
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.decoder.ARSCDecoder.decode(ARSCDecoder.java:39)
at brut.androlib.res.AndrolibResources.installFramework(AndrolibResources.java:599)
at brut.androlib.res.AndrolibResources.installFramework(AndrolibResources.java:581)
at brut.androlib.Androlib.installFramework(Androlib.java:676)
at brut.apktool.Main.cmdInstallFramework(Main.java:240)
at brut.apktool.Main.main(Main.java:87)

Uh oh. This isn't good. I'm fairly sure I tested CM12.1 and CM12 before releasing. I'll have to double check. If this is serious, might have to pull 2.0.2 :(
[Android Software Development] laura almeida:
apktool v2.0.2 md5sum --> 2c25fd4270d6aff37c5165342991bce6

CM12.1 framework --> framework-res.apk
[Android Software Development] iBotPeaches:
Okay, the CM12.1 I downloaded worked fine. The one you linked did not. I investigated yours and found a new qualifier called "darktheme", which is causing the crash. I checked frameworks/base on CM12.1 tree and couldn't find this qualifier. I then asked a friend at Cyanogenmod and he confirmed they have never added a qualifier. Whatever modified CM12.1 ROM that is from, modified aapt and/or frameworks/base to support a new qualifier which apktool is crashing on.
[Android Software Development] laura almeida:
Thanks for fast reply and your awesome work :good:

I am using Temasek's UNOFFICIAL CM12.1

What should i do now ?
[Android Software Development] iBotPeaches:
That ROM picked some changes from SlimROM (which uses TRDS), which modifies frameworks/base to add additional qualifiers. For this reason, there used to be an unofficial version of Apktool called "Slimrom Apktool". That had support for this. Someone would have to take the current Apktool changes and re-patch those SlimROM changes into it.

Obviously a better way is to build a plugin system for apktool, so new binaries aren't required for configuration changes, but I'm not sure how to abstract that functionality for both apktool and aapt. As aapt is platform dependent and compiled ahead of time.

So right now your options? Nothing right now unfortunately. You need a new apktool and new aapt binary (w/ these patches included). I can make a new apktool/linux aapt really quick, but building the full aapt binary with all 3 platforms (mac/unix/win) takes me a good deal of time. I'm bit of out of it from building aapts for like the past 6 days straight, so maybe give me a few days and I'll see what I can do.
[Android Software Development] laura almeida:
Thank you so much

tyt no pressure!

I will silently wait
[Android Software Development] twiztid_:
I'm having a problem trying to edit my SystemUI.apk file. Decompiling, Building, and replacing META-INF and AndroidManifest.xml in the SystemUI.apk file, without editing any files, causes errors on boot forcing me to replace SystemUI.apk with a backup. I don't think I'm doing anything wrong

Information:

APKtool version: 2.0.1 (will try 2.0.2 since I see it's out now)

Android device: Barnes & Noble Nook HD+ (Ovation)

Android version: CM10.2 (4.3.1) - [Kernel][ROM][Ovation][CM 10.1.3][emmc] "Yellow kernel"

Kernel version: 3.0.72-yellow

Link to files: http://www.mediafire.com/download/bpbddbc1p0ahdp1/apktool_CM102_SystemUI.zip

My procedure:

apktool.bat if framework-res.apk

apktool.bat if SystemUI.apk

apktool.bat d SystemUI.apk

apktool.bat b SystemUI.apk

- I do not get any errors decompiling/building the files, as long as I have ran the "if" on both framework-res.apk and SystemUI.apk

Open ../SystemUI/dist/SystemUI.apk with 7-zip

Open ../SystemUI.apk with 7-zip

Highlight META-INF and AndroidManifest.xml, Drag and Drop from original APK into repacked APK

Copy to storage, reboot into recovery, move file to /system/app, CHMOD 755, then reboot
[Android Software Development] Al Arsyadi:
.param still not removed in this build. i don't know why its very difficult to remove it on 1st decompile.
[Android Software Development] djdarkknight96:
Getting a virus hit on brut temp file ?

Windows 10
[Android Software Development] laura almeida:
[MENTION=2126467]djdarkknight96[/MENTION]

That is been happening since apktool v2.0.0 Beta 1

It is because internal aapt is copied to /tmp and executed for building apks.

When an application launch a .tmp in %temp% folder as executable It seems to raising an alert !

You will have to add an exception to get apktool working as before

add %temp%\brut_util_Jar_* as ignored path in your anti-virus

I hope this helps
[Android Software Development] djdarkknight96:
Well working fine on 2.0.1 so it's new to me
[Android Software Development] laura almeida:
I think it is bcoz of the new aapt

It does raise some flags in windows defender

Category: Trojan:Win32/Repjexi

Description: This program is dangerous and executes commands from an attacker.

Recommended action: Remove this software immediately.

Items:
file:C:\Users\Laura\Downloads\Internet Download Manager\Programs\aapt.exe

But both aapt and apktool v2.0.2 is completely virus free

Check these VirusTotal report of aapt & VirusTotal report of apktool v2.0.2

I have inquired about this previously

Read from --> Here
[Android Software Development] iBotPeaches:
During reboot, can you run `adb logcat`? This will allow us to see the package manager output, to see the reason why its crashing.

I don't think I'm changing anything on this regard after this post - http://xdaforums.com/showpost.php?p=62786765&postcount=3627 . You are welcome to report a bug/question to smali itself for maybe a more direct to source answer of why - https://github.com/JesusFreke/smali/issues as tweaking the internals for smali for something I'm not 100% sure on I want to stray from.

Very strange. What is triggering virus hit? and do you experience it just downloading the raw aapt binary from here? http://connortumbleson.com/apktool/aapt/windows/aapt.exe

I don't have an easy link to the 6.0 Windows SDK, but I'd be interested to see if that throws an error as well, because my only changes - https://github.com/iBotPeaches/platform_frameworks_base/commits/apktool-mm
[Android Software Development] djdarkknight96:
Nope raw worked without issues only the jar triggers the virus activity. I noticed it was a temp build file. I was compiling the new hangouts.
[Android Software Development] iBotPeaches:
You said it worked in the past though, that is very strange. Maybe its related to executing binaries from temp location? If you use the aapt I linked above and use it with 2.0.2 with the --aapt parameter (IE passing the filepath to the downloaded aapt), does that work?

Trying to isolate whether its the binary itself or the process of executing binaries from a temp directory. Maybe I need to find a new default location, instead of temp. We delete the aapt after using it, so maybe the directory of current execution would be better. I foresee a lot of test apktool versions being posted here soon.
[Android Software Development] djdarkknight96:
I need a little sleep but I'll test when I wake. Thank you!
[Android Software Development] Er. Aditya:
on ubuntu everything works flawlessly no more qmg issue

thanks again for your work
[Android Software Development] _Sofos_:
Correct, it's only happening with win os.

Logs here (it says at some point in Greek that name is too long to stay on temp etc)

https://www.dropbox.com/s/4naju9ihwhx5llt/SystemUI.apk_2015-13-10-_15-20.txt?dl=1

The same file tho was recompiled without any issues with both 2.0.0 & 2.0.1.

Thank you for all the work you've done so far btw, been using it since 2012! :)
[Android Software Development] Er. Aditya:
windows too wont be out of luck for too long :D
[Android Software Development] Al Arsyadi:
Try to install framework again, probably works. :/
[Android Software Development] iBotPeaches:
Fixed your issue - https://github.com/iBotPeaches/Apktool/commit/5e4bae05264e9f1ea1c969971d81d824558cd12f (Still needs a bit of testing)

I gave this a shot with Windows Defender (1.207.2979.0) and Windows 10, since we had a bug reported: https://github.com/iBotPeaches/Apktool/issues/1054

Apktool 2.0.1 - no issue

Apktool 2.0.1 with 2.0.2 aapt - detected as virus

Apktool 2.0.2 with 2.0.1 aapt - no issue

Apktool 2.0.2 - detected as virus

Apktool 2.0.3 with aapt directory changed to "user.home" instead of "temp" - detected as virus

It seems the aapt 6.0 binary is at fault, and only apparent with Windows Defender. My virus protection of avast! did not detect this. I submitted a "false positive" report to Microsoft about the file.

You can see in this AOSP bug report - https://code.google.com/p/android/issues/detail?id=183525 that its affecting IntelliJ as well. Virus definitions come and go detecting it and not. This sucks, but I recommend just adding an exclusion rule for the time being, as there isn't much I can do here. I'm not sure what commit added to frameworks/base caused this.
[Android Software Development] Er. Aditya:
wow that was quick and snappy

i so wana test this out :D
[Android Software Development] djdarkknight96:
Ok sounds good.
[Android Software Development] :
brother smali/baksmali to 2.1.0 is latest by jesusfreke now

https://bitbucket.org/JesusFreke/smali/downloads

:)
[Android Software Development] iBotPeaches:
All the changes after 2.0.8 to 2.1.0 were for OAT deodexing and deodexing in general. Since apktool does not handle that, I held off on the 2.1.0 upgrade. I will catch smali up into apktool, but that wasn't an immediate concern of mine as the changes (as mentioned) don't affect apktool.

I'll get them into the next release (just to keep the versions in sync), but you aren't missing anything important that apktool can leverage, so no worries.
[Android Software Development] starkly_raving:
Using windows 10 & 2.0.2 with no issues decompiling/recompiling stock 5.1 (MotoX,G &E) or CM12.1.
[Android Software Development] :
Thanks conner to clear things up ;)
[Android Software Development] Al Arsyadi:
I already report bug to smali github, and soon he will release new version of smali & baksmali , please include it to new version of apktool. :good:
[Android Software Development] iBotPeaches:
Thanks for tracking that down. Guess I didn't fully understand the .param annotation. I'm working on abstracting smali out of apktool to just a submodule, this will make it very easy to update. WIP here - https://github.com/iBotPeaches/Apktool/pull/1059

Not sure if this means it's completely fixed, but will be interesting to see when the next Defender definition updates come out, if aapt is still flagged.
[Android Software Development] :
seems there is another problem

now if i decompile the app with classes dex it get failed on resources so it cant move forth

C:\Users\JASI\Desktop\Apk Tool v2.0.2>apktool d a.apk
I: Using Apktool 2.0.2 on a.apk
I: Loading resource table...
Exception in thread "main" brut.androlib.AndrolibException: Multiple res specs:
menu/
at brut.androlib.res.data.ResType.addResSpec(ResType.java:62)
at brut.androlib.res.decoder.ARSCDecoder.readEntry(ARSCDecoder.java:219)

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:11
6)
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(AndrolibRes
ources.java:544)
at brut.androlib.res.AndrolibResources.loadMainPkg(AndrolibResources.jav
a:63)
at brut.androlib.res.AndrolibResources.getResTable(AndrolibResources.jav
a: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)

C:\Users\JASI\Desktop\Apk Tool v2.0.2>

now i tried to stop decoding resources with -r

C:\Users\JASI\Desktop\Apk Tool v2.0.2>apktool d -r a.apk
I: Using Apktool 2.0.2 on a.apk
I: Copying raw resources...
I: Baksmaling classes.dex...
I: Copying assets and libs...
I: Copying unknown files...
Exception in thread "main" brut.androlib.AndrolibException: brut.directory.Direc
toryException: Error copying file: ?? .xml
at brut.androlib.Androlib.decodeUnknownFiles(Androlib.java:207)
at brut.androlib.ApkDecoder.decode(ApkDecoder.java:158)
at brut.apktool.Main.cmdDecode(Main.java:165)
at brut.apktool.Main.main(Main.java:81)
Caused by: brut.directory.DirectoryException: Error copying file: ?? .xml
at brut.directory.DirUtil.copyToDir(DirUtil.java:88)
at brut.directory.AbstractDirectory.copyToDir(AbstractDirectory.java:207
)
at brut.androlib.Androlib.decodeUnknownFiles(Androlib.java:200)
... 3 more
Caused by: java.io.FileNotFoundException: a\unknown\?? .xml (The filename, dire
ctory name, or volume label syntax is incorrect)
at java.io.FileOutputStream.open(Native Method)
at java.io.FileOutputStream.<init>(Unknown Source)
at java.io.FileOutputStream.<init>(Unknown Source)
at brut.directory.DirUtil.copyToDir(DirUtil.java:84)
... 5 more

C:\Users\JASI\Desktop\Apk Tool v2.0.2>

alot of a.xmls in the apk

if you want i can PM you apk file maybe u will find it interesting :)