yashsingh1/xdaforums huggingface dataset:
[G1 Android Development] DJ Carpenter:
Okay, I'm trying to find solutions but I'm getting nothing.

And I'm only finding posts for windows.

I'm trying to decompile an apk using a Mac.

I haven't used APKTool since it was just folders and it was easy to edit.

Now it's completely different after not seeing it for so long.

When I try to decompile my framework-res.apk it says it's either non-existent or that it's readable only. I'm not sure how to fix this.
[G1 Android Development] Jazztrmpter:
Hey,

I feel like a complete noob now since the "Installation for noobs" didn't help me.

I'm running Win7 64bit. I have JRE, Eclipse, and Android SDK Tools all setup already. When I try to run the apktool.jar or the apktool.bat file, it opens and closes immediately. What am I missing?

Should I just try working in Linux?

Thanks.
[G1 Android Development] TUN_SD:
Yes, complete noob! :D

No offense man. Just kidding!

Try the link and type the command in the cmd window.

Good luck

send with a sandwich in my hand
[G1 Android Development] Jazztrmpter:
Haha, no offense taken. The problem was that I did not put the files into the Windows directory. I put them into a sub directory in My Documents where I do my dev stuff.

EDIT:

Now I am very frustrated. This thing can't find the file specified. I'm not too familiar with Windows command line syntax since I use Linux/Terminal for most things.

Please tell me if this is the right syntax for decoding an app with a sample title of app.apk:

apktool decode <app.apk> C:\Users\Username\Documents\

Where app.apk is the app name, and the directory is the directory where I want the files to go after being decoded. I take it that the app.apk file must be in the Windows directory with the apktool batch/java files, and the aapt application?

On the apktool install page it says aapt command in a PATH. What do I need to do for this?

Thanks.

Edit:

You know what, nevermind for now. I'll find a guide somewhere (because I'm sure one exists) rather than bug you guys here.
[G1 Android Development] DJ Carpenter:
Does anyone else use this with Mac rather than Windows?
[G1 Android Development] tommytomatoe:
I use on mac and Linux. Need help?
[G1 Android Development] dkdude36:
only use on mac. it wins hard. need help?
[G1 Android Development] DJ Carpenter:
Yes, I do! If you don't mind.

I haven't used this in over 6 months on a Windows computer and then it was just 4 folders and a script. Changed a lot since then.

I've been trying everything to decompile my framework-res using every code I've seen other people discuss using and it's not working at all. Furthest I got was an error.
[G1 Android Development] tommytomatoe:
You have multiple options. I also have android utility for mac if.you are looking.for.something user friendly.

Here are basic commands:

apktool if framework-res.apk

apktool d framework-res.apk

Install apktool.and apktool.jar to /usr/local/bin
[G1 Android Development] DJ Carpenter:
I tried both of those commands.

I kept getting that the file was non-existent or not readable.

At one point with the "if" code, It gave me some errors.

And I installed both of those in both my usr/bin and usr/local/bin

I didn't have a usr/local/bin, only the usr/bin. So, I made the second one and put it in there also to be safe. No such luck.
[G1 Android Development] tommytomatoe:
Please post your exact errors. That is beat place to start.
[G1 Android Development] DJ Carpenter:
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:193)

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

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:127)

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

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

... 3 more

Thanks for the help, man. I appreciate it.
[G1 Android Development] tommytomatoe:
Looks like.you aren't pointing it to the correct file.

Do.this.

Place file.on Desktop

cd Desktop

apktool if framework-res.apk

apktool d framework-res.apk

Btw, which type.of.Rom.is.this? Sense? Aosp? Gingerbread or.ics?
[G1 Android Development] DJ Carpenter:
That worked! Much easier just putting it on the desktop.

Earlier, I was trying to do the command to go to the folder also but couldn't figure it out.

I'll just drag it to the desktop from now on. Thanks!

And once I'm done editing it, what's the code to set it back up.

apktool r framework-res.apk?

And earlier, it was Gingerbread Sense. Now, it's ISC Sense.

Switched ROM's earlier
[G1 Android Development] tommytomatoe:
Ok.with sense you will need to run if on two apks:

apktool if framework-res.apk

apktool if com.htc.resources.apk

To.decode:

apktool d NAMEOFAPK.apk

To build:

apktool b NAMEOFAPK

Note.how during.the build I did not add the extension. For.framework-res,

apktool b framework-res

The new apk.will be in the decoded folder inside a folder called dist.

For changing.directories in terminal, use "cd"

Samples:

cd Desktop

