yashsingh1/xdaforums huggingface dataset:
[G1 Android Development] canadiancow:
I can't seem to get it to work.

scott@ubuntu:~/modmaps$ apktool d ~/Downloads/maps4.0.0-brut6.apk ~/modmaps/
Exception in thread "main" brut.androlib.AndrolibException: brut.androlib.AndrolibException: brut.common.BrutException: could not exec command: [baksmali, -l, -s, /home/scott/Downloads/maps4.0.0-brut6.apk, -o, /home/scott/modmaps/smali]
at brut.androlib.Androlib.decode(Androlib.java:47)
at brut.androlib.Androlib.decode(Androlib.java:37)
at brut.apktool.Main.main(Main.java:40)
Caused by: brut.androlib.AndrolibException: brut.common.BrutException: could not exec command: [baksmali, -l, -s, /home/scott/Downloads/maps4.0.0-brut6.apk, -o, /home/scott/modmaps/smali]
at brut.androlib.AndrolibSmali.baksmali(AndrolibSmali.java:37)
at brut.androlib.AndrolibSmali.baksmali(AndrolibSmali.java:30)
at brut.androlib.ApkFile.decode(ApkFile.java:66)
at brut.androlib.Androlib.decode(Androlib.java:45)
... 2 more
Caused by: brut.common.BrutException: could not exec command: [baksmali, -l, -s, /home/scott/Downloads/maps4.0.0-brut6.apk, -o, /home/scott/modmaps/smali]
at brut.util.OS.exec(OS.java:52)
at brut.androlib.AndrolibSmali.baksmali(AndrolibSmali.java:35)
... 5 more
[G1 Android Development] Brut.all:
As you can see, there was an error in "baksmali -l -s /home/scott/Downloads/maps4.0.0-brut6.apk -o /home/scott/modmaps/smali" command - you could run it manually and check, what was the error. CLI executing eats errors :-/

You may have too old baksmali version. "-l" parameter was introduced in 1.1 version, I have added this requirement on a project page.

Current version has smali/baksmali builtin and is much debug prone :-)
[G1 Android Development] AnderWeb:
I have problems rebuilding, think is aapt related but dont know why...

$ apktool d htc_ime.apk out
$ cd out/
$ apktool b
Exception in thread "main" brut.androlib.AndrolibException: brut.androlib.AndrolibException: Could not build apk for dir: /home/adw/android_devel/apkTool/out/.
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/adw/android_devel/apkTool/out/.
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/adw/android_devel/apkTool/out/build/tmp.apk, -I, /home/adw/android_devel/android-sdk-linux_86/platforms/android-2.1/android.jar, -M, /home/adw/android_devel/apkTool/out/./AndroidManifest.xml, -S, /home/adw/android_devel/apkTool/out/./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/adw/android_devel/apkTool/out/build/tmp.apk, -I, /home/adw/android_devel/android-sdk-linux_86/platforms/android-2.1/android.jar, -M, /home/adw/android_devel/apkTool/out/./AndroidManifest.xml, -S, /home/adw/android_devel/apkTool/out/./res]
at brut.util.OS.exec(OS.java:52)
at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.java:129)
... 5 more

Any hints?
[G1 Android Development] Brut.all:
Run aapt command manually and check error messages:

aapt p -F /home/adw/android_devel/apkTool/out/build/tmp.apk -I /home/adw/android_devel/android-sdk-linux_86/platforms/android-2.1/android.jar -M /home/adw/android_devel/apkTool/out/./AndroidManifest.xml -S /home/adw/android_devel/apkTool/out/./res
[G1 Android Development] Brut.all:
@AnderWeb

Uppss... regression...

There will be a 0.9.2 with this and some other fixes - maybe today.
[G1 Android Development] AnderWeb:
Great news ;) take your time dude.
[G1 Android Development] BolecDST:
I hope you're thinking about windows version ;p
[G1 Android Development] canadiancow:
Okay that's fixed. Now I have:

scott@ubuntu:~/modmaps$ apktool d ~/Downloads/maps4.0.0-brut6.apk ~/modmaps/
shell-init: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
pwd: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
chdir: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory

Edit: I ran it from my home directory instead and it worked.
[G1 Android Development] Brut.all:
Are you sure you didn't run it from a directory, which you had deleted from other terminal? :-) Or something like that.
[G1 Android Development] BolecDST:
OK, I was so desperated to try this thing, that I downloaded virtualbox and xubuntu image. I managed to get this thing running under my windows seven. And I managed to login to this xubuntu. I even managed to get it from my windows partitions along with advanced task manager apk which I want to localise to polish. But.. can anyone please tell me how to run this thing under xubuntu? Sorry, I'm complete linux noob. I downloaded apktool and extracted this linux archive. What next? Double clicking on the files doesn't work ;p
[G1 Android Development] Brut.all:
Do you see apktool project site in a Google search? Yesterday it was first in results for "apktool" query, but today it just disappeared :-/ Still it could be found using "apktool site:google.com" though.

I don't have as many visits to trigger some anti-spamming/farming mechanisms. Do you think it is possible, that Google has banned me for Google Maps editing?
[G1 Android Development] AnderWeb:
Lol, would be funny, but i've just made a search and still shows up at first place :)
[G1 Android Development] BolecDST:
I managed (with help, thanks dude :) ) to get through the process of setting it up under virtualbox and xubuntu image, but there's still something wrong.

When I run the terminal baksmali and smali give me usage tips, so it's OK. But apktool and aapt give me following results.

xubuntu@ubuntu:~$ apktool

Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0

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

xubuntu@ubuntu:~$ aapt

No command 'aapt' found, did you mean:

Command 'apt' from package 'openjdk-6-jdk' (main)

Command 'apt' from package 'sun-java6-jdk' (multiverse)

Command 'aap' from package 'aap' (universe)

What does it mean? There is aapt file in my sdk/tools/ folder and "echo $ANDROID_SDK_HOME" gives me right path (my sdk path), so everything should be working, but it doesn't...

Any help would be greatly appreciated.
[G1 Android Development] Brut.all:
I have responded to BolecDST privately.
[G1 Android Development] AnderWeb:
You should have responded for !ll of us! i solved it copying the aapt binary to my tools dir (to avoid adding more things to $PATH but maybe isn't the best practice?

Bte, is there any help out there to aapt for packaging/repackaging apks besides the self contained one?
[G1 Android Development] Brut.all:
I have talked with him from the beginning, cause he is Polish and it is much easier for me to communicate in my native ;-)

Beside: it is just "linux using" thing, not "apktool installing", so there are plenty of helps in internet already.

Beside2: there will be soon a new version with smali, baksmali and framework resources builtin, so installation will be much easier :-)

I didn't see any, but command line help is just enough for me - it is rather simple to use tool. There is only one undocumented thing - in most cases you must specify "-I <android.jar_from_sdk>" to package something.

And you can't repackage apktool's decoded apk using aapt manually - if you were thinking about it.
[G1 Android Development] AnderWeb:
No, it wasn't the point. I only was curious of method to unpack and repack an .apk.

I've started making annoyances ( :) ) to android sources (well, cyanogen's ones) and when i make a package (with make -j3 from source tree), the resulting .apk is usually "bigger" (maybe less compressed) than the one inside Cyanogen's rom... But if i extract .apks, files are almost identical in size...

So i suppose it being caused for the way "make" compress the package by default... and wonder if i could repackage it (without 7zip/RAR/etc) and make it smaller.

Sorry for the Off-topic in here :)
[G1 Android Development] worm-:
here is my error log, can someone help me

http://pastebin.org/454459
[G1 Android Development] Daneshm90:
What apk ur trying to edit might help :rolleyes:

Seems like its not finding the resources, are u decompiling a themed apk ? more precisely themed .9.png's ? are u decompiling a proprietary apk that has dependencies such as Rosie.apk ?
[G1 Android Development] jwilcoxiii:
framework-res.apk

I need help with the framework-res.apk. If I make my changes and then I recompile how can I get it back on phone without FC's. Is there a way without having to use update.zip? If so please explain. If this was already covered I appologize I must have missed it.
[G1 Android Development] Daneshm90:
You need to take the original meta-inf folder from the apk and insert in ur recompiled one. Also if u modified androidmanifest.xml then u need to insert the apk when core is not running, as in when in recovery or doing :

adb shell stop

push apk

adb shell start
[G1 Android Development] pendo:
pardon if this has been covered (a brief search in this thread and I didn't specifically see it)

Will apktool work on a framework-res.apk if I want to ADD png's? What I'm interested in doing is adding more stat_sys_battery.png's to the to have more than just the 10,20,40,60, and 80 options. So the problem is determining the id of the added png's so I can properly reference them in the xml.

Thanks
[G1 Android Development] Daneshm90:
Ok i think i can relate since i worked on that custom lwp script in which i had to add more images.

I had to modify :

- public.xml

- R$drawable

- And the smali that made use of the drawables (as in make it call the other png's as well)

Hope that helps, and yes its definitely possible ;)
[G1 Android Development] pendo:
Thanks Daneshm90,

I haven't gotten that far yet. Where I'm stuck is when I use apktool, my stat_sys_battery.xml looks like this:

but when I use AXMLPrinter2 on the raw file that I get out of 7zip it looks like this:

I know that apktool's formatting is different, but doesn't it have to reference the same way?

Plus since I'm not just swapping out png's I think there's a signing problem, too.
[G1 Android Development] skoperst:
Size difference, strange androidmanifest , and .apk is not accepted

Hi, I'm new into the re-engineering stuff so take it easy on me.

I tried to edit the Settings.apk from a Dell streak device, but before that I made a test for the apktool.

I decoded the apk, and packed back without any change and I used only the apktool command and all the commands finished successfully.

Then I pushed it back. The device crashed, after a while I fixed the problem by signing Settings.apk and all /system/app/*.apk , /system/framework/*.jar with the same signature and the device came back to life but the Settings didnt work it crashed with ActivityNotFoundException.(while signing all the above files with the original Settings.apk works great).

I noticed 2 things,

1. The size of the rebuilt .apk is much smaller (600k) instead of 1.1M! while the main cause is the compression, the apktool decided to throw away few kbytes on the way too.

2. The AndroidManifest.xml is not readable, It has some sort of encoding/encryption and this is very strange.

I attached the .apk

Need help.

Thanks.
[G1 Android Development] Brut.all:
I should add this to apktool wiki:

http://xdaforums.com/showthread.php?p=7380557#post7380557

AXMLPrinter2 is quite simple tool, it can't decode XML fully. @android:010802C1 is binary form of @drawable/stat_sys_battery_0, AXMLPrinter2 doesn't decode references.

Most frequent cases are:

compression

lack of META-INF dir

PNG optimizations - apktool uses newer aapt tool

Uncompress original and resulting file, remove META-INF from first one and then compare sizes.

AndroidManifest.xml from attached file is perfectly ok:

$ aapt d badging Settings.apk
package: name='com.android.settings' versionCode='4' versionName='1.6'
sdkVersion:'4'
targetSdkVersion:'4'
uses-permission:'com.google.android.providers.gmail.permission.WRITE_GMAIL'
uses-permission:'com.google.android.providers.gmail.permission.READ_GMAIL'
uses-permission:'android.permission.WRITE_SETTINGS'
uses-permission:'android.permission.WRITE_SECURE_SETTINGS'
uses-permission:'android.permission.CHANGE_CONFIGURATION'
...

You know that all XML files are stored in apk in compiled, binary form, right? :-)
[G1 Android Development] Nieylana:
Compiling Issue?

Hi Brut.all, first off want to say thank you for the amazing work that is apktool.

recently i was trying to modify my Phone.apk, i've modified it before so i know it works (modifying it)... but this time instead of just wanting to edit resources i want to ADD some additional code to one of the smali files (Ringer.smali) to add an option on whether or not it should vibrate on the outgoing phone call.

I've already modified the settings menu to include a checkbox for this option and it worked! but now i need to add the proper smali (dalvik) code to read the setting and return true or false depending....

after adding what seemed to me the correct smali commands i recompiled (no errors were shown to me) and reinstalled it (after resigning and all the other stuff)...and now Phone.apk keeps FCing with

is there a way to add additional code (not talking minor changes) and get it to compile correctly? I'd really like to make this vibrate on outgoing call connect an Optional thing. thanks in advance!
[G1 Android Development] Brut.all:
Of course, you must did something wrong. Search for "VFY: ................." errors in the logcat. Also you could pastebin Ringer.smali file and diff of your changes - I will look into it.
[G1 Android Development] Nieylana:
will do mate here in a few minutes gotta reflash, for some reason the stock Phone.apk is crashing now too haha... anywho when i get it back to where i can show the difference i will, thanks again.
[G1 Android Development] pendo:
Thank you, sir. I'm still learning and much of this is Greek to me, but I think I understand.

Thanks again! Love your work..
[G1 Android Development] Nieylana:
Smali Problems

Delete please
[G1 Android Development] jwilcoxiii:
I am going to try this now. Also I am assuming I need to sign the apk before pushing it. Just wanted to check to make sure...By doing this I should not need an update.zip correct.
[G1 Android Development] Nieylana:
that is correct. and yes you should sign the apk first...
[G1 Android Development] Daneshm90:
Nope donot sign the framework-res.apk. The instructions i gave u for copying over meta-inf already takes care of that.

FYI : incase u didn't know, the meta-inf contains the signatures/digests for all of the contents within the apk.
[G1 Android Development] Nieylana:
was not aware that he was working with a framework... my bad...
[G1 Android Development] pendo:
Ok, next dumb question...bear with me....

I'm assuming this is normal since I didn't get any errors, but apktool left xml reference in binary for public.xml but not for others?

Also....got any neat tricks on how to go about adding 90 or so png's to drawable-hdpi? It looks like it'd be alot easier if the stat_sys_battery id wasn't in the middle of public.xml :-/

Thanks again
[G1 Android Development] Brut.all:
It's ok, public.xml is a "special" file.

Just copy them to proper directory and add to stat_sys_battery.xml - voila.

http://xdaforums.com/show...57#post7380557
[G1 Android Development] Nieylana:
Brut.all,

I got the problem fixed, it was a misplaced move-result-object haha! thanks for the tip about looking for VFY errors...

Once i got it accepting the actual code i had problems reading the setting from the shared preferences. after hours of stress and a half nights sleep i noticed the setting was called pref_key_vibrate_out, and i was trying to load pref_vibrate_out haha, again another stupid mistake.

anyways, thanks again for your help, apktool is amazing!

NOTE: it seems that in Netbeans 6.9.1 you can't set BPs on commented code, i recommend those who have it to downgrade to 6.8 :D
[G1 Android Development] alex-khokhlov:
Just push Ctrl-Shift-F8 on the line you want your breakpoint set and select "Line" as a type of breakpoint.
[G1 Android Development] Brut.all:
Thanks, man! :-)
[G1 Android Development] pendo:
OK, I've tried this a few times so I could make sure I was getting repeatable results. I've added several png's to drawable-hdpi. They are accompanied by the proper xml referencing them. Apktool seems to be building the resources.asrc file ok...I ran aapt and the id's seem ok. I was worried that some id's that are shared would've gotten bumped down since I added so many png's, but in a brief look through they are still jiving.

But I get boot loops no matter what. What next?
[G1 Android Development] staunty:
Still having libSystem.B.dylib problem on Mac

I'm stuck with using the 10.4.11 OS on my Mac. Because of that, I can't use any SDK higher than the 1.6. I get a "bus error" when using adb. I was able to use a port of java 1.6 though so I can decompile files but when I try to build them, I get the libSystem.B.dylib error. Brut.all mentioned using a different version of aapt, which I've tried, with no success...Anybody else have a similar problem that they fixed?
[G1 Android Development] Brut.all:
Singatures problem? Did you tried to not change anything at all, but just rebuild apk file and install it?
[G1 Android Development] pendo:
Um...wow. Damn I must be more tired than I thought, lol. Using the original META-INF (think that's what was said here), right?

D'oh!!

EDIT:

And just for review...what are the 'approved' methods of putting framework-res back in? Last week, I was having problems with space issuses and the only way I could get it to go was to adb shell and rm, then back out and adb push. (clockworkmod recovery, mount/system)

EDIT2:

Ok, it must be a signing problem. Here's my steps: adb pull /system/framework/framework-res.apk ; apktool d framework-res.apk out; apktool b out. I then go unzip the original apk and copy the META-INF and bring it over to the new file, open it up and add it. Then push in recovery, and reboot....boot loops.
[G1 Android Development] Brut.all:
@pendo

I use and recommend update.zip method, but Daneshm90 always says there is easier way to do it :-) I didn't check it by myself, so I won't talk about it.
[G1 Android Development] Daneshm90:
Not easier just different ;)

If u didnt touch the manifest.xml then a simple push and reboot will do the trick. if u touched the manifest then either

adb shell stop

adb push

adb shell start

or push when in recovery.

Fyi : when i say didnt touch manifest.xml i mean if u copy over that file from original apk.

Hope that helps.
[G1 Android Development] pendo:
OK...I thought I was doing it right, but the way today's been going...well..

For what ever reason, framework-res is still causing a boot-loop. I'm just pulling it from the phone (fully running), run apktool d, apktool b, slide in a copy of the META-INF, and push back (haven't tried a zip yet). I don't change a single thing.

For some reason I thought I read somewhere that you had to change something...anything, in order for this to work. If you just decompile/recompile and don't do anything it breaks. Or maybe I dream't that, lol.

I'll try a zip right quick
[G1 Android Development] Brut.all:
You don't read carefully:

No, this doesn't make any sense :-)
[G1 Android Development] Daneshm90:
wht i do is copy over everything from the original apk i didnt modify. Try it.
[G1 Android Development] Brut.all:
Daneshm90: I just tried your method for the first time. I have unpacked Google Maps, modified one drawable, packed it back and did:

adb shell stop
adb push maps.apk /data/app/com.google.android.apps.maps-1.apk
adb start

Android had noticed this change, verified certs and banned my file. Did I do something wrong? :-)
[G1 Android Development] Daneshm90:
Really ? wht bout when in recovery ? Those commands in essence are restarting android's core.

Also can u try copying over the files from the original apk that u havent modified and retry. that has always worked for me.

Edit : when u say unpacked, do u just mean unzipped ? or with apktool?
[G1 Android Development] pendo:
Got it!...thanks, guys.

Just had to swap over the manifest.xml as well as the meta-inf. And I just adb pushed in recovery. Awesome stuff guys....I don't want to think about what it would be like to do it all manually..
[G1 Android Development] jwilcoxiii:
I must be doing something wrong when I did this it put me in a boot loop....what could I be misssing.. all I changed was text color for status_bar.xml and recompiled...put meta-inf folder in...
[G1 Android Development] jwilcoxiii:
I should have read a little more before I posted my last comment. I appologize I did not see to push the manifest.xml and try again...I will do that now and see if I can get it to work.
[G1 Android Development] jwilcoxiii:
Clear button Framework-res.apk

I tried changing the color of the clear button in status_barextended.xml and everything went good no FC's and no boot loop but the color did not change any ideas?
[G1 Android Development] pendo:
fwiw,

I've been using the shell start/stop method for testing framework-res mods, and it's been great! I can stop core, push a frame-res android doesn't like, restart coreand it will go into boot animation loop. Then I can then stop core while in boot animation loop, push original frame-res, restart core and I'm back in.

Sometimes it can look like it's going to hang up when pushing back a working frame-res, but it will eventually go.

I've used this method a lot within the last 24-36 hours...works great. And much quicker than a full reboot. Looks like it doesn't work for all situations though considering what brut.all is saying...
[G1 Android Development] ninor:
I get the below error when I try to compile LauncherPro (I added some wallpapers in C:\Launcher\res\drawable-mdpi-v4 and added values for those same wallpapers in arrays.xml in C:\Launcher\res\values-mdpi-v4.

I'm not sure why arrays.xml has error parsing XML mismatch when line 28 is </resources>

What am I doing wrong?

C:\apktools>apktool b c:\Launcher
I: Checking whether sources has changed...
I: Checking whether resources has changed...
I: Building resources...
c:\Launcher\res\values-mdpi-v4\arrays.xml:28: error: Error parsing XML: mismatch
ed tag
Exception in thread "main" brut.androlib.AndrolibException: brut.common.BrutExce
ption: could not exec command: [aapt, p, -F, C:\Users\Nino\AppData\Local\Temp\AP
KTOOL6674672587134125293.tmp, -I, C:\Users\Nino\apktool\framework\1.apk, -S, c:\
Launcher\res, -M, c:\Launcher\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, C:\U
sers\Nino\AppData\Local\Temp\APKTOOL6674672587134125293.tmp, -I, C:\Users\Nino\a
pktool\framework\1.apk, -S, c:\Launcher\res, -M, c:\Launcher\AndroidManifest.xml
]
at brut.util.OS.exec(Unknown Source)
... 7 more

C:\apktools>
[G1 Android Development] Brut.all:
1. Use some decent IDE, that will show you XML errors.

2. How could we tell you, what did you do wrong, if you didn't post your arrays.xml file?

3. It's possible "</resources>" is errorous if you didn't close some tag earlier in this file.