yashsingh1/xdaforums huggingface dataset:
[G1 Android Development] fernando sor:
Generally my experience is that its usually my error. You just need to find out what the issue is . This is a pretty reliable tool
[G1 Android Development] MultiCulti:
lol, i could´nt even decompile the resource.apk :

G:\DesireHD\APK Manager 4.9\place-apk-here-for-modding\../place-apk-here-for-modding/signedcom.htc.resources.apk konnte nicht gefunden werden
G:\DesireHD\APK Manager 4.9\place-apk-here-for-modding\../place-apk-here-for-modding/unsignedcom.htc.resources.apk konnte nicht gefunden werden
I: Loading resource table...
I: Decoding resources...
I: Loading resource table from file: C:\Users\Markus\apktool\framework\1.apk
W: Could not decode attr value, using undecoded value instead: ns=android, name=src, value=0x0108035e
W: Could not decode attr value, using undecoded value instead: ns=android, name=background, value=0x01080366
W: Could not decode attr value, using undecoded value instead: ns=android, name=src, value=0x0108035e
Exception in thread "main" brut.androlib.err.UndefinedResObject: resource spec: 0x0108035e
at brut.androlib.res.data.ResPackage.getResSpec(Unknown Source)
at brut.androlib.res.data.ResTable.getResSpec(Unknown Source)
at brut.androlib.res.data.ResTable.getResSpec(Unknown Source)
at brut.androlib.res.data.value.ResReferenceValue.getReferent(Unknown Source)
at brut.androlib.res.data.value.ResReferenceValue.toResXmlFormat(Unknown Source)
at brut.androlib.res.data.value.ResAttr.convertToResXmlFormat(Unknown Source)
at brut.androlib.res.decoder.ResAttrDecoder.decode(Unknown Source)
at brut.androlib.res.decoder.AXmlResourceParser.getAttributeValue(Unknown Source)
at org.xmlpull.v1.wrapper.classic.XmlPullParserDelegate.getAttributeValue(Unknown Source)
at org.xmlpull.v1.wrapper.classic.StaticXmlSerializerWrapper.writeStartTag(Unknown Source)
at org.xmlpull.v1.wrapper.classic.StaticXmlSerializerWrapper.event(Unknown Source)
at brut.androlib.res.decoder.XmlPullStreamDecoder.decode(Unknown Source)
at brut.androlib.res.decoder.ResStreamDecoderContainer.decode(Unknown Source)
at brut.androlib.res.decoder.ResFileDecoder.decode(Unknown Source)
at brut.androlib.res.decoder.ResFileDecoder.decode(Unknown Source)
at brut.androlib.res.AndrolibResources.decode(Unknown Source)
at brut.androlib.Androlib.decodeResourcesFull(Unknown Source)
at brut.androlib.ApkDecoder.decode(Unknown Source)
at brut.apktool.Main.cmdDecode(Unknown Source)
at brut.apktool.Main.main(Unknown Source)

and framework without change couldn´t compile!
[G1 Android Development] fernando sor:
Ill take a closer look at your log tonight. Put your sdk on the right drive and try reinstalling apk manager
[G1 Android Development] MultiCulti:
Ok, thank you!

is it right likt this:

"C:\android-sdk-windows" ?
[G1 Android Development] fernando sor:
C:\android-sdk-windows\tools

You need to have it on your c drive
[G1 Android Development] MultiCulti:
ok, thanks, @ least i´ve got ADB working :o
[G1 Android Development] fernando sor:
Very cool
[G1 Android Development] RocknSteve:
I've placed Handcent's APK in the "place-apk-here-for-modding" and I open Script.bat set Handcent's APK as the current project and then try to decompile it but when doing so, the Script window closes and nothing even appears in the "projects" folder. Am I doing something wrong? If this means anything, when I try to simply drag-and-drop the apk onto Script.bat, the window appears for just a split second and disappears.

Just a fair warning, I'm a COMPLETE rookie. I cannot emphasize that enough so there might be something completely obvious that I missed.

Anyways, thanks for the help!
[G1 Android Development] drakenabarion:
I must say thank you for this tool. It is very very useful and works nicely. I am able to unpack, modify, repack and sign non system apps which is great.

I am just learning how to work with the Android system, so I am still very inexperienced. But I studied Linux, Java and xml in college so the systems are not completely strange to me.

Whenever I try to change something in a system app, such as the Samsung Keyboard, I am able to repack the apk, and sign it. But when I try to run it on my phone, I get force closures. (Yes i follow the guide for repacking a System apk). At the moment its just to learn about the system. I only tried with the Samsung Keyboard so far.