cd $HOME/Desktop/folderondesktoo

cd $HOME/Documents

cd /usr/local/bin

cd .. = go back.one directory

cd ../.. = go back two directories

Let me.know.if.you need anything else.

Also, ics migjt.not work
[G1 Android Development] DJ Carpenter:
Thanks, man!

I'll try all this out tomorrow.

I have to go to work early so I need to get to sleep.

And the ICS one worked.

Are the same files that are in framework-res also in the htc.source apk?
[G1 Android Development] Bilgets:
hey, im using ubuntu linux.. trying to build framework file.. but get this error :http://pastebin.com/aF5V82Br

glad to have a help :D

and oh, this is ICS framework :D
[G1 Android Development] Youngunn2008:
im getting the same sort of errors using ubuntu 11.10 64 bit. driving me crazy! my windows vista can compile with apktool but not my linux? please any help...

---------- Post added at 12:20 AM ---------- Previous post was at 12:17 AM ----------

i could use help on linux...

---------- Post added at 12:27 AM ---------- Previous post was at 12:20 AM ----------

trying to decompile and immediately recompile SystemUi from ICS, errors as follow:

I: Framework installed to: /root/apktool/framework/1.apk

root@youngunn-Ubuntu-Desktop:/home/youngunn/apktool# apktool b -f SystemUI

I: Smaling...

I: Building resources...

invalid resource directory name: /home/youngunn/apktool/SystemUI/res/values-sw600dp-port

invalid resource directory name: /home/youngunn/apktool/SystemUI/res/values-sw720dp-port

invalid resource directory name: /home/youngunn/apktool/SystemUI/res/values-sw600dp

invalid resource directory name: /home/youngunn/apktool/SystemUI/res/drawable-sw600dp-hdpi

invalid resource directory name: /home/youngunn/apktool/SystemUI/res/values-sw720dp

invalid resource directory name: /home/youngunn/apktool/SystemUI/res/layout-sw600dp

Exception in thread "main" brut.androlib.AndrolibException: brut.common.BrutException: could not exec command: [aapt, p, -F, /tmp/APKTOOL1111850779241239456.tmp, -I, /root/apktool/framework/1.apk, -S, /home/youngunn/apktool/SystemUI/res, -M, /home/youngunn/apktool/SystemUI/AndroidManifest.xml]

at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.java:193)

at brut.androlib.Androlib.buildResourcesFull(Androlib.java:301)

at brut.androlib.Androlib.buildResources(Androlib.java:248)

at brut.androlib.Androlib.build(Androlib.java:171)

at brut.androlib.Androlib.build(Androlib.java:154)

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, /tmp/APKTOOL1111850779241239456.tmp, -I, /root/apktool/framework/1.apk, -S, /home/youngunn/apktool/SystemUI/res, -M, /home/youngunn/apktool/SystemUI/AndroidManifest.xml]

at brut.util.OS.exec(OS.java:83)

at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.java:191)

... 6 more

---------- Post added at 01:12 AM ---------- Previous post was at 12:27 AM ----------

omg, i finally got it fixed...........

UPDATE YOUR AAPT!

i found the actual updated one in my platform-tools folder in sdk, called aapt-backup.

cp aapt-backup /usr/local/bin/aapt

bingo
[G1 Android Development] horndroid:
Can you please upload your aapt.exe?
[G1 Android Development] bombadier:
From platform-tools revision 11

