yashsingh1/xdaforums huggingface dataset:
[G1 Android Development] zygame:
Hi Brut

I've been updated the latest version of your excellent apktool,but I found that when I decode a apk with 9patch files,all of them are lost,and 9patch folder is empty.

I'm already installed the framework-res.apk and com.htc.resoureces.apk with apktool if command,but version 1.1.1 works well at the same file.

no idea what's wrong I've done.
[G1 Android Development] Brut.all:
I have just decoded some apk and everything went ok. But I have touched 9patch code recently, so it's possible, that I have screwed something. Could you upload your apk file (ofc original one)?
[G1 Android Development] ihtfp69:
Can someone help with changing Phone.apk? To start, I simply used apktool to decompile and build the apk again. I did not make any changes. I re-signed it and pushed it back to my phone. But when I go to make a call, it crashes and throws an error ActivityNotFoundException. What am I doing wrong?

EDIT: Tried zipalign. Still a no go.
[G1 Android Development] canadiancow:
Why are you using apktool on an open source application?
[G1 Android Development] ihtfp69:
Re: [UTIL][03.06.10] Apktool v1.2.0 - a tool for reengineering apk files

I don't know. I'm still new at this. Although, I'm not sure compiling from source would help. It still has to be signed which doesn't seem to work. Even resigning without using apktool breaks the app. What's confusing is the error message you get. I'll try your suggestion, thanks.
[G1 Android Development] Roladriz:
When I get an error thrown at me due to signing, I nuke the META INF folder, then sign and everything works. I do it every time now without really thinking about it. It is part of my daily routine. Good Luck.
[G1 Android Development] zygame:
Oops,I made a mistake to see an empty folder and thought it should have 9patch in it,but it dosn't,sorry.:confused:
[G1 Android Development] ihtfp69:
Re: [UTIL][03.06.10] Apktool v1.2.0 - a tool for reengineering apk files

Thanks, I will try that.

-------------------------------------

Sent via the XDA Tapatalk App
[G1 Android Development] stari4ek:
One more tidbit.

If you re-sign Phone.apk, all other apks which has android.uid.phone as shared uid should have the same sign. Otherwise system will reject it, due certificate incompatibility.

For Sprint htc hero 2.1-update1 rom when I rebuilt Phone.apk I resigned next apks:

# android.uid.phone
^DMPortRead.apk$
^FieldTest.apk$
^FieldTrial.apk$
^IQRD.apk$
^Phone.apk$
^Settings.apk$
^TelephonyProvider.apk$
^Stk.apk$
# android.uid.system
^AccountAndSyncSettings.apk$
^AccountSyncManager.apk$
^CheckinProvider.apk$
^GoogleCheckin.apk$
^GoogleSubscribedFeedsProvider.apk$
^HTCSetupWizard.apk$
^HtcAddProgramWidget.apk$
^NetworkLocation.apk$
^SettingsProvider.apk$
^VpnServices.apk$
^WidgetDownloadManager.apk$
^framework-res.apk$

If you change resources only, you can just re-add updated to apk through zip command (but you should build them with apktool before adding). In this case - no need to re-sign stuff.
[G1 Android Development] Brut.all:
If you want to build apk to dist/out.apk (e.g. to simplify scripting), then just type it as destination: "apktool b . dist/out.apk". Ahh and I just noticed, that apktool builds old projects to dist/out, instead of dist/out.apk :-/ I will fix this.

And note about 9 patch decoding:

http://code.google.com/p/android-apktool/issues/detail?id=2#c5

Apktool 1.3.0 can build old projects using 9patch workaround.
[G1 Android Development] stari4ek:
Guys,

1.3.0 rocks!

I don't even know what I'd like to see in the next release, cause now it can do everything you need.

Great work!
[G1 Android Development] lolmensch:
sry. was a very obvious solution. >.<
[G1 Android Development] olearyp:
It is but it works just fine (it's what I did since I don't need any more dev stuff on my Mythbuntu computer :)).
[G1 Android Development] fede DREAM ITA:
I can not use it, I qeusti errors, can you help?