Any advice on how to get things working?
[G1 Android Development] fernando sor:
The apk can't have spaces in the name
[G1 Android Development] RocknSteve:
Wow. You have no idea how many times I read that without even thinking about it. Thanks!
[G1 Android Development] fernando sor:
Was that the problem?
[G1 Android Development] RocknSteve:
The apk had spaces
[G1 Android Development] roscoenr:
I may be wrong but I thought you were not supposed to sign system apps
[G1 Android Development] fernando sor:
I dont
[G1 Android Development] drakenabarion:
Thanks for the reply.

I actually got it to work. Instead of recompiling as a system apk, I selected no when that option came up, and then everything works now. I guess that option is needed for something like framework-res.apk, but not for the Samsung stock keyboard.
[G1 Android Development] Ichibahn SLC:
How do I use this tool to edit xml files? I'm working on a framework-res.apk and have the files seperated.
[G1 Android Development] fernando sor:
Download notebook ++
[G1 Android Development] KreAch3R:
I will post it here as well, because I think it is basically related with apk manager.:)
[G1 Android Development] fernando sor:
you can easily edit xmls with this tool. so your recompiling with errors?
[G1 Android Development] KreAch3R:
Yes, I decompile the themed framework-res.apk successfully, edit strings.xml, public.xml and add an image, and then when I try to recompile log shows errors and recompiled framework doesn't work.

Sent from my mind using my neurons' telepathetic waves.
[G1 Android Development] scumfromohio:
Would the OP be something I could use if i were trying to edit the apk of the buddies now widget from the samsung fasinate to be usable on the htc incredible? A little bit of a newbie and I've been trying to figure out if this is possible... Thanks in advance..
[G1 Android Development] drakenabarion:
Thanks for the help before.

I have yet another noob question.

I read in this thread that smali.jar and baksmali.jar might be implemented into this app, but are not currently in it.

I just want to double check that at the moment I need to compile any changes to a .smali file separately, right? And whatever output I get, I would name classes.dex and place into the <apkname>/build/apk/ folder.

Sorry if it has been asked before, but I did look through the thread and I didn't find a clear answer for this.

Thanks for your help.
[G1 Android Development] fernando sor:
Check your images they may not have decompiled right.
[G1 Android Development] fernando sor:
There is a smali folder after you decompile
[G1 Android Development] drakenabarion:
Ah yes indeed there is. Sorry for that I need new eyes :o. So any modifications in there get recompiled as I pack everything? That is very very good to hear. :)

Thanks again.
[G1 Android Development] fernando sor:
Yes its a great program
[G1 Android Development] fernando sor:
Your getting the same error.what version of apktool do you have? You want 1.3.1 I believe not 1.3.2
[G1 Android Development] mindnumbinglyfun:
i am so sorry for what i am about to ask. please believe me when i say im not a complete noob..

where do i put this apktool?

also, my apk manager was unzipped to androidsdk/platform-tools. is that correct?
[G1 Android Development] mindnumbinglyfun:
oh and i cant seem to find 1.3.1. all links bring me to 1.3.2?
[G1 Android Development] fernando sor:
Well most people have the folder on the root of their c drive labeled android-sdk-windows if you go to the apktool website you will find it. Choose all down loads. If you can't find it I will post it. There is a folder when you open apkmanager labeled other. it goes in there
[G1 Android Development] roscoenr:
bad link...
[G1 Android Development] fernando sor:
this is the version you want. take apktool.jar out of this zip and place it in other in apkmanager
[G1 Android Development] fernando sor:
sweet donate image. i gota get that. lol
[G1 Android Development] roscoenr:
yeah i think i need to scale it down a bit
[G1 Android Development] fernando sor:
looks like you have errors in your 9pngs.
[G1 Android Development] mindnumbinglyfun:
im sorry, but what the heck does that mean? my phone runs perfectly. how can there be errors in my framework?

also you may want to scroll down through the code a bit. that first part is different (new) than the errors i was getting before, which are down a ways.