cant seem to upload direct,get it from my dropbox
[G1 Android Development] horndroid:
I already have that one. But i still get the same error(in youngunn2008's post) when recompiling systemui.apk from ICS roms. There is no error when recompiling systemui.apk from AOSP type ICS roms though.
[G1 Android Development] Youngunn2008:
Oh I'm working in Linux, sorry ... but still make sure aapt is up to date, just download latest sdk tools
[G1 Android Development] Youngunn2008:
I'm working with aosp ics, what ics is giving you errors? Sense?
[G1 Android Development] horndroid:
The official stock ICS for Asus Transformer. It's not possible for me to recompile its systemui.apk even if I am simply decompiling and recompiling without making any changes. I get exactly the same error you pasted in your post.

However, I have no problem with custom AOSP based ICS roms for Transformer.

I have the latest SDK and aapt.exe

The only logical answer I could find so far was that apktool just doesn't work well with ICS.

Which version of apktool are you using?
[G1 Android Development] he_stheone64:
Try decompiling without classes.dex and then reinsert stock classes.dex in your edited and compiled version.
[G1 Android Development] horndroid:
That's like the first thing I tried. Doesn't work. I've tried pretty much every possible workaround I could google.
[G1 Android Development] Youngunn2008:
I believe its 1.4.3, latest available from Brut.all
[G1 Android Development] Thatgrass:
stupid question but what are:

•JRE 1.6 (Java Runtime Environment)

•aapt command in a PATH

?

thanks :D
[G1 Android Development] Nemado:
Hi!

And thanks a lot for this tool. I'm trying to translate MIUI 2.4.20 and I've run into two different error messages when trying to decompile Contacts.apk and Vending.apk :

[*] _INPUT_APK\Contacts.apk
decompiling _INPUT_APK\Contacts.apk...
I: Baksmaling...
I: Loading resource table...
I: Loaded.
I: Loading resource table from file: C:\Users\Bavid\apktool\framework\1.apk
I: Loaded.
I: Decoding file-resources...
[COLOR="Red"]S: Could not decode file, replacing by FALSE value: drawable-hdpi-finger/sym_sms_p.png
S: Could not decode file, replacing by FALSE value: drawable-hdpi-finger/sym_sms_n.png[/COLOR]
I: Decoding values*/* XMLs...
I: Done.
I: Copying assets and libs...
[*] _INPUT_APK\Vending.apk
decompiling _INPUT_APK\Vending.apk...
I: Baksmaling...
I: Loading resource table...
I: Loaded.
I: Loading resource table from file: C:\Users\Bavid\apktool\framework\1.apk
I: Loaded.
I: Decoding file-resources...
I: Decoding values*/* XMLs...
[COLOR="red"]Exception in thread "main" brut.androlib.err.UndefinedResObject: resource spec: 0x01030119
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(ResReferenceValue.java:59)
at brut.androlib.res.data.value.ResReferenceValue.encodeAsResXml(ResReferenceValue.java:46)
at brut.androlib.res.data.value.ResScalarValue.encodeAsResXmlAttr(ResScalarValue.java:43)
at brut.androlib.res.data.value.ResStyleValue.serializeToResValuesXml(ResStyleValue.java:48)
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:128)
at brut.apktool.Main.main(Main.java:65)[/COLOR]

The framework-res.apk was successfully installed and every other app decompiled flawlessly. It's a gingerbread ROM (I don't know if some apps come from ICS) and I'm using apktool v1.4.3. Any help would be greatly appreciated.
[G1 Android Development] iBotPeaches:
I've started re-doing lots of this app to fix the bugs I've encountered translating MIUI. It took me about 3 months just to understand the coding and figure out how it worked.

I released v1.4.5 privately to a couple of testers and working through about 3 bugs listed here: https://github.com/iBotPeaches/brut.apktool/issues

I plan on updating this and bring back updates when needed. I tried to approach brut.all many times and it all failed. I'm currently re-doing lots of decoding to properly handle xlif data, not switch up item attributes and fix the positional bug with formatted=false attributes (which has to do with the xlif).

I'll try and post updates in this topic, otherwise watch the git.
[G1 Android Development] LordXeth:
Hello

I would like recompilen decompilen the Phone.apk & Contacts.apk :confused:/. I took them out of Rom "cm_vision_kang-428.4b9332b8" ...

this is for HTC Vision!!

I just get error messages .. APKTool version with which I can edit it?

mfg LordSeth
[G1 Android Development] iBotPeaches:
Whats the message? Use 1.4.3 and update your aapt along with fixing the XML after decompiling so that it can be recompiled correctly.
[G1 Android Development] LordXeth:
here is my original files and sources...

actually it is only the Phone.apk!

I used the APKTOOL version 1.4.3, there have also tried with 1.4.2! But that was on my cell phone's FC
[G1 Android Development] iBotPeaches:
Go into strings.xml and every value that has a % in it, add the attribute formatted=false.

This is because apktool doesn't know how to handle xlif data. I'm trying to fix that currently.
[G1 Android Development] LordXeth:
Thanks Man, this work fine:eek:
[G1 Android Development] LordXeth:
Damn, looking forward to early ...

as soon as I start this error comes Phone.apk
[G1 Android Development] iBotPeaches:
As you probably know. That doesn't help at all. The actual error or log will help track it down.
[G1 Android Development] LordXeth:
The app can compile now, they just start coming in, "android.process.acore" has unexpectedly quit.
[G1 Android Development] TUN_SD:
Afaik, phone and contacts apk should be built from source. Otherwise you get these errors.
[G1 Android Development] Thatgrass:
?

