yashsingh1/xdaforums huggingface dataset:
[G1 Android Development] Kermode:
So, I tried this - seems there might be a few bugs:

>apktool.bat d PaintPot.apk

Unpacks it to a directory, seems to go fine, no error messages.

Then without changing anything I go

>apktool.bat b PaintPot

And there is a ton of errors, like.

....PaintPot\Screen1$frame.smali[223,11] no viable alternative at character '/'

....PaintPot\Screen1$frame.smali[494,4] [smali_file, method,statements_and_directives, ordered_debug_directive, line_directive, integral_literal] mismatched input [@1967,13433:13435='nop',<244>,494:4] expecting set null

....\PaintPot\Screen1$frame.smali[1351,4] [smali_file, method, statements_and_directives, ordered_debug_directive, line_directive, integral_literal] mismatched input [@5700,33232:33246=':sswitch_data_0',<158>,1351:4] expecting set null

Exception in thread "main" brut.androlib.AndrolibException: Could not smali file: java.io.FileInputStream@e83912

at brut.androlib.src.DexFileBuilder.addSmaliFile(Unknown Source)

at brut.androlib.src.DexFileBuilder.addSmaliFile(Unknown Source)

at brut.androlib.src.SmaliBuilder.buildFile(Unknown Source)

at brut.androlib.src.SmaliBuilder.build(Unknown Source)

at brut.androlib.src.SmaliBuilder.build(Unknown Source)

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

at brut.androlib.Androlib.buildSources(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)
[G1 Android Development] Brut.all:
@Kermode

Could you upload original apk file?
[G1 Android Development] capychimp:
i don't know if you can do it or it's been mentioned, but a function to see installed frameworks is that possible or can it be done? and uninstall one again?
[G1 Android Development] Brut.all:
ls -l ~/apktool/framework/

rm ~/apktool/framework/2.apk

Of course you could do this from Windows Explorer, Total Commander or whatever you want.
[G1 Android Development] staunty:
Can anyone attach the newest version of aapt? I can't install the 2.2 SDK because I'm using 10.4.11 on this mac and it doesn't support anything higher than 1.6. I want to see if it will work if I use the most recent aapt. I believe there is a newer aapt than the file that's in the latest release of apktool, correct?
[G1 Android Development] gauravdegenius:
Yes , the apktool-1.3.1 does not generate the .java files rather It is generating .samli files.

As per you tube video , It should generate source folder and .java files inside.

apktool dj xxx.apk xx is not supported now .
[G1 Android Development] staunty:
Nobody wants to attach the aapt from the 2.2 SDK? The aapt included in the install files is dated May 13th. I know there is a newer aapt file in the 2.2 SDK but I can't upgrade to 2.2 on this Mac. I'd like to see if using aapt from 2.2 will allow apktool to work for me.
[G1 Android Development] cauli:
This aapt, from http://android-apktool.googlecode.com/files/apktool-install-windows-2.2_r01-2.tar.bz2, with aapt v reports 0.2. In my install, C:\android-sdk\platforms\android-8\tools\aapt v reports 0.2 also. Are you saying the aapt in http://android-apktool.googlecode.com/files/apktool-install-macosx-2.2_r01-1.tar.bz2 is older than 0.2? I don't have a mac here so can't check, but given the archive names, it seems unlikely.
[G1 Android Development] staunty:
Yeah, now that I'm back home and on my PC, I can look at the previous platforms prior to version 8 as well as the aapt in version 8 itself. The aapt in version 8 seems to be the same as the one included in this file: apktool-install-windows-2.2_r01-2.tar.bz2. I don't know what the deal is. Maybe I simply can't use apktool on a mac such as mine considering I can't install an SDK higher/newer than 1.6.
[G1 Android Development] eViL D::
Any tips on how I can remove the alarm tab from HTC Clock? Or, disable the alarm tab?
[G1 Android Development] staunty:
I'd try this out myself but I can't build files after decompiling them. I'm having issues with aapt compatibility on the Mac I use during the day. However, I took a look at the files in DeskClock.apk and I think you can do what you want within the desk_clock_buttons.xml file in res-->layout. Try to take out the line in the xml for the alarm tab and rebuild with apktool. The xml should look like this:

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

<LinearLayout android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="0.0"

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

