yashsingh1/xdaforums huggingface dataset:
[G1 Android Development] Brut.all:
So for example:

This is a method from Main.java file from my video:

@Apktool.SMALI("1")
public void onBtn1Click(android.view.View p1) {
/* SMALI
.locals 2
.prologue
.line 27
const-string v0, "Button1 clicked!"

const/4 v1, 0x0

invoke-static {p0, v0, v1}, Landroid/widget/Toast;->makeText(Landroid/content/Context;Ljava/lang/CharSequence;I)Landroid/widget/Toast;

move-result-object v0

invoke-virtual {v0}, Landroid/widget/Toast;->show()V

.line 28
return-void
*/
}

And this is, what is generated from it:

.method public onBtn1Click(Landroid/view/View;)V
.locals 2
.parameter "p1"

.line 23
const-string v0, "Button1 clicked!"

.line 25
.local v0, v0:Ljava/lang/Object;
const/4 v1, 0x0

.line 27
.local v1, v1:I
invoke-static {p0, v0, v1}, Landroid/widget/Toast;->makeText(Landroid/content/Context;Ljava/lang/CharSequence;I)Landroid/widget/Toast;

.line 29
move-result-object v0

.line 31
.local v0, v0:Ljava/lang/Object;
invoke-virtual {v0}, Landroid/widget/Toast;->show()V

.line 34
return-void
.end method

As you can see, all original debugging symbols was purged and "faked" symbols was added. These new symbols are referencing smali-in-a-java-comment code :-)
[G1 Android Development] olearyp:
Ooooooh.

SignApk takes the raw X.509 certificate and key as distributed with the platform as signing inputs, whereas jarsigner works with a unique Java keystore format. Getting from the raw cert and key, in the form distributed by Google for the various testkeys, to a jarsigner-compatible keystore requires some jujitsu with `openssl' and another Java tool (ImportKey.java, source available various places).

So the real question is why did Google not just distribute keystores in jarsigner format, or a tool to do the conversion directly? This is purely speculation, but I would guess that it's to discourage application authors from signing with testkeys, which violates even the weak security assurance the signing protocol provides ("this APK was provided by the same organization that provided the previous version of this APK"). Since testkeys are inherently insecure, as anyone can trivially spoof them by downloading the private key from the repository, normal applications shouldn't use them. Google understands that TK's are inherent to Android platform development so they have to be provided. So SignApk lives in the platform with the test certificates and keys, and jarsigner format is requested by the SDK--either prompted and created automatically by ADT, or an input to the Ant target.

Man, that was complicated exposition, but hopefully it makes sense. I had a couple hours to figure it out while Googling how to convert the testkeys. :D

Wondering why GUSTO (an application) is signed with a test key (intended for the platform) now? This allows enomther to easily distribute the application with the ROM while preserving the ability to update in the field. And by converting the keys to a keystore, no one has to deal with SignApk; Ant can just knock it out.

(BTW, I appreciate the exposition on debuggers. The idea that the debugging symbols could be manipulated that way never hit me--I should have thought of the #line directive in C but it honestly didn't occur to me. Thanks!)
[G1 Android Development] Brut.all:
@olearyp

Thanks for explanation :-)
[G1 Android Development] Brut.all:
My dreams about the future

This is how I see it :-)
[G1 Android Development] Brut.all:
I was wondering someday:

Hah, I just run at such tool :-D

http://code.google.com/p/dex2jar/

For now using a tandem of dex2jar + jd-gui I have decompiled my simple example from last video:

package brut.t3;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.Toast;

public class Main extends Activity
{
public void onBtn1Click(View paramView)
{
Toast.makeText(this, "Button1 clicked!", 0).show();
}

public void onBtn2Click(View paramView)
{
int i = 0;
while (i < 3)
{
String str = "Button2 clicked: #" + i;
Toast.makeText(this, str, 0).show();
i += 1;
}
}

public void onCreate(Bundle paramBundle)
{
super.onCreate(paramBundle);
setContentView(32514);
}
}

This is just amazing!

It crashes at dedexing Google Maps, but I think it is just a matter of time :-)

(well... this isn't entirely true... GM is an exception cause of obfuscation - I think it is performed at bytecode level, because it is... impossible to write in Java without changing some type names... So even if it will decompile 99% of apps, GM may be a problematic one).
[G1 Android Development] xillius200:
Bloody great app had fun decompiling an .apk for code :P
[G1 Android Development] zer0day:
Are there any plans to make this available for Windows (or release the source so it can be made to work in Windows)?
[G1 Android Development] Brut.all:
Sources are somewhere in this thread. I'm working on pure Java version, so it will be portable to other platforms.
[G1 Android Development] Krzysiec:
Can anyone tell me if this SystemUI.apk decompiles fine with both 1.apk and 2.apk resources table? Cause when i try to decompile it it`s done very qiuck and uses only 1.apk resources table :/ any other SystemUI is decompiling fine with two tables.

