yashsingh1/xdaforums huggingface dataset:
[G1 Android Development] tommytomatoe:
Probably in your home folder or where you made the path in the last part of the decompile command.

For example,

apktool d ~/Desktop/Rosie.apk ~/Desktop/Rosie-out

Now, the folder "Rosie-out" is on my desktop.
[G1 Android Development] pendo:
hm....never noticed that before. Remember any of the apks that it would do this on by chance? Only xml problem I've noticed with 1.3.1 was with LatinIME in it's /xml directory.
[G1 Android Development] Treken:
That did the trick. Thanks!
[G1 Android Development] tommytomatoe:
Off the top of my head, Rosie.apk, Htc Messages.apk, htc clock.apk, and a couple other ones. And of course the Latinime.apk, which I thank you again for the help in that.
[G1 Android Development] Treken:
I have a question. After the apk is rebuilt, is it signed so that you can install it? If not, is there a guide that explains what files to replace in the original apk?
[G1 Android Development] tommytomatoe:
You will want to insert original android manifest and meta-inf located in original apk. If it is a system/app, then you're good to go. Just adb push to system/app or make a flash. If it is a data/app, you'll want to sign it. You can use android sdk or Google for autosign.

Try these. I haven't tested them since I am on mac, but should work.

xdaforums.com/showpost.php?p=3175518&postcount=2

xdaforums.com/showthread.php?t=997180
[G1 Android Development] JGW310:
IT WORKED THANK YOU SO MUCH!!!!!!!!!!! now how would i recompile this with the changes i made so its back to an APK?
[G1 Android Development] Treken:
I tried this but when attempting to install I get the error message "Application not installed". Also, I wanted to edit something just to see if I could get the apk to install after I modded something so here's what I did:

<?xml version="1.0" encoding="UTF-8"?>

<favorites

xmlns:launcher="http://schemas.android.com/apk/res/com.android.launcher">

<appwidget launcher:className="com.google.android.apps.genie.geniewidget.miniwidget.MiniWidgetProvider" launcher:packageName="com.google.android.apps.genie.geniewidget" launcher:screen="1" launcher:x="0" launcher:y="0" launcher:spanX="4" launcher:spanY="1" />

<favorite launcher:className="com.google.android.maps.MapsActivity" launcher:packageName="com.google.android.apps.maps" launcher:screen="2" launcher:x="2" launcher:y="0" />

<favorite launcher:className="com.google.android.gm.ConversationListActivityGmail" launcher:packageName="com.google.android.gm" launcher:screen="2" launcher:x="0" launcher:y="1" />

<favorite launcher:className="com.android.contacts.DialtactsActivity" launcher:packageName="com.android.contacts" launcher:screen="2" launcher:x="0" launcher:y="2" />

<favorite launcher:className="com.coremobility.app.vnotes.CM_VnoteInbox" launcher:packageName="com.coremobility.app.vnotes" launcher:screen="2" launcher:x="1" launcher:y="3" />

<favorite launcher:className="com.android.vending.AssetBrowserActivity" launcher:packageName="com.android.vending" launcher:screen="2" launcher:x="2" launcher:y="3" />

<favorite launcher:className="com.android.deskclock.AlarmClock" launcher:packageName="com.android.deskclock" launcher:screen="2" launcher:x="3" launcher:y="2" />

<favorite launcher:className="com.google.android.talk.AccountActivity" launcher:packageName="com.google.android.talk" launcher:screen="2" launcher:x="1" launcher:y="0" />

<favorite launcher:className="com.evervolv.EVParts.SpareParts" launcher:packageName="com.evervolv.EVParts" launcher:screen="2" launcher:x="3" launcher:y="1" />

<appwidget launcher:className="com.android.music.MediaAppWidgetProvider" launcher:packageName="com.android.music" launcher:screen="3" launcher:x="0" launcher:y="0" launcher:spanX="4" launcher:spanY="1" />

<appwidget launcher:className="com.android.vending.MarketWidgetProvider" launcher:packageName="com.android.vending" launcher:screen="3" launcher:x="1" launcher:y="1" launcher:spanX="4" launcher:spanY="4" />

</favorites>

what I modded was the vending/Market widget. I changed spn x & y from 2>4. This would make the widget fill 4 spaces up and 4 spaces across. But as I suspected, the app will not install. Can anyone please tell me how to get the app to install after modifyimg it? It's Launcher2
[G1 Android Development] tommytomatoe:
Hey trek. You don't install system/app type apps. You need to put it in system/app.