Don't forget to hit thanks
[G1 Android Development] jackq:
I have problem with contacts.apk too (CM9), phone.apk work perfect but when i recompile contact.apk (change pngs and xml - font color) in apktool or apk manager i don't have any errors.

When i put recompiled file to my phone and start phone.apk i got FC - contacts app was closed... any idea?
[G1 Android Development] zelendel:
You cant change the xml in the contacts app with out it breaking. If your gonna edit it then it has to be done from source. PNGs work fine though
[G1 Android Development] jackq:
ok, thanks, now i know. but from source i can't set this color cos it's set in color.xml
[G1 Android Development] iBotPeaches:
Thats because the attribute of some of the XML files (bools, strings, anims) are switched with the xml node type.

So

<item attrib="id" name="test">value</item>

becomes

<id name="test">value</id>

So it re-compiles fine, but breaks the app on running. This is a fix in progress for apktool 1.4.6. You can manually fix the XML files (there will be a lot) accordingly to what I said, and that'll work for the time being.

I should have apktool 1.4.6 out by the end of this month. I plan on being done in a week, and then performing tons of tests.
[G1 Android Development] jackq:
so i must wait when You finish new apktool. I don't want to fix xml's ;)

Now i only change pngs, and font stays in blue...

thanks for answer, cheers
[G1 Android Development] iBotPeaches:
Fair enough. It is a lot of work :p

I'll keep you updated. Thanks
[G1 Android Development] roblav96:
i appreciate your work towards apktool. it needs updating desperately =]
[G1 Android Development] expeacer:
Hey!

I now found the update, i'm daily using APKTool, and very glad to see anybody updating this tool.

I have a very simple question: How can I build the new tool from source?

I tried the old APKTool instructions, but I can't get it to work.

Thanks a lot for your help!
[G1 Android Development] iBotPeaches:
You can build mine from source, like many others have but please don't claim it as your own like a few here have :o

### Download apktool sources
$ git clone git://github.com/iBotPeaches/brut.apktool.git apktool
$ cd apktool

### Build
$ mvn package

Version 1.4.6 hasn't been pushed publically yet, but it fixes the apktool.yml bug as well as the double substitution error with xlif data.
[G1 Android Development] iBotPeaches:
I did change brut.apktool.smali, forgot about that :p

### Download, build & install brut.apktool.smali
$ git clone git://github.com/iBotPeaches/brut.apktool.smali.git brut.apktool.smali
$ cd brut.apktool.smali
$ mvn install

Then run "mvn package" from the root of brut.apktool. It should find brut.apktool.smali now.

If it errors about other packages. I didn't change common, utils or dir so grab those from brut.all's original REPO like so.

### Download, build & install brut.j.common
$ git clone git://github.com/brutall/brut.j.common.git brut.j.common
$ cd brut.j.common
$ mvn install
$ cd ..

### Download, build & install brut.j.util
$ git clone git://github.com/brutall/brut.j.util.git brut.j.util
$ cd brut.j.util
$ mvn install
$ cd ..

### Download, build & install brut.j.dir
$ git clone git://github.com/brutall/brut.j.dir.git brut.j.dir
$ cd brut.j.dir
$ mvn install

So your folder structure should look like this

brut.apktool (My repo version)

brut.apktool.smali (my repo version)

brut.j.dir (brut's repo)

brut.j.util (brut's repo)

brut.j.common (brut's repo).

Then after "mvn install" all those directories (except brut.apktool). CD into brut.apktool and run "mvn package".
[G1 Android Development] iBotPeaches:
That was a mistake on my end of the repo. I updated it. Let me know if it fixes it. Nothing on your end required. Just re-issue the same commands. It should find the maven stuff. I'm currently in the process of moving, so can't actually check and verify the fixes for myself until Sunday when I'm settled in.
[G1 Android Development] iBotPeaches:
Forget that Maven crap. It builds fine here. I'll just release the binary for v1.4.5. v1.4.6 is in testing and just isn't ready for the public.

http://connortumbleson.com/apktool-v1-4-5-a-tool-for-reverse-engineering-apk-files/

You may find the updated apktool above. It will work with ICS very well. Credits to JesusFreke and others involved in baksmali/smali as well as brut.all for the original apktool.

Bugs here: https://github.com/iBotPeaches/brut.apktool/issues?state=open

Updates here: http://connortumbleson.com/apktool-v1-4-5-a-tool-for-reverse-engineering-apk-files/

Thanks,

iBotPeaches
[G1 Android Development] expeacer:
Thanks a lot this is te most easiest method! :)

I hope it can recomplie the MIUIv4 Music Player :)

Thanks again!
[G1 Android Development] jackq:
Apktool 1.4.5 doesnt work for me (ics 4.0.4)

look at screenshot
[G1 Android Development] iBotPeaches:
Yeah that must of been a simple rebuild problem. v1.4.6 I haven't experienced that problem, but I'm not releasing v1.4.6 until I'm confident its working, or pushing any of my source public since some users on XDA are rebuilding my source and claiming it as their own.
[G1 Android Development] jackq:
Maybe you can share that new amazing tool ;) i only want to decompile contacts, cos earlier version of apktool has problem with this apk.