If everything is fine what OS are u working at ?

That SystemUI is from RCMix 5.8 ROM. (Gingerbread + SENSE)

Same situation with framework-res :/ But only files from this ROM are behave like that :(
[G1 Android Development] Hatman41:
Server error

I am getting error that says 500 this is an error if you keep getting this error then report it. when trying to go to http://code.google.com/p/android-apktool/
[G1 Android Development] pendo:
I have no problems decompiling or recompiling this file.

Place THIS FILE in your ~/apktool/framework directory then decompile like this:

apktool d -f -t aosp2.3 SystemUI.apk

Make you changes, and recompile

apktool b SystemUI

I'm using apktool 1.3.1. Shouldn't make a bit of difference about what OS I'm on (I've used it on win7/OS X, and Ubuntu), but my main system is Mac.
[G1 Android Development] Krzysiec:
Thats what i get after placing file u gave me into apktool folder in users:

(I`m placing SystemUI in C:/sdk/apktool131)

http://screenshooter.net/2759574/yuimyud

only one resource table is used (usually it was 1.apk and 2.apk)

I must do something wrong cause tried on another desktop PC and same situation :/

I`m using Windows 7 64bit... Maybe i`m doing something wrong with installing apktool? Java? or something ... I`m just curious about this bug :/ cause only those two are not decompiling fine... Actually they are and compiling aswelll but very fast with only one table and finally they don`t work when put into the phone :/ My statusbar is missed after that :( IT must be because it doesn`t use com.htc.resource.apk when decompiling - 2.apk)

Input file before decompiling is 577kb

Output afer decompiling (no changes) compiling 559kb
[G1 Android Development] pendo:
This shouldn't make a bit of difference, but are you also removing the "-v4" sdk version tags? Apktool 1.3.2 does this for you, but 1.3.1 does not. Most of the time it shouldn't matter, but if there's anything that tries work from an expected path rather than an id, then it could cause an issue. Metamorph is a good example. As a habit, I always remove them (unless I'm working on an unfamiliar file from someone else and they were already in there previously).

I never pay attention to how many framework files apktool references. To be honest, I don't ever recall it loading up 2 different ones, but then again I admittedly haven't payed that close of attention. I seems to me that apktool has some sort of ability to know when it's supposed to call up a different framework. I only say that as over the months, I've accumulated quite a few framework files in my apktool folder (looks like 24, lol) and I know there have been times that I just type "apktool d" and then quickly realize I should've installed framework files first....only to find that it loaded framework files itself and decoded just fine.

