yashsingh1/xdaforums huggingface dataset:
[G1 Android Development] Brut.all:
Fixed: http://www.multiupload.com/BPJW0WGTBG

Correct.

r04-brut1 packages for linux and macosx are a little broken - aapt should have 755 perms, but platform-tools_r04-*.zip packages from SDK have aapt set as 750. Seems perms are changed when installing platform-tools.

Thanks for reporting.

Yeah, but this is no problem. If you have your own app and you have added some substitutions in strings.xml, then maybe you will have to update some of them to compile your app using newer aapt - that's not a big deal.

If you have 3rd party apk, then apktool should convert all strings automatically when decoding :-)

I don't think you should get problems building an app with different version of apktool than you have used to decompile an apk. But most of issues I fix are related to decompile-time, so your already decoded app may contain some bugs and you have to fix them manually or decode apk again.

If you have decoded some apk with v1.3.1, same version could build it back, then you switched to v1.4.1 and you get errors which aren't related to newer aapt, then I would be thankful if you would be able to reproduce this error. There was something wrong.

http://code.google.com/p/android-apktool/wiki/Changelog#Migration_to_1.4.0
[G1 Android Development] kurniawan77:
is the annoying double "amp;" bug fixed with 1.4.1???
[G1 Android Development] Brut.all:
Yes, it is.
[G1 Android Development] Hatman41:
I went to that URL but I guess I do not understand what it is saying?

Migration to 1.4.0

In order to get full Honeycomb/Gingerbread (3.1, API 12) support you have to:

update apktool to v1.4.0

update install package to r04-brut1 or update your aapt manually

then remove $HOME/apktool/framework/1.apk or install your own framework from Honeycomb/Gingerbread

1. Done using the new version that you last linked 1.4.2

2. Ran SDK Manager updated everything.

3. I installed the framework-res from Honeycomb.
[G1 Android Development] Hatman41:
Bahh double post
[G1 Android Development] Brut.all:
Your error makes me think you still use old aapt. Maybe you have updated platform-tools in SDK Manager, but you still have other, older aapt in your PATH?
[G1 Android Development] Hatman41:
You are probably correct. I checked and I am still using the old aapt where can I get the new one? I checked SDK and it did not download aapt.
[G1 Android Development] Treken:
Run sdk and open the help window, help tab is on far right ontop. Then select install software. Select both options including third party software
[G1 Android Development] Brut.all:
Or download and unpack apktool-install-* package - that was mentioned in migration instructions.
[G1 Android Development] Treken:
Didn't know that had the aapt that worked. Nice!
[G1 Android Development] Hatman41:
Thanks for all your help and assistance Brut.all a droidburger is on the way...works perfect after I got the updated aapt. :)
[G1 Android Development] pendo:
Thanks. I did have some issues yesterday when I tried to recompile, but I wasn't sure of what caused it at the time, whether it was aapt, or the new apktool.jar which I had compiled prior to your "official" release. So I just went back to 1.3.1 for the time being to try and get some work finished and haven't had a chance to go back and reconstruct the steps needed to produce the error.

IIRC it was a string error was from MultipleNonPositionalSubstitutions and asked if I meant to include "false" or something similar.

So in regards to the aapt issue for mac/linux, should we just grab the most current version out of our sdk platform-tools?
[G1 Android Development] Brut.all:
Thanks! :-)

That was old-apk-with-new-aapt issue :-) So this wasn't related to the fact you have decoded apk with v1.3.1 and tried to build it with v1.4.1 :-)

Yes, you can copy it from platform-tools or just run "chmod 755 aapt" on a file extracted from apktool-install-* .
[G1 Android Development] LfcFan1977:
Thanks

Could not thank you on the OP.
[G1 Android Development] pendo:
I suspected as much, but thanks for the confirmation. :)
[G1 Android Development] Treken:
Just want to make sure I understand correctly, you can either copy over the aapt from sdk or just download apktool 1.4.2?
[G1 Android Development] scheichuwe:
I hope you aren't tired of eating droidburgers :)

Nice work.
[G1 Android Development] Brut.all:
You can:

copy aapt from installed SDK

extract it from apktool-install-*-r04-brut1 package and run "chmod 755 aapt" on it

wait for apktool-install-*-r04-brut2

No, not at all. Thanks :-)
[G1 Android Development] he_stheone64:
Thx a lot brut for the update, with 1.41 I could finally fix a few com.htc.resources related errors for 3 different inverted Themes :cool:

Great job ;)
[G1 Android Development] Droidzone:
I know that this is a silly question. But I couldnt find a correct answer..