fede@ChampionsLeague:~/Android/sdk/tools$ ./apktool my.apk dir
Exception in thread "main" java.io.FileNotFoundException: /home/federico/Android/sdk/platforms/android-2.1/android.jar
at brut.apktool.Main.getAndroidJarPath(Main.java:55)
at brut.apktool.Main.main(Main.java:34)
[G1 Android Development] olearyp:
You need to install the Android 2.1 platform (FileNotFoundException means that a file wasn't found, surprisingly). Follow the directions on http://developer.android.com/ for installing a platform.

You've also run the command incorrectly, forgetting the "d" argument, though maybe that changed. That's how it worked a couple days ago.
[G1 Android Development] seaweeduk:
Hi Brut.all

I was trying to change the DeskClock.apk included in the latest CM, when I try to run apktool b after making my changes I get the following error

Exception in thread "main" brut.androlib.AndrolibException: brut.androlib.AndrolibException: Could not build apk for dir: /home/anthony/Desktop/DeskClockD/.
at brut.androlib.Androlib.build(Androlib.java:65)
at brut.apktool.Main.main(Main.java:42)
Caused by: brut.androlib.AndrolibException: Could not build apk for dir: /home/anthony/Desktop/DeskClockD/.
at brut.androlib.ApkFile.build(ApkFile.java:135)
at brut.androlib.ApkFile.build(ApkFile.java:96)
at brut.androlib.Androlib.build(Androlib.java:60)
... 1 more
Caused by: brut.androlib.AndrolibException: brut.common.BrutException: could not exec command: [aapt, p, -F, /home/anthony/Desktop/DeskClockD/build/tmp.apk, -I, /home/anthony/android-sdk-linux_86/platforms/android-2.1/android.jar, -M, /h
ome/anthony/Desktop/DeskClockD/./AndroidManifest.xml, -S, /home/anthony/Desktop/DeskClockD/./res]
at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.java:131)
at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.java:100)
at brut.androlib.ApkFile.build(ApkFile.java:103)
... 3 more
Caused by: brut.common.BrutException: could not exec command: [aapt, p, -F, /home/anthony/Desktop/DeskClockD/build/tmp.apk, -I, /home/anthony/android-sdk-linux_86/platforms/android-2.1/android.jar, -M, /home/anthony/Desktop/DeskClockD/./
AndroidManifest.xml, -S, /home/anthony/Desktop/DeskClockD/./res]
at brut.util.OS.exec(OS.java:52)
at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.java:129)
... 5 more

any ideas? I have aapt install and in the path directory...
[G1 Android Development] Brut.all:
It is one of the "weird" apps:

res/layout/alarm_alert.xml:6: error: Error: Resource is not public. (at 'src' with value '@android:drawable/call_contact').

android.R.drawable.call_contact should not be accessible for apps, but it is somehow referenced from DeskClock.apk . I have even seen apps referencing to non existent resources :-/

I think Google and manufacturers have some private tools for building apps. We need to write our own aapt tool to support some of the system apps.
[G1 Android Development] seaweeduk:
Ah yeah I figured as much after reading your response earlier. I'll stick with swapping the png's thanks for the excellent tool anyway, and thanks again for your work on maps :)
[G1 Android Development] BatsShadow:
What's in the libAndroid.so? Can you release the source so we can try to get this working on OS X?
[G1 Android Development] Brut.all:
Some AOSP bits + my mods to not compile 4000 files for just a subset of features (Android sources are all-includes-all type) + JNI interface. I will upload it here in a while.
[G1 Android Development] Brut.all:
Is's messed up a bit - I don't like C++, so it's enough for me, that it works ;-)
[G1 Android Development] Brut.all:
@seaweeduk

I've modified android.jar file to make these resources public and now I am able to rebuilt working DeskClock.apk :-) If you don't want to replace file in SDK, you may just create new dir with ./platforms/android-2.1/android.jar in it. I'm also attaching newer apktool, which you will probably need to build that app.
[G1 Android Development] BolecDST:
Will this work under ubuntu livecd? And is there a possibility to create something like this for windows users (sometime in future ofcourse). Thanks in advance for the answers.
[G1 Android Development] Brut.all:
Virtualbox + installed Ubuntu is a much better solution.

Of course yes :-) Most of the tool is platform independent, I must recompile C++ code for Windows.
[G1 Android Development] olearyp:
These will get you going quickly:

VirtualBox Ubuntu Images

VirtualBox Xubuntu Images (should be a tad quicker, using XFCE instead of GNOME)
[G1 Android Development] myn:
Running apktool-0.9.1 on Ubuntu I am getting the following error message:

root@ubuntu:/storage/Downloads/apktool-0.9.1# ./apktool
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
at brut.apktool.Main.main(Main.java:32)
[G1 Android Development] olearyp:
You have to supply command line arguments (though that exception should probably be caught and usage text displayed.)

ALSO, OFF-TOPIC: Why are you logged in as root on an Ubuntu machine? Especially if you're trying to run apktool, which has no privilege escalation requirement?
[G1 Android Development] zer0day:
You need to provide some arguments to the tool, see the project home page for example.
[G1 Android Development] myn:
Thanks. I thought it may be the lack of bounds checking.

Regarding root. I am running in a virtualized environment.
[G1 Android Development] seaweeduk:
You absolute legend! Thanks so much works great :D :D
[G1 Android Development] seaweeduk:
Here's the modded deskclock (was only the widget I wanted to make changes to) and a screenshot in case any one was interested

Remove the old deskclock.apk from /system/app and install the attached replacement if you want it
[G1 Android Development] canadiancow:
I can think of something I'd like.

-d j ;)
[G1 Android Development] placebo73:
Thanks for your work...i managed to decompile and built on windows:) but now i am running ubuntu 10...and dont know what i should input for the path,

i want to use the desktop as workspace and have stored my apkś in Downloads....I am a noob with ubuntu, can somebody help me? .

...sorry, maybe bad English

Thanks in advance
[G1 Android Development] olearyp:
Your files will all be in a directory /home/username, analogous to c:\Users\username under Windows (or C:\Documents and Settings\username under earlier NT-based Windows). From there just drill down; your desktop is /home/username/Desktop.

Now, shells expand the character "~" to "/home/username" with the name of the current user. Therefore, the quickest way to get to your desktop folder is to enter "~/Desktop".

That help? You should probably spend some time reading up on basic concepts--there are some good tutorials out there, and we won't derail the apktool thread too much with noob Unix questions. :D
[G1 Android Development] placebo73:
Thank you very much for your help:) ...but i am missing something i think. And i am sorry for my noob questions here.

here is what i did enter

joris@joris-desktop:~$ apktool d "home/joris/photoshop.apk" "~/Bureaublad"

Destination directory (/home/joris/~/Bureaublad) already exists. Use -f switch if you want to overwrite it.

Bureaublad means Desktop in Dutch btw:)
[G1 Android Development] Brut.all:
If you want to use absolute path, then you have to prefix it by "/". "home\joris\photoshop1.2" seen from /home/joris is: /home/joris/home/joris/photoshop1.2. This is exactly the same as on Windows.

Ahh and TAB button is your best friend. It works poor on Windows, but on Linux it's really powerful. Don't guess what to write: type "photo<TAB>" and if shell finish name for you, then you could be sure, that it's is ok.

Besides: is photoshop1.2 really apk file? It doesn't have .apk extension.
[G1 Android Development] olearyp:
Try `apktool d ~/photoshop.apk ~/Bureaublad/photoshop' (w/o the enclosing quotes or the quoted paths) which should put it in a new folder on the desktop. Otherwise apktool will delete everything already on the desktop if you -f(orce) it, which would be bad. :) Incidentally, quoting the paths will prevent the shell from substituting for the '~' character, which isn't what you want either.
[G1 Android Development] Brut.all:
You have totally reedited your post. .. :-/

Hah, next guy, who want to lost his Desktop ;-)

I think error message is straightforward - you must add -f switch, because destination directory already exists. But don't do that! You don't select a directory, where apktool will create a subdirectory - it will remove/replace your Bureaublad directory, if you will run it with such args!

You said you have used apktool on Windows? But usage is the same as on Linux...
[G1 Android Development] younghuss:
Hello im trying to figure out how to use apk programs i have a sprint htc hero I no clue where to get started. What are some step I can go to put these programs on my phone?
[G1 Android Development] Brut.all:
And what does this have to do with apktool?
[G1 Android Development] placebo73:
thanks olearyp for the help:)

@ brut.all I reedited my post because i tried so much ways of input in the terminal, sorry about that..... My knowledge of linux is just 2 days old;)

in windows i did put in exactly this...apktool d "C:\Users\Myname\Downloads\file.apk" "C:\Users\Myname\Downloads\Folder with apk name"....That worked for me.

But i just dont know what to type in the terminal on linux....can you give me an example? ...because i just dont get it.

The photoshop apk is a real apk btw,and it works but just use it to test apktool....itś in chinese

edit: i finally figured it out with the tab button....Thanks for the tip brut.all and for helping me out:)

cheers
[G1 Android Development] canadiancow:
lol

Users are losers.
[G1 Android Development] Brut.all:
You could see on the project page, which issues were fixed. Actually... all of them ;-)
[G1 Android Development] eViL D::
I'm trying to rename an app, by changing the name in values/strings.xml of app_name.

That's all I want for this particular app, it builds correctly, but it always fails to install. Any ideas?

***N/M, I just resigned it and it worked.
[G1 Android Development] Brut.all:
I've just created Google Group about apktool:

http://groups.google.com/group/apktool
[G1 Android Development] MrJabber:
Is the HtcLockScreen.apk one of those "wierd" apps? I extracted the framework from my phone to use. It decompiles without any errors. However, I cannot get it to recompile due to that "Error: Resource is not public" issue. Is there a way around this or to make it public?
[G1 Android Development] Brut.all:
Issue was fixed several weeks ago. How did you installed htc resources?
[G1 Android Development] zach.xtr:
Settings.apk Build Error

First of all thank you for the wonderful tool!

I am tiring to remove a few options from the Settings.apk for an Eris build and have been able to decompile and make the simple code changes (I think) but am getting the following error when I go to build the apk again...

See attached image

Being new to the Android environment it seems I am missing something silly here on how I am using the tool... Or is Settings.apk a "weird" app?

Any thoughts much appreciated.

[EDIT] Did not have installed correctly thanks for the tip! I have built the file and am now trying to learn which other apk files I will have to resign to get the new Settings.apk to take on the Eris ROM :-\
[G1 Android Development] Brut.all:
"Cannot run program "aapt", The system cannot find the file specified" - seems apktool isn't properly installed.
[G1 Android Development] petsasj:
Brut.all i came across a bug.

I am trying to decompile framework-res.apk for my HTC Hero. I am running a deodexed build, and i want to change a value in ../../res/values/arrays.xml.

The steps i follow are these:

apktool if com.htc.resources.apk
apktool if framework-res.apk (have tried without doing this)
apktool d framework-res.apk framework
cd to whatever the place is and gedit the arrays.xml
apktool b framework-res.apk

I use the same sign keys as the initial framework-res.apk. The images come all distorted and i don't really have an operating phone as almost everything FC's.

What i ended up doing is taking the resources.asrc from the new built apk and replace them over to the old one, just to have the arrays.xml edited. That worked fine, but i thought i should let you know of this bug.

Let me know if you need something to regenerate this bug.
[G1 Android Development] Brut.all:
Hmm... strange... looks like certificate issues, but if you was able to install your modified apk, then I guess you know, how to properly install framework-res.apk file. Did you installed both files in exactly same way? If you would be bored enough, you could try to install apk built by apktool and see, what are these FCs - look into logcat.
[G1 Android Development] atrant:
Hello! I'm trying to decompile Sony X10 music.apk. But I don't know how to decompile files inside com.android (I think program skips it, doesn't it?). I have manifest and res folder only after decompiling

I have not found any triggers in command line. Please, help =)
[G1 Android Development] Brut.all:
What are "files under com.android"? What exactly are you missing?
[G1 Android Development] petsasj:
I'll do that tomorrow.
[G1 Android Development] atrant:
I mean I have no smali files. should I send apk to you?
[G1 Android Development] Brut.all:
No, I think your apps are odexed, so there is no code in apk file. Search for *.odex file and deodex it using baksmali: http://code.google.com/p/smali/wiki/DeodexInstructions
[G1 Android Development] atrant:
thank you! Everything is fine now =)
[G1 Android Development] santiemanuel:
framework

Hey brut thanks for this tool im currently using latest version. I got some problems with framework-res. I made changes into values folder(to decompile i leave untouched the 1.apk with resoucers.arsc) Then i recompile. I thought the changes are in resources.arsc exclusively so i replaced resources.arsc in original framework-res.

Result, bootloop in android. And drop in size form 3mb to 2.5mb, any help?
[G1 Android Development] Brut.all:
I think you can't push framework-res.apk file just like that. Install it through update.zip .
[G1 Android Development] santiemanuel:
Every mod to framework i've made worked just replacing in rootexplorer, (pngs and xmls like status bar, battery etc), i only have issues with resources.arsc

The message:

W: could not find sources is normal?(windows 7)
[G1 Android Development] Brut.all:
Yeah, it's normal for framework-res.apk file. What errors do you get in the logcat during bootloop?
[G1 Android Development] santiemanuel:
I didnt use logcat, ill try, the modding i made in values folder, nothing else, is only in resources.arsc? Or i need to replace something else.
[G1 Android Development] Brut.all:
Yeah, replacing resources.arsc should be enough.
[G1 Android Development] santiemanuel:
Compiling

Here I am again, i got the icons from battery, ive added a bunch, modified levels in drawables, all ok, then in values/public.xml i add to the final of the text the ids ive followed the number from the last item carefully, when i finish i do :

apktool b framework-res

heres the result

c:\android\tools\framework-res\res\values\public.xml:3420: error: Public resource drawable/stat_sys_battery_0 has conflicting type codes for its public identifiers (0x8 vs 0xf).

same error 51 times, (yes 56 icons added)

then:

c:\android\tools\framework-res\res\drawable\stat_sys_battery_charge.xml:479: error: Error parsing XML: mismatched tag

Exception in thread "main" brut.androlib.AndrolibException: brut.common.BrutExce

ption: could not exec command: [aapt, p, -F,C:\Users\santiago\AppData\Local\Tem

p\APKTOOL7358050707787791641.tmp, -x, -0, arsc, -S, c:\android\tools\framework-res\res, -M, c:\android\tools\framework-res\AndroidManifest.xml, c:\android\tools\framework-res\9patch]

at brut.androlib.res.AndrolibResources.aaptPackage(Unknown Source)

at brut.androlib.Androlib.buildResourcesFull(Unknown Source)

at brut.androlib.Androlib.buildResources(Unknown Source)

at brut.androlib.Androlib.build(Unknown Source)

at brut.androlib.Androlib.build(Unknown Source)

at brut.apktool.Main.cmdBuild(Unknown Source)

at brut.apktool.Main.main(Unknown Source)

Caused by: brut.common.BrutException: could not exec command: [aapt, p, -F, C:\Users\santiago\AppData\Local\Temp\APKTOOL7358050707787791641.tmp, -x, -0, arsc, -

S, c:\android\tools\framework-res\res, -M, c:\android\tools\framework-res\AndroidManifest.xml, c:\android\tools\framework-res\9patch]

at brut.util.OS.exec(Unknown Source)

... 7 more

S.O.S

Note: Using winrar i've replaced resources.arsc inside the apktool with my build.
[G1 Android Development] Brut.all:
@santiemanuel

Post your public.xml . "Error parsing XML: mismatched tag" says that it isn't even valid XML document :-)
[G1 Android Development] udK:
[OT]

Brut.all, can I suggest you to ask to a mod to move this thread inside Chef Central -> Android forum, as this tool is compatible with Android and not only with the G1.

[/OT]
[G1 Android Development] santiemanuel:
Here are the modified files, the png were added after decompiling to avoid errors.
[G1 Android Development] Brut.all:
<public type="plurals" name="wifi_available_detailed" id="0x010f0011" />
<public type="drawable" name="stat_sys_battery_0" id="0x010f0011" />

As you can see you have put drawable in the section of plurals, in addition 0x010f0011 id was doubled. Last drawable is 0x0108032e, so you should start your from 0x0108032f.

But... do you really need these public declarations or you just think, that you need them? :-) I always say that if I don't say otherwise, then you should treat decoded app as you would have original sources. But you don't create public.xml file normally, right? ;-)

public.xml is needed because of resource references from a code. If you want to use these drawables in a code, then you need some way to reference them (you don't have R class as usual) - you must create ids manually. But if you want to use them in XMLs, then you don't have to add these drawables to public.xml file.
[G1 Android Development] santiemanuel:
Sorry im so lost lol. I edited the public.xml because I got errors building the framework (drawables not declared). Im really a noob, i just do what i think i should xD, so i dont know what to do now.
[G1 Android Development] Brut.all:
What is exact and full error message?

Ahh and you have an error in your stat_sys_battery_charge.xml file: "item" tag wasn't closed in ~147 line.