i used this program earlier today to successfully de/recompile my framework... i dont understand why when i tried this later doing exactly the same thing, it suddenly wouldnt work.
[G1 Android Development] fernando sor:
You mean it wouldn't decompile?
[G1 Android Development] mindnumbinglyfun:
no, it decompiles fine. it wont recompile.
[G1 Android Development] fernando sor:
do you have the script aapt in your other folder?
[G1 Android Development] fernando sor:
im sorry confused. i thought you couldnt recompile. when did it become so you couldnt? and having errors in your images doesnt mean your phone wont work
[G1 Android Development] fernando sor:
You def have something strange going on with you're. Path. As I said. Should be c:\android-adk-windows\tools
[G1 Android Development] mindnumbinglyfun:
i have aapt.exe in my "other" folder. is that what you mean by script aapt?

the mystery of when i could no longer recompile began earlier today. i had installed apk manager, decompiled my framework-res.apk and edited it. i forgot to do some things (and generally messed up, so i nand restored [giving me a fresh,unedited framework-res, thought it might be worth mentioning]) so i went to do it again.

pulled the file, decompiled, edited, and was unable to compile again. curious, i pulled a fresh framework-res.apk and decompiled it and attempted to recompile it

unedited

. the errors persisted.
[G1 Android Development] Skyllos:
I cant figure out whats wrong. I edit my framework-res.apk trying to theme my popup menu on my cm6.2 rom and I got the menu to look the way i want it to by changing some files in drawable-mdpi and going into styles.xml and changing

<style name="TextAppearance.Widget.IconMenu.Item" parent="@style/TextAppearance.Small">

<item name="textColor">?textColorPrimaryInverse</item>

to

<style name="TextAppearance.Widget.IconMenu.Item" parent="@style/TextAppearance.Small">

<item name="textColor">@color/bright_foreground_dark</item>

to get white text and than changed

verticalDivider">@drawable/divider_vertical_bright

to

verticalDivider">@drawable/divider_vertical_dark

And that got the Vertical divider to show..

The menu looks right and works but the problem is i get FC's on everytime i try to open up settings for things such as widgets, launcher and even phone settings. I have switched the apktool in the other folder out for the 1.3.1 and im still getting the smae problem. What am i doing wrong?
[G1 Android Development] fernando sor:
Yeah its frustrating. Your 9pngs have errors the script said. Post an unedited framework. Apk and ill mess with it tomorrow
[G1 Android Development] mindnumbinglyfun:
yes, there is a reason.

on my old computer, about 6 months or so ago, when i installed the android SDK it was set up like that. ADB was in the folder "tools". when i moved into my other computer and installed the SDK, the folder structure was different. ADB now lives in "platform-tools".

apk manager wont run unless it is in the same folder as ADB, so i put it there.

if it NEEDS to be in "tools", could i simply copy ADB over into there? i think if i go moving my SDK files about, it may cause more problems..
[G1 Android Development] fernando sor:
Why do you have androidsdk in the path in front of android-sdk-windows?
[G1 Android Development] mindnumbinglyfun:
it has become very frustrating.. i really appreciate all the help. if you think you could do something with this it would be great. im feeling pretty burnt out on this.

if you manage to do anything to this, could you please make sure to explain what you did? i like to learn :)
[G1 Android Development] fernando sor:
Yes will look at it tomorrow. What device is this from? And rom?
[G1 Android Development] mindnumbinglyfun:
well um, not sure exactly... i think i remember from 6 months ago that i was to unzip the SDK to C:/AndroidSDK (for simplicity). when i installed the SDK on this computer i did the same. i had read somewhere recently something like, the newer SDK requires it be in the folder android-sdk-windows.. im not really sure. sorry.. i havent had problems until now.

i did go ahead and just place android-sdk-windows right into C:/ and made sure to edit all my PATH and CLASSPATH stuff.
[G1 Android Development] mindnumbinglyfun:
droid eris, nonsensikal (vanillia)
[G1 Android Development] HewGBalls:
Whoever is facing above problem, after battling with it for hours, i have figured out the problem.

The new versions aapt in platform tools refuse to successfully compile an apk, throwing a bunch of errors as stated above. The easier thing to do is copy the aapt from apk manager to android sdk/platform-tools folder.

make sure the right aapt file which is found in apk manager is being used to compile the apk and all is well.
[G1 Android Development] xaueious:
Since apktool handles .9.png files, shouldn't the png optimization tool now decompile with apktool, optpng, and then recompile the apk?
[G1 Android Development] Daneshm90:
I dont think that would still prevent the issue of the .9png's losing their properties due to compression.

Now im not sure but it looks like brut.all found a way to decode the .9 pngs properly with his latest release which allows us to edit them, however when u set your boundaries,.... if u use png optimization on them they tend to loose these properties.

Ill try n see if apktool allows to compile an apk whose .9 pngs were optimized and whether those pngs come out the other end looking the way they should ;)
[G1 Android Development] Brut.all:
@Daneshm90

You have misunderstood problem with these 9patch pngs, but I don't think you could optimize them.

Problem is: both aapt and optipng rebuild png file. If you use optipng and then aapt, then aapt will rebuild png and will probably screw up all optimizations. If you use aapt and then optipng, then optipng will treat 9patch data as some garbage and will remove it for optimization. If there is a switch to optipng to keep some custom chunks, then it should be possible to optimize these files. If not, then still we could write our own tool - not a big problem though.
[G1 Android Development] Brut.all:
I don't see such switch in optipng. I will try to write a tool for 9.png files optimization. Should be easy.
[G1 Android Development] BolecDST:
Thanks man! :)
[G1 Android Development] Daneshm90:
Re: Apk Manager 4.4 - Makes Modifying Ur Apk A Breeze (Windows/Linux)

hmm lookin forward to it. :)

Considerin optipng is opensourced, cudnt u use that n just add a check for .9 pngs ?
[G1 Android Development] Brut.all:
Yeah, good idea, but I really don't like C, so... we'll see ;-)
[G1 Android Development] thatguythatdid:
Well I got it going and don't know much about smali and was gonna use this to kind of learn what I can about smali and java. Anyways this guy found a cool weather widget here and I thought that I could change the name to not be in japanese and also change the native language to english. So I first started off using fancywidget as a test cuz it's all english and I had made my own theme for it. So I changed the name to a certain extent but it still shows up as fancy widget and not naruto widget. Some of the files such as the /data/data show up correctly but the others don't. Also curious as to where the signed apk goes once it's been signed? I couldn't find it and ended up just signing it myself. (Not a problem) Thanks if anyone can give some feedback
[G1 Android Development] Daneshm90:
Well when u decompile using apktool, it goes to the out directory, then u edit the files and when u repackage them it should create a file called repackaged-unsigned.apk in that same *modding* directory you originally place ur apk. When u sign it it shud rename that file to repackaged-signed. If ur file disappears then something went wrong :) Turn logging on and then check what went wrong and where.
[G1 Android Development] BolecDST:
See? I knew it'd be useful :P just kidding heheh. Thanks again, this tool is great, I already modified icons of every system app, so that it suits to my wallpaper, theme on g1 :D
[G1 Android Development] thatguythatdid:
Why do guys need a special tools to edit .9png files? Why not just use gimp it's easier?
[G1 Android Development] Brut.all:
Huh? Did you tried to edit 9.png files in already compiled application? Have luck :-)
[G1 Android Development] thatguythatdid:
Everything works fine till the signing part the apk doesn't disappear it just stays there the same way?
[G1 Android Development] thatguythatdid:
Hell never had a problem we gotta be talking about different things

okay here is a copy of com.htc.resources.apk from the mytouch slide. Just

so we are on the same page as an example inside res/drawable there's a file

called common_main_panel_navbar.9.png is that what you mean because if not

then I'm the one here confused well wrong is a better way to put it
[G1 Android Development] Brut.all:
Do you know, what 9patch images are? They scale differently, not linearly and if you edit them, then probably 9patch will be lost, so they will scale as regular image - linearly.
[G1 Android Development] thatguythatdid:
So we are talking about the same thing? Anyways I came from themeing p2k phones (qa1, w490) and people overcomplicate things. I'm using windows 7 64bit with gimp installed. I use 7zip to extract the file so that I have a folder with an apk and an unzipped apk. I go into the res folder of the unzipped apk open the .9png (or png) with gimp edit it and anything else then save it. then i open the apk as an archive with 7zip put the res folder from the unzipped apk in there and close it. (sometimes sign it you must sign most market apps). Then adb push it to where it goes (/data/app or /system/app or /system/framework) and I've never had a problem

also forgot to mention that the .9png have a bit depth of 32 instead of the normal 8 that a png has

How did I get off the subject? Does anyone know how to change the name of a apk using smali?
[G1 Android Development] Daneshm90:
thatguythatdid: regarding ur script issues, can u download the latest one and see if it has problems finding java ? cuz it seems as though everything else works and it doesnt sign. The latest script will alert u if it doesnt find java.