<ImageButton android:id="@id/gallery_button" android:layout_width="fill_parent" android:layout_height="wrap_content" android:src="@drawable/ic_clock_strip_gallery" android:layout_weight="0.25" android:contentDescription="@string/gallery_button_description" style="@style/ButtonStripLeft" />

<ImageButton android:id="@id/music_button" android:layout_width="fill_parent" android:layout_height="wrap_content" android:src="@drawable/ic_clock_strip_music" android:layout_weight="0.25" android:contentDescription="@string/music_button_description" style="@style/ButtonStripMiddle" />

<ImageButton android:id="@id/home_button" android:layout_width="fill_parent" android:layout_height="wrap_content" android:src="@drawable/ic_clock_strip_home" android:layout_weight="0.25" android:contentDescription="@string/home_button_description" style="@style/ButtonStripRight" />

</LinearLayout>
[G1 Android Development] reekotubbs:
@brut.all

I tried the method on the newest googlevoice apk backed up on to my sd card using astro.

When I run the second step to create the director for the apk, brut.all stops and gives this error:

I: Baksmaling...

Exception in thread "main" brut.androlib.AndrolibException: brut.androlib.Androl

ibException: File already exists: com.google.android.apps.googlevoice\smali\com\

google\android\apps\googlevoice\MasfLogStopwatch.j ava

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

at brut.androlib.ApkDecoder.decode(Unknown Source)

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

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

Caused by: brut.androlib.AndrolibException: File already exists: com.google.andr

oid.apps.googlevoice\smali\com\google\android\apps \googlevoice\MasfLogStopwatch.

java

at brut.androlib.src.SmaliDecoder.decodeClassDefItem( Unknown Source)

at brut.androlib.src.SmaliDecoder.decode(Unknown Source)

at brut.androlib.src.SmaliDecoder.decode(Unknown Source)

... 4 more

The file is in its own directory. I don't know why it says the file already exist. Unless brut.all creates this file and google wised up and put the file in the .apk already to screw up the brut.all process.

Can you look in to this.
[G1 Android Development] PPCGeek01:
Great tool, been using it quite extensively lately.

Any word on a fix for this known issue:

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

I wish there was a way to permanently, or even temporarily, disable DS_Store file creation on a Mac.:mad:
[G1 Android Development] pendo:
+1, hate that dang thing, lol

I did a quick search and maybe I just didn't put in the right terms, but why are some of the folders renamed, like drawable-hdpi to drawable-hdpi-v4? Next question is there any consequences of dropping the -v4 before/after the compiling?

Thanks again
[G1 Android Development] staunty:
Maps.apk

So, Brut.all, how can you decompile Maps? Not being case sensitive, when it sees that a G.smali has already been created, it won't allow a g.smali to be created, etc...
[G1 Android Development] canadiancow:
Use something other than Windows.
[G1 Android Development] staunty:
I was using a mac when I got that error.

Sent from my jitterbug
[G1 Android Development] canadiancow:
I didn't realize OSX uses case-insensitive filenames.

Guess you're stuck with Linux then.
[G1 Android Development] staunty:
Damn, I don't have Linux. Only a Mac and a PC. Does anyone know if there is another way to decompile maps?
[G1 Android Development] jabbawalkee:
After making edits to a decompiled apk (just edited a few xmls), I ran the command "apktool b /directory/framework-res /directory/" and get the following errors:

Anyone have any ideas what's going on here? Thanks in advance
[G1 Android Development] Asure:
I've google this all over. Settings.apk, unpacking it is OK with

java -Xmx64m -jar apktool.jar d ./System/App/Settings.apk ./out/Settings

If i rebuild this APK without any changes, it becomes much smaller, and fails to work on my platform. (~800k smaller). I made a pastebin with the actual errors on the device: http://pastebin.com/NGEHaMjb

Some things stand out:

asset ( 931): Data exceeds UNCOMPRESS_DATA_MAX (1117456 vs 1048576)

And several of these as wel:

Resources don't contain package for resource number 0x7...

Can any kind soul tell me, what i am doing wrong ? It's probably something very simple.

The only thing i'm doing is adding one XML for localisation..
[G1 Android Development] Brut.all:
@reekotubbs