Where exactly in the command do I put the -f or --force option to force overwrite a directory?
[G1 Android Development] Brut.all:
"d[ecode] [OPTS] <file.apk>", so: "apktool d -f some.apk"
[G1 Android Development] Droidzone:
Thank you.. It worked :)

I'm working on a Wrapper extension to Apk Manager which adds Batch Decompiling/Recompiling support to it, plus optional string search across smali files.. The last part is becoming difficult as it's Windows based.. Been difficult to find a substitute for grep/sed
[G1 Android Development] RandomKing:
So I'm trying to decompile FlexT9. I bought it and I'm trying to theme it for personal use, no piracy or anything... but it simply won't decompile without a truck load of errors. Any ideas why?

Edit: Nvm. May be back to ask about compiling :D

Edit: Okay so it decompiled, but now all the errors come in the compiling... anyone try any theming on this app?
[G1 Android Development] Brut.all:
Could you post these errors? Both decode (if there are any) and build ones. You could also upload apk somewhere and send me a PM with a link to it.
[G1 Android Development] RandomKing:
Well I've tried APKManager because it's a little more convenient to use, but it wouldn't decompile without a thousand errors of all varying sorts. APKTool can decompile it, but without even changing anything, it won't recompile in either program without pretty much the same thousand errors. I've been playing with decompiling and rebuilding various apps to theme the pngs with varying success, but this is the only one (aside from framework-res) that fails to decompile in the first place at all.

I should mention, this apk won't let me even just physically swap pngs using winrar, which I've also had varying success on other apks.

I'll post up a link to it soon, I'll prbly just edit it into this post. Thanks in advance! :D
[G1 Android Development] tommytomatoe:
Mmm. Which apks is this? You should always be able to swap png without decoding it. Also, make sure you have the correct version of aapt installed. It is one of the more common errors. If it is a third party market app or one that goes into data/app, you will not be able to just modify it (apktool or just png swapping), you will want to resign it first.
[G1 Android Development] RandomKing:
Here's the file.

Before anyone has any illegal thoughts, it's not cracked, and it's tied into Amazon's app store. I am only posting it here for theming purposes. :D

I will try resigning it first.

Edit: So signing it didn't fix it unfortunately. The error log in apkmanager makes reference to many MANY items inside .xmls undefined and already defined, and then it fails to decompile. Or apktool can decompile it, but then makes the same errors when building, with or without any changes.
[G1 Android Development] tommytomatoe:
Ill look at this when I get a chance. Have you checked your version of aapt?

And since it is a market apk, you will need to resign it. :-)
[G1 Android Development] Brut.all:
No errors for me:

$ apktool d com.nuance.flext9.input-1.apk
I: Baksmaling...
I: Loading resource table...
W: Skipping "android" package group
I: Loaded.
I: Loading resource table from file: /home/brutall/apktool/framework/1.apk
I: Loaded.
I: Decoding file-resources...
I: Decoding values*/* XMLs...
I: Done.
I: Copying assets and libs...

$ apktool b com.nuance.flext9.input-1
I: Checking whether sources has changed...
I: Smaling...
I: Checking whether resources has changed...
I: Building resources...
aapt: warning: string 'tones' has no default translation in /media/var/dls/com.nuance.flext9.input-1/res; found: de fr it zh_CN zh_TW
I: Copying libs...
I: Building apk file...

Do you use apktool v1.4.1? Did you remove $HOME/apktool/framework/1.apk?
[G1 Android Development] RandomKing:
This is what happens for me.

Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.

c:\APKTool>apktool d flext9.input-1
Input file (flext9.input-1) was not found or was not readable.

c:\APKTool>apktool d flext9.input-1.apk
I: Baksmaling...
testI: Loading resource table...
W: Skipping "android" package group
I: Loaded.
I: Loading resource table from file: C:\Users\Master\apktool\framework\1.apk
I: Loaded.
I: Decoding file-resources...
I: Decoding values*/* XMLs...
I: Done.
I: Copying assets and libs...

