Recompiling .xml files - Hero, G2 Touch Android Development

Hey all, have yet another question. Is it possible to recompile xml files that have been decompiled using AXMLPrinter2? I tried to use aapt but it wouldn't work (got a lot of 'no resource identifier found for ...' errors).
Thanks.

u can't recompile xml pre-compiled files.
M

...
Try apktool.

Related

[Q] *Solved* Obtaining Resource ID's

Question for all the themers out there. What's the easiest method to get the resource ID for a png you've just created for say com.htc.resources.apk? Also is there a way do get the Resource ID's for multiple images in the same directory ie. com.htc.resources.apk /drawable-hdpi?
There's a few methods floating around that I've checked out but I figured I'd ask individuals that have probably refined this process.
Thanks...Lou
EDIT: I found this method to work and it saves you from having to look up all of the resource ID's separately and manually update the public.xml file....
For example if you open com.htc.resources.apk with an archive manager like 7zip for windows or archive manager if you're using linux and drop in your edited png's then use apktool to decompile the framework it should create all of the resource ID's in the public.xml file for you. At this point if you have any xml edits or smali edits to do complete those then recompile. Now just extract the "res" folder and the "resources" files from the compiled apk and using the same archive manager from above to open the original com.htc.resources.apk and replace the files you should be good to go.

[Q] Modify/View XML

Sorry for my english.
I using SGS2 with stock firmware 4.0.3 no brand XXLPF, i unzipped the file SystemUI.apk but I can not read xml file.
I am using linux (gedit, vim) and windows (notepad++) and is impossible to change them seem encoded.
thanks
You need to decompile the apk and then the xml's will be readable and editable with notepad++
There's lots of threads with info but here's a good place to start http://forum.xda-developers.com/showthread.php?t=1433053

[Q] Converting readable .xml to human unreadable android .xml

Hi!
I have not found any answers from Google so I'm going to post it here and those who can answer Thank You!
I can't recompile some apps that is secured or something like that..
I have modified Dolphin browser Beta's xml files to support Flash player on Jelly Bean but I can't make .xml files to human unreadable like how them are in the app packages.
Code:
/res/xml/webcontent_prefences.xml
default value from ON-DEMaND to true
deleted: dolphin:entries="@array/pref_plugin_state_choices" dolphin:entryValues="@array/pref_plugin_state_values"
/res/xml/browser_prefences.xml
added: <mobi.mgeek.preference.FlashPlayerPreference dolphin:key="plugin_state" dolphin:title="@string/pref_content_plugins" dolphin:defaultValue="true" dolphin:background="@drawable/settings_bg_middle_bk" />
Please help me if you know how to do that..
I have tried to compile another apk with those files but then it will fail compiling the APK and I have no idea what to do and how to do!
hmmmm... i am not programmer that makes applications , but as far as i know , XML files in APK is only for layout or resources , am i correct ?
if you wanna make your browser support flash , seems it doesn't have anything to do with XML files.
and usually , shouldn't you decompile the APK files first , and then modify , and recompile after all ???
in any case , it should be APK/XML human unreadable files ----(decompile)---> human readable and modify ---(recompile)---> unreadable again.
I'm not exactly sure what the command is but I believe aapt (from the Android SDK) is your best bet. Either that or something like APKTool or FJ-APKTools so that you can just 'decompile' it and replace whatever files you need (human-readable XML that is) and then repackage/'compile' it all up again.
Unlawful said:
I'm not exactly sure what the command is but I believe aapt (from the Android SDK) is your best bet. Either that or something like APKTool or FJ-APKTools so that you can just 'decompile' it and replace whatever files you need (human-readable XML that is) and then repackage/'compile' it all up again.
Click to expand...
Click to collapse
I have used APKtool and FJ-APKtools and no luck with those, so that's why I need to do it manually somehow..
I read from internet that somehow can do something to .xml file via aapt but I don't think it could be able to convert the .xml to human unreadable .xml

Editing Settings.apk

im trying to edit the settings.apk to add/remove entries from it.
My question is, can this be done through decompiling the apk and editing xmls, or do i need to edit the source code/java files?

Apktool error when compiling

I issue the following command to decompile the apk:
Code:
apktool d framework-res.apk
I make a the following edits in the file res/values/dimens.xml:
Code:
<dimen name="thumbnail_height">[COLOR="Red"]240.0dip[/COLOR]</dimen>
<dimen name="thumbnail_width">[COLOR="Red"]151.0dip[/COLOR]</dimen>
I issue the following command to recompile the apk:
Code:
apktool b framework-res.apk
Then I get the following error:
Exception in thread "main" brut.androlib.AndrolibException: brut.directory.PathN
otExist: apktool.yml
at brut.androlib.Androlib.readMetaFile(Androlib.java:164)
at brut.androlib.Androlib.build(Androlib.java:183)
at brut.androlib.Androlib.build(Androlib.java:176)
at brut.apktool.Main.cmdBuild(Main.java:228)
at brut.apktool.Main.main(Main.java:79)
Caused by: brut.directory.PathNotExist: apktool.yml
at brut.directory.AbstractDirectory.getFileInput(AbstractDirectory.java:
103)
at brut.androlib.Androlib.readMetaFile(Androlib.java:160)
... 4 more
Other information:
Java version: Version 7 Update 25
Apktool version: 1.5.2
OS: Windows
Tool used: Command Prompt (cmd.exe)
Someone please help. This is really getting on my nerves. Thanks.
EDIT: Sorry guys!
I just fixed it.
Instead of issuing the command:
Code:
apktool b framework-res.apk
I issued:
Code:
apktool b framework-res
All I had to do do was remove apk from the command.
It ended up in the folder named dist.
I'll leave this thread so it can help others.
I'm having the exact same problem at the moment while trying to edit the Androidmanifest.xml file.
I'll try this solution now and edit this post saying whether it works for me or not :thumbup:
Edit: This did work for me :thumbup: However I then came across another error (which I think was due to how I modified the APK)
Sent from my R800i using xda app-developers app
In fact, if you read the error carefully, you see that a file is missing : apktool.yml. This file is created by apktool each time you decompile an apk. It contains the Android version, the framework path, etc... But if you have a wrong framework installed, apktool will stop and won't create this file, so it won't be able to read the correct informations to recompile
Most of the errors with apktool come with a wrong use, a wrong version or something of that type, very few of them come from a problem of compilator (unless you mod a lot the smali files and all).
izi501 said:
In fact, if you read the error carefully, you see that a file is missing : apktool.yml. This file is created by apktool each time you decompile an apk. It contains the Android version, the framework path, etc... But if you have a wrong framework installed, apktool will stop and won't create this file, so it won't be able to read the correct informations to recompile
Most of the errors with apktool come with a wrong use, a wrong version or something of that type, very few of them come from a problem of compilator (unless you mod a lot the smali files and all).
Click to expand...
Click to collapse
No. The apktool file was missing because I tried to compile the apk within itself. The apktool file wasn't originally in the apk. Instead of compiling from the original apk you need to compile from the folder which contains apktool.yml. That's why I took the .apk extension out of the command.
thehacka1 said:
No. The apktool file was missing because I tried to compile the apk within itself. The apktool file wasn't originally in the apk. Instead of compiling from the original apk you need to compile from the folder which contains apktool.yml. That's why I took the .apk extension out of the command.
Click to expand...
Click to collapse
Hmm yes of course ! Sorry I didn't read your post carefully enough

Categories

Resources