You have asked this in two threads, on PM and in the apktool wiki. Don't spam, please :-)

I know, I know, must fix it finally :-)

Just added:

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

You could remove these -v4, apktool will do this automatically in the future.

This is long-known issue and it was fixed in smali just few weeks ago. I must do the same in apktool:

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

I think you're using some crappy graphics editor which created that ~WRL0003.tmp file. Just remove it.

This means resources.arsc file is too large. There is a limit on the size and if original resources.arsc was just below that limit, then you have exceeded it by adding new strings. I have exactly the same problem in GM, because in v4.4.0 resources.arsc file is nearly at the max.

Still it's weird to me that resources.arsc is so big in Settings.apk app. Could you check whether original file is really about 1MB?
[G1 Android Development] reekotubbs:
Sorry about the multiple post, didn't know which thread you were actively participating on. I'll keep all the info on this thread.

Attached is the apk.
[G1 Android Development] Brut.all:
My guess was right: it's case-sensitivity issue. There are MasfLogStopwatch and MasfLogStopWatch classes and Windows can't save both of these files to one dir. You could:

Use linux.

Wait for a fix: http://code.google.com/p/android-apktool/issues/detail?id=86

If you don't want to modify the code, just resources, then decode apk with "-s" switch. It will tell apktool to not baksmali the code.

If you want to modify smali files, then you could use newest baksmali - it includes a fix for this issue. Or, if you like apktool, you could "apktool d -s" apk file, remove classes.dex file and baksmali apk to smali subdir (so file structure will be as you would apktool a file without "-s" switch). I think this should work too.

EDIT:

@staunty

Same for you. You could try to workaround this problem using technique as above.
[G1 Android Development] reekotubbs:
Thanks I will try this and report back.

edit: tried to run baksmali, but I cannot figure out how to do it. I run apktool without -s and I get a smali directory but it is incomplete (missing files and folders).

So my question is how do I run baksmali, it is not an .exe like apktool?

edit: nvm, I believe I figured it out.
[G1 Android Development] reekotubbs:
I completed the method using apktool and baksmali. When I recompiled the smali files to create a new .apk, it would not install.

Any suggestions.
[G1 Android Development] Asure:
The original is 1117596 (also larger than 1048576), but somehow the system does not care about this in the original file. By way of test, i removed spanish/mexican XML and rebuilt it, with smaller resources & the same issue. I think there's something wierd going on with this APK. It's from a custom build on a Telechips 720Mhz tablet.

I uploaded the original APK file here if you want to take a peek at it. Like i wrote, i cannot unpack & simply repack, that's not working for me :(
[G1 Android Development] Brut.all:
Same for GM - original resources.arsc was a little bigger than 1048576, but few KB more and system didn't allow apk to run. Was resources.arsc smaller than 1048576 after langs removing ?
[G1 Android Development] Asure:
Yes it was smaller, but still the 'Resources don't contain package for resource number 0x7...' remained.

For one, i've no clue how they are getting around the max size, and why there are apparently things missing on repack :(
[G1 Android Development] Brut.all:
Things are missing because if you get max size warning then whole resources.arsc file is omitted, so you don't have any resources at all. Don't think about missing resources for now.
[G1 Android Development] reekotubbs:
@brut.all

If I use vmware to install linux, do I run the apktool.exe the same as in windows?
[G1 Android Development] Brut.all:
Yes, usage is exactly the same.
[G1 Android Development] pendo:
Cool...I actually already tried it (trial and error seems to be the way I'm learning my way around) and of course it worked just fine. I did try removing it after compiling and that did NOT work, lol.

I have been trying to make the mod available in a metamorph, but the best I've done is to get metamorph to work ON the frame-res again, if I remove the -v4.

Also, I'm pretty sure I know the answer to this, but if we have a frame-res that was heavily themed AFTER compiling, what other options do we have for decompiling that bugger, modding it, and then recompiling?

Thanks again good sir!
[G1 Android Development] Brut.all:
You can't change names of dirs and files in compiled app, because all files are referenced by path in resources.arsc file.

If nothing was broken by some amateur themer, then apk should be decodable by apktool normally. Android OS decodes all data as well, so why apktool would can't do that? :-)
[G1 Android Development] Asure:
Ok, i'm sorted :)

I modified my Settings.apk, ensuring size was good.

- Then let apktool build a new APK

- Then replace AndroidManifest.xml with the file from the original APK

- Add back the META-INF folder from the original APK

- Push files back to the system/app, enjoying new language!

Then i did the same with Launcher.apk, and this trick is working fine for me :)
[G1 Android Development] pendo:
Well, sometimes it will decompile the frame-res 'mostly' ok (may have a couple errors on a .9.png but just one or two is easy to deal with), but then on apktool b it's just a nightmare. Lot's and lot's of stuff not defined. I thought these errors were caused when a themer changes a lot of the images in a zip manager or something like that..?