Regarding this .9 png thing, correct me if im wrong Brut.all cuz u know a WAY lot more ;) Im thinking that thatguythatdid is referring to changing the .9 image and not its boundaries perhaps ? i can confirm that i can also edit .9 png's fine in something like paint, however in photoshop its boundary properties are lost. So what I think Brut.all is referring is that we cannot create new boundaries for a .9 png once its compiled into an apk ? I might be WAY off but its worth a shot ;)

Farmatito: I really hope u consider bringing Recovery manager to linux cuz i got a couple of anxious users :D However if u dont have time i can understand :(
[G1 Android Development] Brut.all:
In compiled 9.png file there are no borders - 9patch data is stored in some custom, binary chunk. PNG format is extensible, that means anyone could add some custom chunks to it and if some program doesn't know them, then it should just ignore them. So this is perfectly ok that Android adds its own chunks of data and other tools still are able to read PNG file.

Problem is: what if some program will try to rewrite a PNG file? It doesn't understand this additional chunk, so it can't generate it. Maybe some programs are smart enough to copy all not known chunks as is, so you could edit a file, modify raster data, but 9patch chunk won't be screwed up/removed. I don't know, will do some tests on a Gimp :-)

@thatguythatdid

8 bits aren't "normal" for PNG. It supports many different formats and I think there are 2 most common of them: 8-bit, palette without alpha channel and 32-bit RGBA.
[G1 Android Development] thatguythatdid:
okay I got you now. See I don't think sometimes of certain aspects. It's just hey I changed that it did what I wanted so I'm done. Hell I'm no where on the level that you two are at. Also gonna download the latest version of apk tool. Might have to redownload jre as well (just did a system restore and don't know what I got right now)

WORkS
[G1 Android Development] Brut.all:
As I thought Gimp removes 9patch chunk when editing a file. I think most of image editors do that.

To see what this is all about I have created simple app with some 9.png file, built it, unpacked, edited 9.png file without doing any changes to it, zipped back and run on a device. You could see results in attached images.
[G1 Android Development] rjhay22:
windows link not working :(
[G1 Android Development] fernando sor:
i decompiled your framework and none of your 9pngs decompiled. is this framework untouched from your rom? you will never recompile with these issues. the above post says he has a fix but my experience is this means the images have already been modified, perhaps poorly, if they do not decompile. also your on 2.1 eclair right? i dont know if that is an issue or if you need an older version. the dev could answer that
[G1 Android Development] Skyllos:
Anyone know how to fix this?
[G1 Android Development] mindnumbinglyfun:
i appreciate the effort. heres the deal with my rom.

it is a cyanogenmod 6.1 based froyo (2.2.1) rom. i always do edit the files in drawable-mdpi. but i had thought this might be causing my issues, so i downloaded an untouched version of the rom and tried the same process with a pristine framework-res.apk only to encounter the same errors.

obviously im no dev and i have a lot to learn, but i am fairly confident in what i know and do and do try hard to learn what i can when i have time.

so now what does my 9png issue mean for my little project? is there any way around this or any way to fix it?
[G1 Android Development] dully79:
You could decompile your froyo rom, replace the 9's with the ones from the platform 8 folder in sdk and recompile. This method worked for me. If I edit any 9's I use eclipse to compile them, then drag and drop them in using 7zip.

Hope this helps.
[G1 Android Development] mindnumbinglyfun:
post removed
[G1 Android Development] dully79:
What are you wanting to do exactly??
[G1 Android Development] mindnumbinglyfun:
wait.. i am on to something..
[G1 Android Development] mindnumbinglyfun:
sorry. idea failed. please disreguard my last two posts.

this all started because i wanted to remove the clock from my lockscreen, and maybe make the lockscreen background transparent..
[G1 Android Development] fernando sor:
You can have a clear lockscreen without using this tool. Also I use hxd to change code.
[G1 Android Development] HewGBalls:
Can finally compile now

As I posted about public.xml errors which turned out to problem with aapt, I am now able to compile finally.

The first thing I did with this tool is unzip framework-res, replace some pngs, zip apk and push to phone and it works wonders.

I am now stuck work compiled framework-res which hangs and reboots phone.

What I'm doing is:

Decompile framework-res

Edit xml files

Compile (no errors)

Push to phone

I have read in earlier posts to delete the resource file, do I remove this from out folder before compiling? This framework has been modified before, it comes from wildpuzzle 2.2 rom.

Do I need to use stock framework?

Please help... Thanks
[G1 Android Development] roscoenr:
When you recompile it asked if it was a system app if you press yes it ask if you want to keep in edited files press yes. there is now a keep folder. go in the folder there you will find the resource file delete it along with everything you edited.