adb remount

adb shell stop

adb push pathtoyour/app.apk system/app/

adb shell start

That is what you need to do.
[G1 Android Development] tommytomatoe:
I laid out all the instructions in a few posts prior when you said it worked! Hehe.

apktool b pathto/app-out

Ie, if my working folder was Rosie-out

apktool b Users/Tommytomatoe/Rosie-out

Inside that out folder should be a build folder and a dist folder. Read the last few posts to see what's next. You and treken seem to be on the same page. The instructions Pendo and I have him will work for you. You might need to sign your apk first. I posted a couple of links a few posts ago.
[G1 Android Development] JGW310:
made the edits, but when i try and install the APK on my phone, it says APK NOT INSTALLED!!!!!!!! WHAT DID I DO WRONG????

nevermind, got it, i had to sign it, i found an awesome little app that does it for me :)

but, the edits that i did didnt seem to do anything :'(
[G1 Android Development] Treken:
Can't get adb working. Followed this:

http://xdaforums.com/showthread.php?t=991293
[G1 Android Development] tommytomatoe:
As far as the edits go, what you doing to it?

Quick question, have you tried to build Hello World?
[G1 Android Development] tommytomatoe:
What machine are you working on? Android sdk is crucial man.
[G1 Android Development] pendo:
You can absolutely resize the widgets in Vending....I've done so in my transparent markets.

You just need to make sure that core is stopped when you do that. Tommy's command is a good one (where'd you pick that up from anyway TT? :p) Or another way is to reboot into recovery, mount system and then push.

@JGW310, same thing...try pushing instead of trying to install.
[G1 Android Development] tommytomatoe:
Hehe. It's a trick I picked up browsing the android dev website. Or did I get from you Pendo? :p It saves time on reboot and mounting for sure.

I actually have a shell script that automates all those lines for me. I have a working folder with my testing apk. Run the sh as an executable file and it adb remounts, stops, pushes the apk, and starts the phone back up. Done in two seconds.

Lazy.
[G1 Android Development] Treken:
Where do you get the nice little tool that signs apks?
[G1 Android Development] Treken:
Can you post the script for us?
[G1 Android Development] tommytomatoe:
For the mac, use this.

addictivetips.com/mac-os/auto-sign-tool-for-android-developers-on-mac/
[G1 Android Development] Treken:
I've been mac free for quite some time. Linux versions?
[G1 Android Development] balqi:
Can somebody help me... I play around with this stuff..Succeed to decompile, but when i recompile, i got this error messages:

Firmansyah-s-MacBook:~ firmansyah$ apktool d /Users/firmansyah/Documents/Android/APPS/ww146pixelspore.apk /Users/firmansyah/Desktop/pix-out
I: Baksmaling...
I: Loading resource table...
I: Decoding resources...
I: Loading resource table from file: /Users/firmansyah/apktool/framework/1.apk
I: Copying assets and libs...
Firmansyah-s-MacBook:~ firmansyah$ apktool b /Users/firmansyah/Desktop/pix-out
I: Checking whether sources has changed...
I: Smaling...
I: Checking whether resources has changed...
I: Building resources...
/Users/firmansyah/Desktop/pix-out/res/values/strings.xml:257: error: Multiple substitutions specified in non-positional format; did you mean to add the formatted="false" attribute?
/Users/firmansyah/Desktop/pix-out/res/values/strings.xml:257: error: Unexpected end tag string
/Users/firmansyah/Desktop/pix-out/res/values-ru/strings.xml:257: error: Multiple substitutions specified in non-positional format; did you mean to add the formatted="false" attribute?
/Users/firmansyah/Desktop/pix-out/res/values-ru/strings.xml:257: error: Unexpected end tag string
/Users/firmansyah/Desktop/pix-out/res/values/public.xml:458: error: Public symbol string/device_info_fmt declared here is not defined.
/Users/firmansyah/Desktop/pix-out/res/values/public.xml:516: error: Public entry identifier 0x7f080138 entry index is larger than available symbols (index 312, total symbols 312).
/Users/firmansyah/Desktop/pix-out/res/values/public.xml:516: error: Public symbol string/settings_widget_clock_font_description declared here is not defined.
Exception in thread "main" brut.androlib.AndrolibException: brut.common.BrutException: could not exec command: [aapt, p, -F, /var/folders/hO/hO4UawNcH3iFr6RNwDKGxU+++TI/-Tmp-/APKTOOL8531142178661210720.tmp, -I, /Users/firmansyah/apktool/framework/1.apk, -S, /Users/firmansyah/Desktop/pix-out/res, -M, /Users/firmansyah/Desktop/pix-out/AndroidManifest.xml]
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, /var/folders/hO/hO4UawNcH3iFr6RNwDKGxU+++TI/-Tmp-/APKTOOL8531142178661210720.tmp, -I, /Users/firmansyah/apktool/framework/1.apk, -S, /Users/firmansyah/Desktop/pix-out/res, -M, /Users/firmansyah/Desktop/pix-out/AndroidManifest.xml]
at brut.util.OS.exec(Unknown Source)
... 7 more
Firmansyah-s-MacBook:~ firmansyah$