But here's a (I'm sure a dumb) question...what exactly does this mean:

There is an image with that name in the frame-res. It looks like a stock image. So what does 'declare' mean and 'define'? I know what I *think* it means, but I want to check.

I have a slew of these errors. What I've been doing is to take a 'stock' frame-res, run apktool d and make my additions/edits. Then apktool b. THEN go back and copy over the 'themed' files from within 7zip. I know that sucks, but it's the only way I've gotten it to work.

Also, is there a max size that a framework-res can be?

Thanks again, you have no idea how much help you've been (well...maybe you do;) )
[G1 Android Development] Brut.all:
Apktool isn't bugfree, it doesn't support every apk. Of course hacking/editing apk manually might cause some problems by making apk... errr... less standard, so even if Android OS can open it, apktool can't. But most of the time issues aren't related to earlier theming, but to apktool itself.

It means: there is no drawable/stat_sys_signal_0 resource, but you have referenced it in public.xml . But you say this file is there, so could you upload original apk somewhere? I'll look into it.

There is a limit for resources.arsc and probably other files inside an apk file (~1MB), but I don't know about limits for whole apk.
[G1 Android Development] shoey-n:
Just used your tool to decompile framework-res.apk

when I built it it said could not find sources

And then the file is twice the size, folders renamed and missing META-INF, is this normal ?
[G1 Android Development] pendo:
I know this thread is pretty big, so searching can be a little bothersom (it is for me anyway), but these questions have been covered several times---even recently.

Frame-res doesn't contain any code for sources, so you will ALWAYS see that when using apktool b on a frame-res.

The missing meta-inf...once again you need to copy it over from the original frame-res.apk. It has proprietary google signatures or something that we can't duplicate. From what I've read, if android sees the correct date in the meta-inf it doesn't verify any further....that's why that trick works. Also if you've made changes in the manifest, you'll need to copy that over from the original as well.

As for the size...what all did you put in it? Brut.all has stated several times that his tool uses a more advanced compression format that stock....but this usually results in a smaller file unless you're adding a lot of stuff.
[G1 Android Development] shoey-n:
Sorry, I tried search but I couldn't find it

Thanks for the information

But I only decompiled and then built it without any changes and the file size was twice as big :confused:
[G1 Android Development] pendo:
No problem..happens to us all from time to time. Plus with me, I'm usually only over in this thread when I have a problem, so it's real tempting to just make a post without reading a little (or at least that's how I am :p)

I'm hardly qualified to be trying to help anyone in this thread, and I really don't know the answer to this question. Sorry if I seemed snippy in my earlier reply...I just knew the answers to your first problem, as they've been covered in recent history. Hopefully someone with a little more experience can offer advice.
[G1 Android Development] Brut.all:
I've just added your questions to FAQ:

http://code.google.com/p/android-apktool/wiki/FAQ

Everything you have asked is normal.
[G1 Android Development] reekotubbs:
@brut.all

Is there a fix for the 86 error.

I tried it on linux and I get the same error when trying to build the .apk.

the compiler gives that certain characters have no match. It seems as if the renaming messes up the source code.
[G1 Android Development] kevdog:
Just a quick followup --- so are you planning on compressing the resources.asrc file in the future? The bug reporting page wasn't exactly clear about this proposed feature.
[G1 Android Development] Brut.all:
Did you decoded it on linux or just build version, that was already decoded on Windows? This is really weird, cause you shouldn't have errors in smali code.

Could you upload both your original apk (I think you did so earlier, but I want to be sure) and dir with decoded app?

It isn't clear, cause I often don't know, what exactly to do :-D This is main problem of developing apktool: usually when you develop something, you get assumptions which you have to fullfill. In apktool I must guess these assumptions, do some research, cause there is no information on the web about "Should I compress it or not?".

But seems there is no problem to compress everything, so I think I will do this in next version.
[G1 Android Development] shoey-n:
Sorry if this has been answered before as well, I tried searching, but nearly every post is highlighted in the search

Finally got a script to work with this well, but one thing I noticed, when you decompile and then compile, it's impossible to decompile that file ever again, it just comes up with errors for them all saying it cannot decode the file. Am I just doing something wrong ?
[G1 Android Development] Brut.all:
What is the exact error message?
[G1 Android Development] shoey-n:
On the decompile it simply says S: Could not decode file "xyz\abc.png" to "xyz-v4\abc.png"

I'm assuming that's because the folder is called xyz-v4 already so it can't find it

But on the build it says xyz.xml:24**: error: Public entry identifier 0x******* entry index is larger than available symbols (index ***, total symbols ***)

and

xyz.xml:24**: error: Public symbol drawable/abc declared here is not defined

Does this mean on the first time I build I have to rename the folders to xyz instead of xyz-v4 because it causes errors ?
[G1 Android Development] Brut.all:
"Simply" ;-) "S:" is severe so worst possible error ;-) If you run "apktool -v d" then you will see, why this file could not be decoded.