What are you doing after it compiles? Are you making sure to re-inject the original META-INF folder as well as the AndroidManifest.xml? Unless you are changing something in the manifest, you should always do that..particularly with system apks. If you are changing something in the manifest (can't imagine what on this file) then that could cause some other issues sometimes.
[G1 Android Development] Krzysiec:
Here is ALL STEP BY STEP what i`m doing with decompilin SystemUI.apk:

I got SDK folder on C:. In SDK a got folders with apktool

- apktool131 (apktool.jar, apktool.bat, aapt.exe)

- apktool132 (same as above)

When i want to compile with apktool 131 or 132 i place SystemUI.apk in that folder than in cmd type: cd C:/SDK/apktoolxxx. Before i started anything i installed frameworks in C:/Users/~/apktool/framework (1.apk 2.apk)

Ok I placed SystemUI let say in apktool131 ... in CMD when i`m in apktool131 folder i type: apktool d -f SysemUI.apk and i see as on screenshot:

http://screenshooter.net/2759574/yuimyud

After VERY QUICK decompiling (strange) i do not change anything for test and compiling it just righ after decompiling (without any changes) so i type: apktool b -f SystemUI In SystemUI in dist folder i see compiled SystemUI.apk so for tests i`m pushing it via adb into my phone and ... statusbar is missing :/ Nothing more.

THE STRANGEST THINK IS THAT !!! When i do the same with SystemUI.apk from previus ROM version it decompiles/compiles RIGHT and everyhing is working fine! Only that SystemUI and framework-res.apk from that ROM don`t wanto decompile for me :( But why others do not have any problems? :/
[G1 Android Development] pendo:
Everything looks fine in your screenshot.

Try this....take the file that is in the dist folder after your done. Open it with 7zip, but do not extract it. Also, open up the original SystemUI.apk in the same manner. Then highlight both the META-INF and AndroidManifest.xml from the ORIGINAL file and drag them over to the newly compiled one.

Then push to the phone, either in recovery or by stopping/starting core with adb shell stop/start.

Also, from what sdk did you get your aapt from? If it was from sdk 9, please use aapt from sdk 8.

FWIW, I typically don't use the -f switch on build, but I don't suppose it hurts anything here.
[G1 Android Development] UnkleDuke:
I'm hoping someone can help me recompile BlurContacts.apk.

I've also attached the res apks I've installed to properly decompile.

The Apk decompiles fine, but I get errors when recompiling.

Thanks!

ERROR:

c:\>java -Xmx512m -jar apktool.jar d BlurContacts.apk
I: Baksmaling...
I: Loading resource table...
I: Decoding resources...
I: Loading resource table from file: C:\Users\derek\apktool\framework\1.apk
I: Loading resource table from file: C:\Users\derek\apktool\framework\3.apk
I: Loading resource table from file: C:\Users\derek\apktool\framework\2.apk
I: Copying assets and libs...

c:\>java -Xmx512m -jar apktool.jar b BlurContacts
I: Checking whether sources has changed...
I: Smaling...
I: Checking whether resources has changed...
I: Building resources...
Included base package ID 2 already in use!
Exception in thread "main" brut.androlib.AndrolibException: brut.common.BrutExce
ption: could not exec command: [aapt, p, -F, C:\Users\derek\AppData\Local\Temp\A
PKTOOL8812093479013676680.tmp, -I, C:\Users\derek\apktool\framework\1.apk, -I, C
:\Users\derek\apktool\framework\3.apk, -I, C:\Users\derek\apktool\framework\2.ap
k, -S, c:\\BlurContacts\res, -M, c:\\BlurContacts\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\derek\AppData\Local\Temp\APKTOOL8812093479013676680.tmp, -I, C:\Users\derek
\apktool\framework\1.apk, -I, C:\Users\derek\apktool\framework\3.apk, -I, C:\Use
rs\derek\apktool\framework\2.apk, -S, c:\\BlurContacts\res, -M, c:\\BlurContacts
\AndroidManifest.xml]
at brut.util.OS.exec(Unknown Source)
... 7 more
[G1 Android Development] djmcnz:
That SystemUI decompiles fine for me.

Try running apktool with the -v (verbose) switch... what does it say?
[G1 Android Development] Krzysiec:
Thats what is said:

http://screenshooter.net/2759574/vgbmkfp

Is it the same for U ?

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

Here is decompiled SystemUI.apk that decompiles and compiles FINE (from previuos ROM version) doing the same:

http://screenshooter.net/2759574/eskmmvt

As u can see it usses another resoursec table 1.apk and 2.apk. That first one uses only 1.apk and finally my statusbar is missed in that first after compiling and push to phone.

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

So i don`t think if META and AndroidManifest would help in anyway ... It misess resources during decompiling from 2.apk. When im taking resources.arsc from compiled one and paste into original file after push System is crashing all the time.

The strangest think is thath One SystemUI is decompiling and compiling FINE and one NOT :( Doing the same! And as u told me for U everything is fine with that SystemUI.apk . It drives me crazy! why for others it works and not for me! :/ Tried on another PC the same ... so i must do semothing worng ... maybe java installing or something? maybe apktool installing. But why previus SystemUI works fine ... If i had wrong install it shouldn`t work too!
[G1 Android Development] pendo:
As part of the process of elimination, would you please try the method I suggested? Re-inject the META-INF folder AND AndroidManifest from original.

While I don't claim to be an expert (djmcnz is far more knowledgeable), I'm not so certain you're not losing sight of the forest for the trees here. If you take the resources.arsc from a newly compiled apk and inject it into the original, you could very easily cause problems depending on what you've changed. If you were truly missing public resource definitions, then apktool wouldn't even compile it in the first place.

I just looked at your rom you referenced. It says it's a 2.3.3 Sense based rom. Have you run 'apktool if' using com.htc.resources.apk

from this specific rom

? I usually tag all my framework files as well:

apktool if com.htc.resources.apk htc2.3

then you'd decompile like:

apktool d -t htc2.3 SystemUI.apk

or something like that to where I'd know what it was from...in this case htc2.3.
[G1 Android Development] Krzysiec:
Ok so... i did what u said and ... when installed again com.htc.resources.apk with tag rcmix i got:

http://screenshooter.net/2759574/yfbnmad

(as u can see still only 1.apk used :/ Not even tried to use 2-rcmix.apk)

So a decompiled it changed and compiled it as u suggested. And after copy META-INF and AndroidManifest from original to "compiled" one system don`t want to start at all :/ In fact after "compiling" there was no META-INF inside.
[G1 Android Development] djmcnz:
META-INF is only created during signing, not encoding.

Only remaining suggestion:

Get framework-res.apk and com.htc.resources.apk for the exact rom you're using and get SystemUI from the same rom.

Delete everything in c:\users\Krzysiek\apktool\framework\

Reload framework-res.apk as 1.apk and com.htc.resources.apk as 2.apk

Try SystemUI again.
[G1 Android Development] Krzysiec:
Actually i tried with files only from that rom but what do U mean by saying

Reload framework-res.apk as 1.apk and com.htc.resources.apk as 2.apk

copy those two files into C:/~/framework and name them 1.apk (framework-res) and 2.apk (com.htc.resources.apk) or there are some specific commands for 1.apk ? Cause when iam using command apktool if it only install 2.apk never 1.apk.

I did like that and still nothing. Only 1.apk table used.

I think it will remain mystery as BRUCE LEE death :/ Have no idea why on my both PCs it don`t want to decompile with 1.apk and 2.apk tables (ONLY those files from that version of ROM and ONLY for me :/) I think they fell that they are on my PCs :P
[G1 Android Development] djmcnz:
Use the if switch to install frameworks. They will be automatically numbers sequentially. Just make sure you only have two and in the correct order.
[G1 Android Development] Krzysiec:
I think i `ll add this case into X-files :P Nothing Nothing NOthing ... Mysteries circumstances are happening in my both PCs. Give up with this :( Have no more ideas what alse can i do ... Anyway THANK U GUYS FOR YOUR HELP!!
[G1 Android Development] pendo:
There will never be signature files after compiling, but there will be a freshly compiled manifest. And even if you didn't touch it, it doesn't compile the same (you can see this with a hex editor if you want)...which is why I suggested injecting both from the original apk.

A while ago I also had a rom that I just couldn't get to work with apktool. Don't let it discourage you, though. Eventually I did get it to work, and as of this date I've always been able to work through any apktool issues.

What kind of mod were you trying to do?
[G1 Android Development] Krzysiec:
Actually i was trying to translate some values but it daoesnt matter. When i couldn`t decompile and compile file there was no sense to translate anything ;) After few tries with changed valuse i just wanted to decompile and compile without any changes to get it work ... It didn`t :/
[G1 Android Development] BAD_BOY_KIEV:
I need help.

I have an apk.

It runs landscape and sometimes portrait.

I want to make it run landscape always.

As I found out, I need to decompile and edit manifest and as I understood put the right png's to make it work\look as it should.

What commands shoud I use to decompile apk and the manifest in it to be able to edit its xml code? Would really appreciate step-by-step command guide.

Thank you very much in advance.

P.S. Also, is it difficult to edit the controls in the games\assing key? Thnx ;)

P.P.S. Thnx for this magic tool!
[G1 Android Development] ihtfp69:
Change the orientation attribute for each activity to landscape. It may be set to sensor currently to allow the switch from portrait to landscape.
[G1 Android Development] Exculpo:
Edit:

Had troubles getting the formattingtable to work for scandinavian letters ,

turns out I was looking at the wrong conversationtable :$

So never mind, figured it out.
[G1 Android Development] bonesy:
Great work Brut! Although im having problems with Rosie.apk? once compiled it will no longer load up but i see no error in logcat? I know its possible for the hero as Hawst has done it on his tegro rom? is there anything i should be aware of?
[G1 Android Development] hawkeyexp:
Hi Guys,

since a longer time i use apktool to reeng my files to translate the gui. But now one file i can't decode and i doesn't find a working solution.

Error is "Skipping ''android'' package group"

Can anybody help ? The apk is zeam-launcher (2.8.8) which is uploaded here....

http://rapidshare.com/files/457143335/org.zeam-1.apk

I hope anybody can help to fix the problem !

apktool is 1.3.2 / linux
[G1 Android Development] Raadius:
I feel like an idiot, but I followed instructions and I still can not get this to install on Win 7. I though maybe it was a permission issue but after fixing it I still cant.
[G1 Android Development] tommytomatoe:
Care to expand on your issue? What is the error exactly? There could be a number of things. What steps did you take exactly? List them. If you did everything right then this should work. Well get You up and running but need more help from you.
[G1 Android Development] xavierjohn22:
Hi,

I compare the xmls being outputed by APK tool in the dist and res folders with the Original apk. It is different. This affects images drawn.

The other changes okay since we are recompilig, but those other drawable xmls changes affects appearance of drawing the image.

Is there a workaround to fully reuse that APK in the dist folder?

Right now i can use all APKs generated by the APK tool, but somewhat it is changing those drawable files and affect image structure and appearance.
[G1 Android Development] pendo:
You can swap compiled xml's like you do png's with 7zip. Take the original apk, and view it's contents with 7zip, then take your new apk and do the same. Grab the xml you want and drag it over to the new one.
[G1 Android Development] JGW310:
can someone give me a noobish tutorial on how to install this on mac???
[G1 Android Development] pendo:
It's pretty simple...just follow the instructions here.

Mac OS X:

Download apktool-install-macos-* file

Download apktool-* file

Unpack both to /usr/local/bin directory (you must have root permissions)
​

And you gotta have jre 1.6, which you probably already have.

I strongly recommend you don't use the "current" release of apktool.jar which is 1.3.2. Use 1.3.1 instead.
[G1 Android Development] xavierjohn22:
my mistake on the question construction, lol, I'm sort of trying to understand why

Yeah i know that, i was looking for something like why it is doing that, because i have automated bruts tool.

Not necessarily a workaround. I loop scripts through the Original APK to copy over files to the new APK,

1.3.1 = cool no fc, fully usable apks, my out folder

1.3.2 = rebuild apks, fully usable, my out folder

1.3.2 dist from brut in my tool = some fcs, lol, thats why i introduce build usable apk which uses 1.3.2 jar, no more fc

1.3.1 dist from brut = no fc but images are changing, so i implement build fully usable apks, images are fixed

And many more options....

very useful in building 50 APKs all at once, like translating MIUI, he he

EDIT: POSTED HERE

http://xdaforums.com/showthread.php?t=1053227
[G1 Android Development] castro65:
i used apktool to decompile/recompile the livewallpapers from this thread:

http://xdaforums.com/showthread.php?t=1025087

but i get a parse error when i try to install them.

i also get the error when i dont change anything just unpack/quickpack the apk.

can anyone give me a hint what i am doing wrong?
[G1 Android Development] pendo:
My bad...if I'd have looked at your join date and thanks count I could've surmised you were already quite proficient indeed.

I generally do not like programs/scripts that automate apktool because they are limited in how they work with certain "peculiarities" (that and I learned it from command to begin with). But your's looks to offer several options for working with apktool....I'll have to fire up windows just so I can take a look, lol.

As to your question, I'm afraid I don't know for sure. For the most part, 1.3.1 has been error free for me except for LatinIME had a few xml decoding errors.