I do not changes anything with the source, just decompile then recompile...

Help really appreciate :confused:
[G1 Android Development] tommytomatoe:
How about this one.

xdaforums.com/showthread.php?t=683241
[G1 Android Development] Brut.all:
Fixed in sources. You could build apktool from them or wait for apktool v1.4.0 - will be today.
[G1 Android Development] pendo:
w00t!!
[G1 Android Development] pendo:
I had a nice message typed up earlier and I guess I must've not hit submit :rolleyes:

Anyway, I wanted to say first yes I have been known to share the "adb shell stop/start" shortcut, but I learned about it here first. If you go back about a year ago I think, there was a nice little exchange over several posts between Brut.all and Daneshm90.

@Treken

Speaking of Daneshm90, he has apkmanager which is available for linux.
[G1 Android Development] JGW310:
I just googled apk sign Mac and found an awesome app that all you have to do is drag the rebuilt apk that you made with apktool to it and it will sign it for you. I'm sorry I'm on a school trip til Thursday, ugh 20 hour bus ride :(
[G1 Android Development] JGW310:
What's new in this version? And how will we update?
[G1 Android Development] Brut.all:
Apktool v1.4.0 is here!

Major changes:

added Honeycomb support (3.1, API 12). See migration instructions below.

support for mipmaps and xlarge resource qualifier

updated builtin framework to 3.1 (API 12)

completely rewritten mechanism of enclosing/escaping strings in XML files:

fixed legendary Issue 100

fixed a lot of other bugs discovered when writting integration tests

string format is simpler and more compact now: '" "' instead of '\u0020 ', '\"' instead of '\"', etc.

fixed incompatibilities between newer aapt and apks built by older one. New aapt is more restrictive, some apps can't be built using it, even if you would have sources. Apktool tries to convert/fix these incompatibilities: it adds formatted="false" for `<string />` tags and enumerates substitutions for plurals.

updated smali to v1.2.6

added automatic integration tests for resource decoding and building

first official release of apktool built using Maven from open source

Download | Full changelog | Migration instructions
[G1 Android Development] Brut.all:
1.4.0 has broken builtin framework - install your own framework or wait for a quick fix.
[G1 Android Development] Brut.all:
Ok, v1.4.1 with quick fix was just released.
[G1 Android Development] balqi:
Quick testing just like the previous one. and Yess.. now it works!!! :)

Thank you thank you for your effort presenting this great tool. I really really appreciate..
[G1 Android Development] Hatman41:
Error Decompiling

I am a novice themer. Just downloaded the new version. Tried to decompile vending.apk from Honeycomb 3.0.1 and get the following errors. Also what command do I use to decompile .9.pngs?