c:\APKTool>apktool b com.nuance.flext9.input-1
Exception in thread "main" brut.androlib.AndrolibException: brut.directory.Direc
toryException: java.io.FileNotFoundException: com.nuance.flext9.input-1 (The sys
tem cannot find the file specified)
at brut.androlib.Androlib.readMetaFile(Androlib.java:142)
at brut.androlib.Androlib.build(Androlib.java:159)
at brut.androlib.Androlib.build(Androlib.java:154)
at brut.apktool.Main.cmdBuild(Main.java:174)
at brut.apktool.Main.main(Main.java:59)
Caused by: brut.directory.DirectoryException: java.io.FileNotFoundException: com
.nuance.flext9.input-1 (The system cannot find the file specified)
at brut.directory.ZipRODirectory.<init>(ZipRODirectory.java:55)
at brut.directory.ZipRODirectory.<init>(ZipRODirectory.java:38)
at brut.androlib.res.util.ExtFile.getDirectory(ExtFile.java:55)
at brut.androlib.Androlib.readMetaFile(Androlib.java:138)
... 4 more
Caused by: java.io.FileNotFoundException: com.nuance.flext9.input-1 (The system
cannot find the file specified)
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.<init>(Unknown Source)
at java.util.zip.ZipFile.<init>(Unknown Source)
at brut.directory.ZipRODirectory.<init>(ZipRODirectory.java:53)
... 7 more

c:\APKTool>
[G1 Android Development] pendo:
Brut.all,

should we be using the official 1.4.1 or the 1.4.2 you posted here? Thanks
[G1 Android Development] Brut.all:
You have passed invalid directory name. I think it should be: flext9.input-1 .

It's not a true v1.4.2, it's a snapshot of changes/fixes not yet released. 1.4.2.269870b means this file was built from 269870b commit. If you look into commits history: https://github.com/brutall/brut.apktool/commits/master you'll find it's current one.

Usually it's better to use newer versions of software, but don't be crazy about that. For now there are exactly 2 bug fixes to v1.4.1, so if you don't get exceptions in findNonPositionalSubstitutions() and/or ClassCastException in ResPluralsValue class, then you won't see any difference.
[G1 Android Development] pendo:
Thanks for the explanation :)
[G1 Android Development] RandomKing:
Well I've gotten it to decompile, and recompile. Then I found an amazon issue, where it ran, but wasn't copying in two amazon files and immediately closes on my phone. More experimenting i suppose, I knew it wouldn't be simple to theme an amazon app store apk... :D.

Edit: Boy it's a touchy little apk. And all I want to do is change the keys from bright white to something like a dark teal... haha. Oh well, maybe I'll get it. Thanks though, I did get decompiling and building to work properly.
[G1 Android Development] ihtfp69:
Did you install and use the correct framework? You need the framework from the rom your Settings.apk came from.
[G1 Android Development] maddoggin:
yes i did i put both frameworks and renamed them 1.apk and 2.apk and put them in a folder c:/users/maddoggin/apktool/framework i get it to decompile but wont compile even if i dont do anything to the apk

edit: finally got it! i dont even know how really or else i would post but i just kept messing with it. i downloaded the apktool batch file for windows and unpacked it in c;/windows and thats all i did ! lol! maybe thats what worked idk!
[G1 Android Development] old.ghost:
Hi Brut.all, thanks a lot for your awesome tool.

I got one issue need your help out.

I'm now using aosp Gingerbread ROM. Because there is some English works not translated to Chinese, I just use your apktool v1.3.2 to decompile one system apk CMParts.apk then do some translations, after that compile back to an apk file. Use auto-sign to sign this apk then push to /system/app, reboot and try to run CMParts, I got a FC. Then I try to decompile apk and do nothing just compile back to apk, still FC.

I have attached logcat file, would you please kindly help look into this? Many thanks.
[G1 Android Development] Brut.all:
Could you update to apktool v1.4.1, decode apk once again, build it and try?
[G1 Android Development] old.ghost:
Thanks Brut.all for your quick response. I tried out the latest version v1.4.1 but even worse as I failed to decode CMParts.apk. Would you please help check out the error log?

I also attached CMParts.apk and framework-res.apk from aosp 5/23 release ROM in case you need them for debug, thanks a lot.
[G1 Android Development] Brut.all:
http://www.multiupload.com/BPJW0WGTBG

Ok, update to this one, sorry ;-)
[G1 Android Development] old.ghost:
Thanks Brut.all for your update, decode is working now with the latest v1.4.2. But if I push apk file to /system/app that was generated in dist folder, FC will still happen.

I try to push resources.arsc from folder /build/apk to orignial apk file then use adb to push again, no FC occurs.

Would you please help check what happens to apk file in dist? Thanks.
[G1 Android Development] tommytomatoe:
Just a general troubleshooting question, but did you transfer original meta inf and android manifest from the original apk to the one in dist?
[G1 Android Development] old.ghost:
Thanks a lot for your instruction, it did works when I add original meta inf and manifest to new one in dits.