or if you can and have some free time i will send you apk and files that i want to replace, and you recompile this for me :D
[G1 Android Development] iBotPeaches:
I have all intention with sharing the tool. However, when I first began work on 1.4.4 and 1.4.5 I released a couple of versions without properly labeling them, so now there floating around and getting me mixed up.

I will release v1.4.6 when I feel its ready. I'm still working through three bugs that I want to get finished before releasing. I'll see about getting a 1.4.5b fix uploaded, because that error was just me building apktool incorrectly :(
[G1 Android Development] tommytomatoe:
Just curious Peaches, are you in contact with brut.all?
[G1 Android Development] iBotPeaches:
I sent him many emails as well as PMs before I started this. Outlining the problems and possible avenues of fixes. I haven't received a response ever.

Not even a response saying, "Sorry I don't work on this anymore". I think he is just MIA.
[G1 Android Development] Ticklefish:
That's sad, though not that unusual. Maybe he's been seduced by iPhone? Boo, hiss, etc.

Sent from my U20i, SK17i, GT-P1010 or something else entirely.
[G1 Android Development] hafatih27:
newbie, please excuse :)

dear masters, as a newbie i just wanna ask where to place .apk file if i wanna do something to it?

thanks :)
[G1 Android Development] iBotPeaches:
That makes no sense. Just tell apktool to hit that apk.

EX

(java -jar apktool.jar d ~/path/to/file.apk)

Make sure you apktool if the frameworks first.
[G1 Android Development] he_stheone64:
Since many people frequently hit a wall, especially with latest Sense devices, here my Thread with some common fixes:

http://xdaforums.com/showthread.php?t=1642224
[G1 Android Development] xneo70:
Sorry if this is the wrong place to post, but i thing you could help me with this.

I use apktool to decompile an apk theme for the cyanogen mod 9 theme engine. I would like to make some changes in the grafiks, and then compile it again to a new apk.

But if i try to compile anything i get errors, even if i don't change anything.

What i got: i got this apk:

https://play.google.com/store/apps/details?id=com.mrdsl.theme.mixerics&feature=search_result

I decompile it using this version of apktool-jar

http://connortumbleson.com/apktool-v1-4-5-a-tool-for-reverse-engineering-apk-files/

And on decompiling all goes ok. Now i tried to recompile the same apk, without changing anything, but i get this errors:

I am using linux kubuntu 11, and a Samsung Galaxy S2, with the cyanogen mod 9 onboard. (latest nightly)

Can someone help me with this?
[G1 Android Development] iBotPeaches:
Yeah all of those are because apktool is borking parts of the XML. Proud to say that id bug where <item> because <id> is fixed in v1.4.6.

https://github.com/iBotPeaches/brut.apktool/issues/1

That bug should be for this report. I plan on working on apktool a lot today.

Temporary fix: Just delete those folders from the decompiled apk folder, then it will rebuild.
[G1 Android Development] raziel23x:
When can we aspect the next release as i cant find a download link for 1.4.5 anywhere.
[G1 Android Development] iBotPeaches:
I did a lot of work today. I'll do some testing later tonight and then update the bug tracker depending if the fixes worked.

I re-updated the link to v1.4.5 on the blog. I had updated an old v1.4.5, and mike (who I sent it to had the correct version). Sorry about that. I plan on incrementing the end number for any release to prevent confusion on the versions.
[G1 Android Development] he_stheone64:
Thx for beeing on that project, the whole modding community is really pretty much dependent on keeping this project alive. BTW - have you ever looked into HTC`s m.10 files? If there is any interest and you believe it`s possible to reverse engineer these, you could contact diamondback, who originally cracked these with flemmard, who left that project a few months ago.

In any case thx for your efforts.
[G1 Android Development] Ticklefish:
Many thanks for all your hard work. I'm just as impatient as anyone to get my hands on the latest version, but I'm prepared to wait.

Apktool is such an essential tool for Android modding that I'd rather the next version worked and wasn't rushed.

So relax, have a cup of coffee and take your time. :D