D:\android-sdk-windows\tools\apktool>apktool d Vending.apk ./outvending

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: Decoding values*/* XMLs...

Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String ind

ex out of range: 3

at java.lang.String.charAt(String.java:686)

at brut.androlib.res.xml.ResXmlEncoders.findNonPositionalSubstitutions(R

esXmlEncoders.java:165)

at brut.androlib.res.xml.ResXmlEncoders.hasMultipleNonPositionalSubstitu

tions(ResXmlEncoders.java:138)

at brut.androlib.res.data.value.ResStringValue.serializeExtraXmlAttrs(Re

sStringValue.java:63)

at brut.androlib.res.data.value.ResScalarValue.serializeToResValuesXml(R

esScalarValue.java:65)

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] Treken:
same here:

treken@linuxmint ~/apktool $ apktool if framework-res.apk
I: Framework installed to: /home/treken/apktool/framework/1.apk
treken@linuxmint ~/apktool $ apktool d Launcher2.apk
I: Baksmaling...
I: Loading resource table...
I: Loaded.
I: Loading resource table from file: /home/treken/apktool/framework/1.apk
I: Loaded.
I: Decoding file-resources...
I: Decoding values*/* XMLs...
I: Done.
I: Copying assets and libs...
treken@linuxmint ~/apktool $ apktool b Launcher2 Launcher
I: Checking whether sources has changed...
I: Smaling...
I: Checking whether resources has changed...
I: Building resources...
Exception in thread "main" brut.androlib.AndrolibException: brut.common.BrutException: could not exec command: [aapt, p, -F, /tmp/APKTOOL1748468575704106188.tmp, -I, /home/treken/apktool/framework/1.apk, -S, /home/treken/apktool/Launcher2/res, -M, /home/treken/apktool/Launcher2/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:174)
at brut.apktool.Main.main(Main.java:59)
Caused by: brut.common.BrutException: could not exec command: [aapt, p, -F, /tmp/APKTOOL1748468575704106188.tmp, -I, /home/treken/apktool/framework/1.apk, -S, /home/treken/apktool/Launcher2/res, -M, /home/treken/apktool/Launcher2/AndroidManifest.xml]
at brut.util.OS.exec(OS.java:87)
at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.java:191)
... 6 more
Caused by: java.io.IOException: Cannot run program "aapt": java.io.IOException: error=13, Permission denied
at java.lang.ProcessBuilder.start(ProcessBuilder.java:460)
at java.lang.Runtime.exec(Runtime.java:593)
at java.lang.Runtime.exec(Runtime.java:466)
at brut.util.OS.exec(OS.java:78)
... 7 more
Caused by: java.io.IOException: java.io.IOException: error=13, Permission denied
at java.lang.UNIXProcess.<init>(UNIXProcess.java:148)
at java.lang.ProcessImpl.start(ProcessImpl.java:65)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:453)
... 10 more
treken@linuxmint ~/apktool $

why is it doing this?
[G1 Android Development] tommytomatoe:
Treken, your issue is different and should be easily solved. You need aapt in your path. That is found the way pendo and I mentioned last night. Make sure you get it from api 8, if your app is a froyo app.
[G1 Android Development] Brut.all:
Could you upload this apk somewhere (preferably multiupload.com)?

All 9.pngs contained in apk file should be decoded automatically.
[G1 Android Development] pendo:
Actually TT, I just noticed that Brut.all has aapt packaged with his helper script. (It wasn't always packaged with it was it?)
[G1 Android Development] pendo:
Lol...:)

What are the disadvantages/disadvantages of just sticking with apktool from sdk 8?

And thank you by the way sir, for your amazing work here. To me, your work and JF's work are some of the most important tools we have at our disposal. :)
[G1 Android Development] Brut.all:
It was. Otherwise people would have to download SDK and extract aapt from it.

You mean sticking with aapt, not apktool, don't you?

Disadvantage: lack of xlarge and xhdpi support - older aapt won't build applications with these resources. Same for mipmaps.

Advantage: any? If everyone would use older aapt then I would not have to implement these hacks in apktool. But I have to and apktool converts all decoded apks anyway - no matter whether you have old or new aapt.
[G1 Android Development] Hatman41:
Here is the vending.apk http://www.megaupload.com/?d=C8LV4MKS also when I decoded Gmail.apk it did not decompile the .9.png's they all still had the .9.png ext. Here is the Gmail.apk http://www.mediafire.com/?ao201y1s3d0wwui and I used D:\android-sdk-windows\tools\apktool>apktool d Gmail.apk /outgmail to decompile it and it decompiled without errors.
[G1 Android Development] Brut.all:
It's perfectly ok. 9.png isn't ext of "encoded png", but it's specific kind of png file. Both encoded and decoded 9patch pngs use 9.png extension.