I just curious why Brut.all does not add this feature to apktool, otherwise I have to do this each time I re-pack an apk.
[G1 Android Development] pendo:
Always been like this afaik. (At least as long as I've been using it, which was almost 1 year ago that Brut.all helped me :))

There are some script programs that will give you a more automated feel if that's what you prefer. Daneshm90's apkmanager is the first to come to mind.

Additionally, for the most part, unless you're dealing with a system apk you don't need to copy the manifest or meta-inf. Just resign with testsign or with your private key if you wanted.
[G1 Android Development] lllboredlll:
maybe getting home after a 13hr 3rd shift can cause me to go ignorant but ..... anyone got any ideas on this one

linuxmint 11 if it matters

*********~/Droid/Tools/apktool $ apktool if com.htc.resources.apk

Exception in thread "main" brut.androlib.AndrolibException: java.util.zip.ZipException: error in opening zip file

at brut.androlib.res.AndrolibResources.installFramework(AndrolibResources.java:404)

at brut.androlib.Androlib.installFramework(Androlib.java:365)

at brut.apktool.Main.cmdInstallFramework(Main.java:185)

at brut.apktool.Main.main(Main.java:61)

Caused by: java.util.zip.ZipException: error in opening zip file

at java.util.zip.ZipFile.open(Native Method)

at java.util.zip.ZipFile.<init>(ZipFile.java:131)

at java.util.zip.ZipFile.<init>(ZipFile.java:148)

at brut.androlib.res.AndrolibResources.installFramework(AndrolibResources.java:374)

... 3 more
[G1 Android Development] tommytomatoe:
It's saying com.htc.resources.apk doesn't exist...

Try typing the whole path or just drag and drop the apk into terminal after typing apktool if
[G1 Android Development] bobo9900:
@Brut

Can you please take a look at this file?

http://depositfiles.com/files/jogx2s2ak

I've try to decompile the .apk, but how come there is no \Smali and \Asset folder.

Tried v1.4.1 and v1.4.2.

Any suggestion please..

Edit: Learned about system files and .odex. Finally managed to create smali files from odex. Still struggle to make the apk usable.
[G1 Android Development] svprm:
First of thanks for this.

Today I decompile the frameworks-res.apk

Then I modified something.

Then compile it.(successful)

Then I copy it to phone.

But not working.

Is I need to sign it after I compiled?
[G1 Android Development] xavierjohn22:
fyi,

have this apktool inside my xda autotool beta here

thanks brut.all for apktool

http://xdaforums.com/showthread.php?t=1053227
[G1 Android Development] tommytomatoe:
For system apk files, you want to copy over original meta inf to new apk in dist folder. The reason why is because you don't want to sign system files with your own key, which creates that meta inf folder.

Here is what I do.

Keep track of what you change. Say main.xml in layout-port. Just for show and tell. In the build folder, take only that file and place it in your ORIGINAL apk. Use that one. Now you will avoid any other misc errors.
[G1 Android Development] pendo:
lol...reminds me of how I used to edit frame-res files that had a ton of f'ed up 9 patch back before 1.3.1. I would use a "good" frame-res (or any file really as long as it would compile) and compile my xml in it, then inject it back into the "bad" file that wouldn't decompile. Doesn't work for all scenarios obviously, but in certain situations where you couldn't get a file to decompile it worked :)
[G1 Android Development] tommytomatoe:
I remember this. That little "good" framework trick worked for me months ago. Thanks again Pendo! I remember when I had issues too. Oh the days....

Even now with apktool 1.4.1 I still use the original apk and only inject compiled changes I've made if it is a system app. I think its faster than transfering old meta inf. Only time I use the apk in the dist folder is when it is a data app and I need to resign it. Just habits I guess. :-)
[G1 Android Development] svprm:
Thqnks for your information.

Working...
[G1 Android Development] Hatman41:
Htc Clock apk

Trying to decompile the HtcClockWidget so that I can do some XML edits and this is what I get. Anyone know what the issue is? Is it because it is an HTC Apk that I am trying to decompile?