I did simple test: created an empty app, built it and decoded using apktool. I got drawable-mdpi-v4 directories. Then I built it again, decoded and everything is fine.

Did you modified anything in compiled apk file? Replaced resources.arsc file, renamed directories or something?
[G1 Android Development] shoey-n:
ahh, I know what I done now, I replaced the original resources.arsc file with the original because of the file size difference, that's probably mucked it up....

is there a way of me compressing the resources.arsc myself or no ?
[G1 Android Development] Brut.all:
Unzip & zip :-)
[G1 Android Development] reekotubbs:
Here is the original, the dir with decoded app (after rename), and screen shot of errors.
[G1 Android Development] shoey-n:
Thanks a lot :)
[G1 Android Development] iScream^:
ht*p://xdaforums.com/showpost.php?p=7890997&postcount=493

Maybe you can help me here, because the issue exists using just apktool, too.

Thanks in advance.
[G1 Android Development] Brut.all:
Most of the time I read both threads :-) What is this "A rendszer nem (...)" thing? It's key error message here, but I can't translate it, cause it's in graphical form.
[G1 Android Development] iScream^:
Yes, sorry. It isn't properly displayed in Hungarian, though. It means "The system can't find the specified file."
[G1 Android Development] Brut.all:
But hey, errorous code was added by you, there is no problem with original code, so why did you thought it's apktool's issue? Just learn smali language. Ehh, users love to not inform you about what they actually did :-/

One of invalid lines is here:

.field static final synthetic $SwitchMap$com$google$android$apps.mikemoewill$ConversationArrayAdapter$Type:[I

You can't use dots in names of fields. I have did find&replace and now this file is ok, but there are similar problems with other files added by you.
[G1 Android Development] Brut.all:
So you have your error - aapt tool isn't in a path :-) Make sure you did installation steps (http://code.google.com/p/android-apktool/ - Installation for noobs) or just check whether you have aapt.exe in WINDOWS dir.
[G1 Android Development] iScream^:
Oh, boy. I tried to do it following a Hungarian tutorial, but it was miswritten. Thank you again.

Btw, how to include characters with accent in the arrays.xml?
[G1 Android Development] Brut.all:
Normally. As long as you use editor which supports UTF8, you could write anything in XML files.
[G1 Android Development] lmbd:
czesc brut.all,

I have reproduced my error from the apk-manager thread. my log is in the attachment. any idea?

P.S. I have decompiled the framework from "blackbar_cm6_0.7_pinky-desire01_signed" and tried to compile it.
[G1 Android Development] Brut.all:
Cześć :-)

Let me guess: you got "S: Could not decode file (...)" error when decoding? If so: don't you think something was wrong at this moment? ;-) Issue is here: http://code.google.com/p/android-apktool/issues/detail?id=59 , you could wait for new version of apktool, revert to 1.2.0 or try testing version attached to last comment in above issue.