Thanks for upload.
[G1 Android Development] Hatman41:
Ok cool. So once I make my changes to the png then when I recompile it will compile the .9. Png also correct?
[G1 Android Development] Treken:
Pendo, this application runs fine on ginger bread (cm7), so it should rebuild the apk, right? Also, I didn't change a thing. Just wanted to decompiled and recompile three launcher 2 app to make sure my script installed apk and set permissions.
[G1 Android Development] Treken:
I went ahead and replaced the aapt with the one from my sdk/platform tools folder and it re-compiled. Strange that the new 1.4.1 aapt didn't work. Now I'll have to upload the file and add it to wget command so the script will work, or rather apktool work on similar apk files. :-(
[G1 Android Development] tommytomatoe:
I second these sentiments.
[G1 Android Development] pendo:
@Brut.all,

Sorry, I guess I don't remember it being packaged with it. The reason I asked about using the older aapt was because of what you mentioned about some apk's can't be built even if we have sources. For now, I'm personally not working on anything that has xlarge or xhdpi, so that wouldn't affect me now but I'm sure I will be sooner than I think.

I'm still trying out 1.4.1 ans so far so good I think. I had one hiccup, but that was caused by the apk being decoded with 1.3.1 then switched to 1.4.1 and had some string errors. I switched back to complete the build, and have subsequently retested but using 1.4.1 from start to finish and it seems ok. It faster, too :)

@Treken,

I had an issue like that as well. I don't think it's advisable to switch aapt or apktool inbetween the decompile and build stage. You might do as I did and start from the beginning with the new aapt/apktool then build it out. See if that changes anything.
[G1 Android Development] Treken:
I tried the de compile and build process with new aapt but got the error that I posted a few posts back. That's when I changed out the aapt with the one from my sdk directory. I wasn't to be able to use this new aapt but can't understand why it doesn't work for me. The old aapt works though. I just need to figure out how to sign the apk for testing purposes. I'm going to try and edit the apk and see if it will build without errors during the build process. I'll post results. Also, isn't there a way to stick a signing script in with the apktool files so I can sign the apk? The signature always gets broke when the apk is built. Bight be something to think about adding with your awesome tool!
[G1 Android Development] tommytomatoe:
You don't need to sign launcher2.apk.

Just push it system/app.
[G1 Android Development] Treken:
Can't seem to get adb working
[G1 Android Development] tommytomatoe:
You use Linux right?

Try this.

talkandroid.com/android-sdk-install-guide/
[G1 Android Development] Treken:
Ya, mint linux
[G1 Android Development] Hatman41:
Recompile Issue

So I decompiled Gmail.apk for HoneyComb 3.0.1 and spent about 2 hours theming .9.png files. I then go to recomplie and get the following errors.

D:\android-sdk-windows\tools\apktool>apktool b ./outgmail

I: Checking whether sources has changed...

I: Checking whether resources has changed...

I: Building resources...

invalid resource directory name: D:\android-sdk-windows\tools\apktool\.\outgmail

\res/drawable-xlarge-hdpi

invalid resource directory name: D:\android-sdk-windows\tools\apktool\.\outgmail

\res/drawable-xlarge-mdpi

invalid resource directory name: D:\android-sdk-windows\tools\apktool\.\outgmail

\res/layout-xlarge

invalid resource directory name: D:\android-sdk-windows\tools\apktool\.\outgmail

\res/menu-xlarge

invalid resource directory name: D:\android-sdk-windows\tools\apktool\.\outgmail

\res/mipmap-hdpi

invalid resource directory name: D:\android-sdk-windows\tools\apktool\.\outgmail

\res/mipmap-mdpi

invalid resource directory name: D:\android-sdk-windows\tools\apktool\.\outgmail

\res/raw-xlarge-mdpi

invalid resource directory name: D:\android-sdk-windows\tools\apktool\.\outgmail

\res/values-xlarge

invalid resource directory name: D:\android-sdk-windows\tools\apktool\.\outgmail

\res/values-xlarge-land

invalid resource directory name: D:\android-sdk-windows\tools\apktool\.\outgmail

\res/values-xlarge-mdpi

invalid resource directory name: D:\android-sdk-windows\tools\apktool\.\outgmail

\res/values-xlarge-port

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

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

\APKTOOL2872049904028999130.tmp, -I, C:\Users\Jeffrey\apktool\framework\1.apk, -

S, D:\android-sdk-windows\tools\apktool\.\outgmail\res, -M, D:\android-sdk-windo

ws\tools\apktool\.\outgmail\AndroidManifest.xml]

at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.jav

a: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:174)

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

Caused by: brut.common.BrutException: could not exec command: [aapt, p, -F, C:\U

sers\Jeffrey\AppData\Local\Temp\APKTOOL2872049904028999130.tmp, -I, C:\Users\Jef

frey\apktool\framework\1.apk, -S, D:\android-sdk-windows\tools\apktool\.\outgmai

l\res, -M, D:\android-sdk-windows\tools\apktool\.\outgmail\AndroidManifest.xml]

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

at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.jav

a:191)

... 6 more