D:\android-sdk-windows\tools\apktoolold>apktool d HtcClockWidget.apk ./outclockb
lue
I: Baksmaling...
I: Loading resource table...
I: Loaded.
I: Loading resource table from file: C:\Users\Jeffrey\apktool\framework\1.apk
I: Loaded.
I: Decoding file-resources...
I: Loading resource table from file: C:\Users\Jeffrey\apktool\framework\2.apk
I: Loaded.
W: Could not decode attr value, using undecoded value instead: ns=android, name=
drawable, value=0x0208013b
I: Decoding values*/* XMLs...
Exception in thread "main" brut.androlib.err.UndefinedResObject: resource spec:
0x020c00ba
at brut.androlib.res.data.ResPackage.getResSpec(ResPackage.java:61)
at brut.androlib.res.data.ResTable.getResSpec(ResTable.java:55)
at brut.androlib.res.data.ResTable.getResSpec(ResTable.java:51)
at brut.androlib.res.data.value.ResReferenceValue.getReferent(ResReferen
ceValue.java:59)
at brut.androlib.res.data.value.ResReferenceValue.encodeAsResXml(ResRefe
renceValue.java:46)
at brut.androlib.res.data.value.ResScalarValue.encodeAsResXmlValue(ResSc
alarValue.java:50)
at brut.androlib.res.data.value.ResScalarValue.serializeXmlBody(ResScala
rValue.java:81)
at brut.androlib.res.data.value.ResScalarValue.serializeToResValuesXml(R
esScalarValue.java:67)
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)
[G1 Android Development] pyrator:
my understanding is that this will not work with framework-res however can i use this and take, for example,

status_bar.xml (run it thorugh AXMLPrinter to get the readable XML),

Make my changes,

then Rebinary it (this is where i need apktool) and

Push it back to framework-res.apk with MetaMorph ?
[G1 Android Development] Brut.all:
No.

Currently we have only one solution to resources compiling: aapt - it is used internally by apktool. But it:

* requires full resources decompilation (apktool)

* can't compile system resources

Just give me some time. Apktool is just 3-weeks old at all and it is still rapidly developed :-)
[G1 Android Development] pyrator:
ok thanx for the reply, you way smarter then me lol. Awsome job though!! Keep up the good work we need people like you in the scene.
[G1 Android Development] Brut.all:
Could someone, who is more familiar to Android apps developing, tell me, how is it possible, that:

* in android framework some styles are public (eg. Widget.ListView) and other not (Widget.QuickContactBadge),

but:

* I don't see any access parameter in Android sources

* some apps use private framework styles
[G1 Android Development] Brut.all:
!!!!!

I just ran at (next) undocumented feature of Android resources:

https://android.git.kernel.org/?p=p...e.git;a=blob;f=core/res/res/values/public.xml

That's superb! I think using this I will be able to make possible to build framework/system resources and there are much more great things about it :-)

And it seems Google just break his own rules. These references mentioned in my last post are in DeskClock and Google Maps, so I think they built these apps for faked framework, cause they needed some private resources. Really, really dirty hack.
[G1 Android Development] canadiancow:
So this means that you can use certain system resources within an application? But I'm assuming you need to compile against a modified framework?

Is this what's causing you issues with Maps 4.1? You usually have the updates out very shortly after new releases, so I figured something must have changed.
[G1 Android Development] olearyp:
That's what it sounds like to me--except even Android's private API is public, since the sources have default visibility. The public/private division is maintained by limiting the resources contained in the SDK's android.jar.
[G1 Android Development] canadiancow:
The only issue then is that they can change a non-published API/resource without warning, and it could break apps.
[G1 Android Development] olearyp:
Which is why they're private APIs to begin with. But they are things that system apps (built with the platform) need access to, and Java's visibility properties aren't fine-grained enough to just use that.

The problem is when an app like Maps--not a system app at all--breaks the platform's own rules about API boundaries. There must be a reason someone thought that was a good idea.
[G1 Android Development] Brut.all:
No, no :-)

It means I can rebuild apps with same resId mappings as in original file, so:

it should be possible to rebuilt framework resources (great thing for themers)

there will be no need for resIds updating in smali code, so:

faster decoding and building apks

less bugs

we will be able to rebuilt only resources, without touching sources

These matters aren't connected to each other.

There is some new "weirdness" in GM4.1: "@*android:style/Widget.QuickContactBadge.WindowMedium" (note asterisk at the beginning) XML value, so it is not decodable by apktool0.9.2. I did't want to hack apktool for this exception, cause I was working on new XML decoder (pure Java :-) ), which does it automatically. I finished decoder a few hours ago, now I'm working on GM :-)
[G1 Android Development] Brut.all:
We have all resources in android.jar file, but public/private status is stored in resources.arsc file and aapt forbids linking to private resources. I hex-edited android.jar to make 2 widgets public (special hack for GM).
[G1 Android Development] canadiancow:
Sounds awesome. I can do a real-world test of Nav Launcher's update feature for your modified Maps soon :p