yashsingh1/xdaforums huggingface dataset:
[G1 Android Development] exorcist26:
ok This is a stupid questions but ı dont know change aapt :( and my path settings maybe incorrect. Can you tell me your path settings :( thanks.

Edit my new error :(

C:\Users\ertugrul>cd C:\apktool

C:\apktool>apktool b Zeam_Launcher_v3.0.7
I: Checking whether sources has changed...
I: Smaling...
Exception in thread "main" java.lang.NullPointerException
at org.jf.util.PathUtil.getRelativeFile(PathUtil.java:44)
at org.jf.smali.smaliFlexLexer.getSourceName(smaliFlexLexer.java:2569)
at org.antlr.runtime.CommonTokenStream.getSourceName(CommonTokenStream.j
ava:345)
at org.antlr.runtime.tree.CommonTreeNodeStream.getSourceName(CommonTreeN
odeStream.java:106)
at org.antlr.runtime.tree.TreeParser.getSourceName(TreeParser.java:78)
at org.jf.smali.smaliTreeWalker.getErrorHeader(smaliTreeWalker.java:349)

at org.antlr.runtime.BaseRecognizer.displayRecognitionError(BaseRecogniz
er.java:192)
at org.antlr.runtime.BaseRecognizer.reportError(BaseRecognizer.java:186)

at org.jf.smali.smaliTreeWalker.smali_file(smaliTreeWalker.java:428)
at brut.androlib.mod.SmaliMod.assembleSmaliFile(SmaliMod.java:85)
at brut.androlib.src.DexFileBuilder.addSmaliFile(DexFileBuilder.java:43)

at brut.androlib.src.DexFileBuilder.addSmaliFile(DexFileBuilder.java:33)

at brut.androlib.src.SmaliBuilder.buildFile(SmaliBuilder.java:64)
at brut.androlib.src.SmaliBuilder.build(SmaliBuilder.java:48)
at brut.androlib.src.SmaliBuilder.build(SmaliBuilder.java:35)
at brut.androlib.Androlib.buildSourcesSmali(Androlib.java:222)
at brut.androlib.Androlib.buildSources(Androlib.java:179)
at brut.androlib.Androlib.build(Androlib.java:170)
at brut.androlib.Androlib.build(Androlib.java:154)
at brut.apktool.Main.cmdBuild(Main.java:174)
at brut.apktool.Main.main(Main.java:59)
[G1 Android Development] captaincrook:
I can't seem to compile framework-res. I used a fresh non edited one just to make sure. Decompile, ok works. Go right to compile, I get complaints about string errors (checked the XMLs and they are fine) followed by a flood of public.xml errors. I don't get any compiled APK.

Any tips?
[G1 Android Development] pendo:
Which version of apktool are you using? Also, can you please list the first couple errors? (or attach a pastebin link of the entire error)

The public.xml errors happen as a result of the first error(s) in that a resource can't be compiled right, so it throws off the entire id numeration for the remaining files. Once the real errors are fixed, then public.xml will take care of itself.
[G1 Android Development] Mekrel:
Just to say thanks for the help you've currently provided to users.

I just wanted to clarify which situations require the original META-INF and AndroidManifest.xml documents copied over?

Is it just for system applications on proprietary ROMs or when modifying any applications?

I downloaded a Samsung Galaxy S2 ROM last night (official), deodexed it, made changes to framework-res.apk, SystemUI.apk and Mms.apk but the ROM didn't even boot.

Just trying to find out where I went wrong. I was replacing the original resources.arsc files when modifying any xml documents for example.

I was using APK Manager (which is basically a bunch of scripts for apktool and other ultilities) and I'm also confused about compression levels? Is any compression okay? I've read mixed views when searching about compression.

Thanks in advance
[G1 Android Development] pendo:
I'll try to help answer your question, although it probably won't be with the most technically correct terminology :o

The META-INF folder contains the private and public keystore pairings which together form a digital signature.

ALL

apk's must be signed. The problem is that if you resign some system apk's, then you will bootloop (I think it's due to PackageManagerService). Since we don't have access to the proprietary keys to properly resign our modded apk, we copy over the original signatures and the manifest. We get away with this because apparently if the modification time of the apk is the same as what it's expecting....android doesn't even check the certs. This is why we must stop core to push certain system apks (by going into recovery or stopping core with adb shell stop)

So, now that I've sufficiently butchered the exact technical workings here's the "rules" that I go by. Unless I am modifying the AndroidManifest...I always copy and inject the original META-INF and AndroidManifest.xml into the new apk. This has always worked and significantly reduces, if not eliminates, any incompatibilities.

If you ARE modifying the manifest, then you have no other choice but to resign the apk. Copying the META-INF only will not work. It will fail checkSignatures. Depending on the apk, this could be a problem. It can be done, but you would need to identify all other apks that were signed with the same certs and resign all of those, too. (Unless if it has a shared UID in the manifest...you can try to just delete the shared UID and sometimes that works)

I'd venture a guess that you aren't modding the manifest at this point, so just get in the habit of using the original signatures and manifest. Another method is to inject the changed files back into the original apk, but I prefer to keep the original as is (good reference, and is nice to have if wanted to start over) and just inject the signatures and manifest into the new apk.
[G1 Android Development] Mekrel:
Thanks a lot for the detailed explanation, I manually de-compiled the APKs with APKTOOL after installing twframework-res.apk and framework-res.apk.

I made my changes (just to a few xml files and images) and re-compiled than manually injected the AndroidManifest.xml and META-INF folder but I'm still getting boot loops :(

Does it matter what order you make changes to files? I'm assuming you need to make changes to framework files before changing system applications? :confused:

Here's my pastebin:

http://pastebin.com/Mss5Nfea
[G1 Android Development] pendo:
Someone with a bit more expertise will have to help with that logcat :-/ I do a bit better with fc's....haven't spent as much time on the boot sequence.

As far as I know, it doesn't matter the order of your changes. I've pushed/flashed edited apps, framework-res, and more all at one time.

I have heard from a few people that the compressed resources.arsc has caused problems. Extracting resources.arsc then re-injecting it into the apk with 0 compression fixed it.
[G1 Android Development] pendo:
That does seems a little strange.

Anyway you could maybe zip up all those files and provide a link?
[G1 Android Development] ludovicianul:
Attached: the framework files and the widget.
[G1 Android Development] pendo:
Couldn't replicate your issue. I had installed samsung framework files from KF2, so I thought I'd try just running apktool with what I had first.

$ apktool d SamsungWidget_News.apk
I: Baksmaling...
I: Loading resource table...
I: Loaded.
I: Loading resource table from file: /Users/jpendergraft/apktool/framework/1.apk
I: Loaded.
I: Loading resource table from file: /Users/jpendergraft/apktool/framework/2.apk
I: Loaded.
I: Decoding file-resources...
I: Decoding values*/* XMLs...
I: Done.
I: Copying assets and libs...

I'm not sure exactly what's happening on your end, but there does not appear to be anything unusual with the apk.
[G1 Android Development] $omator:
brutal sprawdzisz iisue trackera na gcode? :)
[G1 Android Development] :
Apktool Help Needed!

Okay, I've had a bad day, any help appreciated!

I decode an apk, and build it again without touching the contents of the decoded apk. No swapping images or anything, the second command was executed literally after the first complete, etc, this is the result:

finn@Desktop:~/apktool$ apktool decode meh.apk
I: Baksmaling...
I: Loading resource table...
I: Loaded.
I: Loading resource table from file: /home/finn/apktool/framework/1.apk
I: Loaded.
I: Decoding file-resources...
I: Decoding values*/* XMLs...
I: Done.
I: Copying assets and libs...
finn@Desktop:~/apktool$ apktool build meh.apk
Exception in thread "main" brut.androlib.AndrolibException: brut.directory.PathNotExist: apktool.yml
at brut.androlib.Androlib.readMetaFile(Androlib.java:142)
at brut.androlib.Androlib.build(Androlib.java:159)
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.directory.PathNotExist: apktool.yml
at brut.directory.AbstractDirectory.getFileInput(AbstractDirectory.java:103)
at brut.androlib.Androlib.readMetaFile(Androlib.java:138)
... 4 more
finn@Desktop:~/apktool$

Any ideas?
[G1 Android Development] tommytomatoe:
apktool decode meh.apk

apktool build meh

Its not apktool build meh.apk. When you use apktool build, you need to direct to the directory created by the "apktool decode" not the apk itself.
[G1 Android Development] :
So wait, is it just "apktool build meh" rather than "apktool build meh.apk"? (this also gives errors so I guess not)

Could someone give a short example of what I need to write, its been a long time since I've used this :(
[G1 Android Development] tommytomatoe:
Here is the proper method. Have your apk in a folder somewhere (in my example it will be in a folder called work on my desktop)

cd PATH/TO/apk

(For example:

cd C:\Users\yourname\Desktop\work -PC USERS

cd $HOME/Desktop/work -Unix Users)

apktool decode meh.apk

apktool build meh

NOTE it is not "apktool b meh.apk".

You are getting errors because the output path of the "apktool decode" command isn't where your command prompt is. Just do what I typed and it should work. (Assuming your aapt is compatible)
[G1 Android Development] :
Thankyou for helping, but I still have issues :(

finn@Desktop:~/Desktop$ cd $HOME/Desktop/Work
finn@Desktop:~/Desktop/Work$ apktool decode meh.apk
I: Baksmaling...
I: Loading resource table...
I: Loaded.
I: Loading resource table from file: /home/finn/apktool/framework/1.apk
I: Loaded.
I: Decoding file-resources...
I: Decoding values*/* XMLs...
I: Done.
I: Copying assets and libs...
finn@Desktop:~/Desktop/Work$ apktool build meh
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/APKTOOL1492593351415553184.tmp, -x, -I, /home/finn/apktool/framework/1.apk, -S, /home/finn/Desktop/Work/meh/res, -M, /home/finn/Desktop/Work/meh/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/APKTOOL1492593351415553184.tmp, -x, -I, /home/finn/apktool/framework/1.apk, -S, /home/finn/Desktop/Work/meh/res, -M, /home/finn/Desktop/Work/meh/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:475)
at java.lang.Runtime.exec(Runtime.java:610)
at java.lang.Runtime.exec(Runtime.java:483)
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:164)
at java.lang.ProcessImpl.start(ProcessImpl.java:81)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:468)
... 10 more
finn@Desktop:~/Desktop/Work$

Can you point me in the right direction for "making my aapt compatible" or whatever else it is I need to do?

Thanks again! :P

If it makes a difference im on Ubuntu 11.04
[G1 Android Development] tommytomatoe:
You pretty much just have to use the android Sdk manager and update your Sdk to the correct API. Gingerbread is API 10. If you have 11,12 or 13 uninstall those.

Or....

Use this tool:

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

Big upgrade coming soon
[G1 Android Development] :
Thanks again! :P - I am on api 10 though :(

I will use your tool though! :P
[G1 Android Development] pendo:
How about

chmod 755 /usr/local/bin/aapt

I'm embarrassed to admit that I *still* hadn't checked out this work. Good job. I will make sure to recommend this to folks as a resource.

....but...where's my name in the credits? Surely I helped with somethin..
[G1 Android Development] :
Thankyou very much! Its finally working (:

Now to fix that apk...
[G1 Android Development] Hatman41:
So It looks like Google did something to the new vending that just dropped. I am getting the following error while trying to decompile using the latest apktool.

-----------------------------------------------------
[*] Vending.apk
-----------------------------------------------------
Decompiling Vending.apk...
I: Baksmaling...
I: Loading resource table...
I: Loaded.
I: Loading resource table from file: C:\Users\Jeffrey\apktool\framework\1.apk
I: Loaded.
W: Could not decode attr value, using undecoded value instead: ns=android, name=hardwareAccelerated, value=0xffffffff
I: Decoding file-resources...
W: Could not decode attr value, using undecoded value instead: ns=android, name=showAsAction, value=0x00000006
W: Could not decode attr value, using undecoded value instead: ns=android, name=showAsAction, value=0x00000002
W: Could not decode attr value, using undecoded value instead: ns=android, name=actionViewClass, value=0x0000000c
Exception in thread "main" java.lang.NullPointerException
at java.io.Writer.write(Writer.java:140)
at brut.androlib.res.util.ExtMXSerializer.writeAttributeValue(ExtMXSerializer.java:38)
at org.xmlpull.mxp1_serializer.MXSerializer.attribute(MXSerializer.java:673)
at org.xmlpull.v1.wrapper.classic.XmlSerializerDelegate.attribute(XmlSerializerDelegate.java:106)
at org.xmlpull.v1.wrapper.classic.StaticXmlSerializerWrapper.writeStartTag(StaticXmlSerializerWrapper.java:267)
at org.xmlpull.v1.wrapper.classic.StaticXmlSerializerWrapper.event(StaticXmlSerializerWrapper.java:211)
at brut.androlib.res.decoder.XmlPullStreamDecoder.decode(XmlPullStreamDecoder.java:46)
at brut.androlib.res.decoder.ResStreamDecoderContainer.decode(ResStreamDecoderContainer.java:34)
at brut.androlib.res.decoder.ResFileDecoder.decode(ResFileDecoder.java:100)
at brut.androlib.res.decoder.ResFileDecoder.decode(ResFileDecoder.java:86)
at brut.androlib.res.AndrolibResources.decode(AndrolibResources.java:132)
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)
Done!

I have attached the newest market.
[G1 Android Development] mattmanwrx:
I cannot get that far. What frameworl-res did you use to decompile? I always seem to struggle with the framework-res, so any help (from anyone) is apprciated!

I also cannot decompile google maps 5.9 (i think), and believe it is a framework-res problem!

Thanks in advance, Matt
[G1 Android Development] Hatman41:
I used the one from SkyRaider 4.2 ROM for the HTC Incredible.
[G1 Android Development] mattmanwrx:
Can I ask why u used that one? Is it just hit and miss guess work, or is there logic behind it? I've always had problem with the install of framework-res..

Thanks for quick reply too...
[G1 Android Development] Hatman41:
So I just tried the one from the new community ROM that is 2.3.4 and it decompiled fine. So I do not have this issue now :) http://xdaforums.com/showthread.php?t=1191936

D:\android-sdk-windows\tools\apktool.3.2>apktool d Vending.apk ./Vendingnew
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...
I: Done.
I: Copying assets and libs...

D:\android-sdk-windows\tools\apktool.3.2>
[G1 Android Development] mattmanwrx:
thank you for this useful information... However, i'm still confused :confused: lol...

Why did you use that one? was it just a guess that it might work?

And i see you are using apktool.3.2. where can i get this from? it might help me for my decompile of maps 5.9...

Thanks again!
[G1 Android Development] Hatman41:
I used that one because that framework-res is gingerbread 2.3.4 and the new market is for that version. apktool3.2 is just a directory that I created. It does not have anything to do with the version of apktool. 3.2 deals with honeycomb for the tablet. I use that directory to decompile and recompile my honeycomb 3.2 files for the themes that I do for my Asus Transformer.
[G1 Android Development] mattmanwrx:
thank you again...

So i'm on a CM7 gingerbread rom, so I should be able to use the framework-res from my rom to decompile it? the rom is 2.3.5 at the moment!

I also need to change my API level, uninstall any above API 10 (i think it is GB) for these to work... and then use the FW-res.apk to decompile? do I need to move aapt.exe to my apktool directory?

Thanks for all your help, it is really apprciated!
[G1 Android Development] Hatman41:
You should be able to use a gingerbread framework to decompile it. I have attached the apktool that i use. Take these three files create a new directory and put them into it then put in your framwork-res.apk and the new vending.apk and type apktool if framework-res.apk then hit enter then type apktool d framework-res.apk ./Vending and it should decompile. After you are done modifying it then type apktool b -f -d ./Vending and it will recompile
[G1 Android Development] mattmanwrx:
Thank you so so so much! I have now decompiled maps, and the new vending... I didnt know you had to write the framework-res.apk ./vending or ./maps to use the framework-res (i thought once installed it just uses it!)... I used the FW-res.apk from the GB rom im using!

This is also done without BakSmali too, yes? as I have no smali folder in the decompiled (which doesnt matter for me, as I'm only editing images!)

(I dont think I can say it enough), but, thank you again!!!! :D
[G1 Android Development] Hatman41:
Glad I could help. I have a res and smali directory when I decompiled the vending.apk
[G1 Android Development] mattmanwrx:
hmmmmmm... mine didnt seem to BakSmali...

C:\Users\Webmaster\Desktop\apktool>apktool d framework-res.apk ./vending
I: Loading resource table...
I: Loaded.
I: Decoding file-resources...
I: Decoding values*/* XMLs...
I: Done.
I: Copying assets and libs...

I will try again with the apktool you attached in previous post!
[G1 Android Development] Hatman41:
Your command is not correct. It should be apktool d Vending.apk ./vending the command you used decompiles the framework into a vending directory. It does not decompile the actual vending.apk
[G1 Android Development] tommytomatoe:
I'm embarrassed you're not on the credits! I'm releasing version version 1.0.2 today and you will definitely be added for all the questions you've answered and sound advice you've shared. :-)
[G1 Android Development] mattmanwrx:
I thought it was wrong... but its what you said (top of page) So i thiought I would try it!

Which is prob why there was no Smali... (I think it just decompiled the Framework-res to these folders!)

I will try again!
[G1 Android Development] Hatman41:
Yes you are correct....that is my mistake...sorry about that.
[G1 Android Development] Hatman41:
Use the attached framework and see if that makes any difference. Make sure to load it first. also type Vending.apk..not sure if the capitilzation counts or not but it might :)
[G1 Android Development] mattmanwrx:
Not capitalization... Not the framework-res... I think it was my Vending.apk... So I downloaded the one you attached a couple of pages back... Downloaded your framework-res and downloaded your apktool.zip....

This time, just one error...

C:\Users\Webmaster\Desktop\apktool>apktool d -f Vending.apk ./Vending
I: Baksmaling...
testI: Loading resource table...
I: Loaded.
I: Loading resource table from file: C:\Users\Webmaster\apktool\framework\1.apk
I: Loaded.
I: Decoding file-resources...
W: Could not decode attr value, using undecoded value instead: ns=android, name=actionViewClass, val
ue=0x0000000c
Exception in thread "main" java.lang.NullPointerException
at java.io.Writer.write(Unknown Source)
at brut.androlib.res.util.ExtMXSerializer.writeAttributeValue(ExtMXSerializer.java:38)
at org.xmlpull.mxp1_serializer.MXSerializer.attribute(MXSerializer.java:673)
at org.xmlpull.v1.wrapper.classic.XmlSerializerDelegate.attribute(XmlSerializerDelegate.java:106)
at org.xmlpull.v1.wrapper.classic.StaticXmlSerializerWrapper.writeStartTag(StaticXmlSerializerWrapper.java:267)
at org.xmlpull.v1.wrapper.classic.StaticXmlSerializerWrapper.event(StaticXmlSerializerWrapper.java:211)
at brut.androlib.res.decoder.XmlPullStreamDecoder.decode(XmlPullStreamDecoder.java:46)
at brut.androlib.res.decoder.ResStreamDecoderContainer.decode(ResStreamDecoderContainer.java:34)
at brut.androlib.res.decoder.ResFileDecoder.decode(ResFileDecoder.java:100)
at brut.androlib.res.decoder.ResFileDecoder.decode(ResFileDecoder.java:86)
at brut.androlib.res.AndrolibResources.decode(AndrolibResources.java:132)
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)

So just the one error...! getting closer... But the one error... if it is the extact same as yours? :confused:
[G1 Android Development] Hatman41:
Try this command

apktool d Vending.apk ./Vending

No -f the -f is for recompiling

Decompile command

apktool d Vending.apk ./Vending

Recompile command

apktool b -f -d ./Vending
[G1 Android Development] mattmanwrx:
The -f is for the force delete of the file i.e. Vending directory already there...

-f, --force
Force delete destination directory.
[G1 Android Development] Hatman41:
Ahh...I never use that :)
[G1 Android Development] mattmanwrx:
Little bit easier than deleting directory before hand... however, this doesn't actually help me... what java version do you have, and your path is included? I know mine is as I just checked... :)
[G1 Android Development] Hatman41:
This is my path. C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live;C:\Program Files\Java\jdk1.6.0_24\bin;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\QuickTime\QTSystem\;d:\android-sdk-windows\platform-tools;d:\android-sdk-windows\tools\apktool;C:\Program Files (x86)\Windows Live\Shared;C:\Program Files (x86)\FastSum
[G1 Android Development] mattmanwrx:
So yea the path is there, same as mine... very strange... I'm just driving home and will check on my laptop in a little bit...
[G1 Android Development] mattmanwrx:
Same error on my laptop... Dont know what to do now...

Hopefully someone else has any suggestion for me... :confused::confused: