# Rebuilding framework-res.apk after extraction?



## vacaloca (Dec 19, 2011)

Hi all,

I figure this is as close to the correct forum where I can get a decent reply. I'm interested in editing some settings in XML files inside framework-res.apk for the Galaxy Nexus (toro) and repackaging the app. However, apktool errors out upon building the app, and I've Googled to no avail on how to repackage this apk in an automated way or otherwise.

Info: de-odexed 4.0.3 framework-res.apk (from DTs 2.1 ROM)

Any help would be appreciated =)


----------



## poontab (Jun 7, 2011)

Moved to general. Please use development sections for releases only.


----------



## Zaphod-Beeblebrox (Jun 21, 2011)

I had a lot of trouble with APKtool and the 'wrong' aapt.exe. The currently shipping version of aapt.exe that comes with APKtool is outdated. get the one from the most recent Android SDK.
Depending on where/how you set up apktool, you may need to track down all instances of aapt.exe.


----------



## altimax98 (Jul 14, 2011)

If your on windows I prefer apk multi tool.. its like a Swiss army knife of apk management. You need to update both aapt and apktool.bat and apktool.jar if your using that

Sent From Nexi - The Galaxy Nexus


----------



## vacaloca (Dec 19, 2011)

Using the latest apktool (1.4.3), and the latest aapt.exe file from the Google sdk. I extract the contents of the framework-res.apk -- link below, and even without modifying anything from the extracted files, the build fails:

I get no errors extracting the file with the d option.

Link for framework-res.apk file generating errors: http://minus.com/m361nY3f

I looked at the scripts used in the batch file to compile, since I was getting other directory related errors, but the errors below I can't explain. How do I get the apk to build again?
(here foo was framework-res.apk)

```
<br />
C:\dex>java -Xmx512M -jar other/apktool.jar b projects/foo test<br />
W: Could not find sources<br />
I: Checking whether resources has changed...<br />
I: Building resources...<br />
C:\dex\projects\foo\res\values\plurals.xml:79: error: Multiple substitutions specified in non-positional format; did you mean to add the formatted="false" attribute?<br />
C:\dex\projects\foo\res\values\plurals.xml:79: error: Found tag </item> where </plurals> is expected<br />
C:\dex\projects\foo\res\values-af\plurals.xml:79: error: Multiple substitutions specified in non-positional format; did you mean to add the formatted="false" attribute?<br />
C:\dex\projects\foo\res\values-af\plurals.xml:79: error: Found tag </item> where </plurals> is expected<br />
C:\dex\projects\foo\res\values-am\plurals.xml:79: error: Multiple substitutions specified in non-positional format; did you mean to add the formatted="false" attribute?<br />
C:\dex\projects\foo\res\values-am\plurals.xml:79: error: Found tag </item> where </plurals> is expected<br />
C:\dex\projects\foo\res\values-ar\plurals.xml:79: error: Multiple substitutions specified in non-positional format; did you mean to add the formatted="false" attribute?<br />
C:\dex\projects\foo\res\values-ar\plurals.xml:79: error: Found tag </item> where </plurals> is expected<br />
C:\dex\projects\foo\res\values-bg\plurals.xml:79: error: Multiple substitutions specified in non-positional format; did you mean to add the formatted="false" attribute?<br />
C:\dex\projects\foo\res\values-bg\plurals.xml:79: error: Found tag </item> where </plurals> is expected<br />
C:\dex\projects\foo\res\values-ca\plurals.xml:79: error: Multiple substitutions specified in non-positional format; did you mean to add the formatted="false" attribute?<br />
C:\dex\projects\foo\res\values-ca\plurals.xml:79: error: Found tag </item> where </plurals> is expected<br />
C:\dex\projects\foo\res\values-cs\plurals.xml:79: error: Multiple substitutions specified in non-positional format; did you mean to add the formatted="false" attribute?<br />
C:\dex\projects\foo\res\values-cs\plurals.xml:79: error: Found tag </item> where </plurals> is expected<br />
C:\dex\projects\foo\res\values-da\plurals.xml:79: error: Multiple substitutions specified in non-positional format; did you mean to add the formatted="false" attribute?<br />
C:\dex\projects\foo\res\values-da\plurals.xml:79: error: Found tag </item> where </plurals> is expected<br />
C:\dex\projects\foo\res\values-de\plurals.xml:79: error: Multiple substitutions specified in non-positional format; did you mean to add the formatted="false" attribute?<br />
C:\dex\projects\foo\res\values-de\plurals.xml:79: error: Found tag </item> where </plurals> is expected<br />
C:\dex\projects\foo\res\values-el\plurals.xml:79: error: Multiple substitutions specified in non-positional format; did you mean to add the formatted="false" attribute?<br />
C:\dex\projects\foo\res\values-el\plurals.xml:79: error: Found tag </item> where </plurals> is expected<br />
C:\dex\projects\foo\res\values-en-rGB\plurals.xml:79: error: Multiple substitutions specified in non-positional format; did you mean to add the formatted="false" attribute?<br />
C:\dex\projects\foo\res\values-en-rGB\plurals.xml:79: error: Found tag </item> where </plurals> is expected<br />
C:\dex\projects\foo\res\values-es\plurals.xml:79: error: Multiple substitutions specified in non-positional format; did you mean to add the formatted="false" attribute?<br />
C:\dex\projects\foo\res\values-es\plurals.xml:79: error: Found tag </item> where </plurals> is expected<br />
C:\dex\projects\foo\res\values-es-rUS\plurals.xml:79: error: Multiple substitutions specified in non-positional format; did you mean to add the formatted="false" attribute?<br />
C:\dex\projects\foo\res\values-es-rUS\plurals.xml:79: error: Found tag </item> where </plurals> is expected<br />
C:\dex\projects\foo\res\values-fa\plurals.xml:79: error: Multiple substitutions specified in non-positional format; did you mean to add the formatted="false" attribute?<br />
C:\dex\projects\foo\res\values-fa\plurals.xml:79: error: Found tag </item> where </plurals> is expected<br />
C:\dex\projects\foo\res\values-fi\plurals.xml:79: error: Multiple substitutions specified in non-positional format; did you mean to add the formatted="false" attribute?<br />
C:\dex\projects\foo\res\values-fi\plurals.xml:79: error: Found tag </item> where </plurals> is expected<br />
C:\dex\projects\foo\res\values-fr\plurals.xml:79: error: Multiple substitutions specified in non-positional format; did you mean to add the formatted="false" attribute?<br />
C:\dex\projects\foo\res\values-fr\plurals.xml:79: error: Found tag </item> where </plurals> is expected<br />
C:\dex\projects\foo\res\values-hi\plurals.xml:79: error: Multiple substitutions specified in non-positional format; did you mean to add the formatted="false" attribute?<br />
C:\dex\projects\foo\res\values-hi\plurals.xml:79: error: Found tag </item> where </plurals> is expected<br />
C:\dex\projects\foo\res\values-hr\plurals.xml:79: error: Multiple substitutions specified in non-positional format; did you mean to add the formatted="false" attribute?<br />
C:\dex\projects\foo\res\values-hr\plurals.xml:79: error: Found tag </item> where </plurals> is expected<br />
C:\dex\projects\foo\res\values-hu\plurals.xml:79: error: Multiple substitutions specified in non-positional format; did you mean to add the formatted="false" attribute?<br />
C:\dex\projects\foo\res\values-hu\plurals.xml:79: error: Found tag </item> where </plurals> is expected<br />
C:\dex\projects\foo\res\values-in\plurals.xml:79: error: Multiple substitutions specified in non-positional format; did you mean to add the formatted="false" attribute?<br />
C:\dex\projects\foo\res\values-in\plurals.xml:79: error: Found tag </item> where </plurals> is expected<br />
C:\dex\projects\foo\res\values-it\plurals.xml:79: error: Multiple substitutions specified in non-positional format; did you mean to add the formatted="false" attribute?<br />
C:\dex\projects\foo\res\values-it\plurals.xml:79: error: Found tag </item> where </plurals> is expected<br />
C:\dex\projects\foo\res\values-iw\plurals.xml:79: error: Multiple substitutions specified in non-positional format; did you mean to add the formatted="false" attribute?<br />
C:\dex\projects\foo\res\values-iw\plurals.xml:79: error: Found tag </item> where </plurals> is expected<br />
C:\dex\projects\foo\res\values-ja\plurals.xml:79: error: Multiple substitutions specified in non-positional format; did you mean to add the formatted="false" attribute?<br />
C:\dex\projects\foo\res\values-ja\plurals.xml:79: error: Found tag </item> where </plurals> is expected<br />
C:\dex\projects\foo\res\values-ko\plurals.xml:79: error: Multiple substitutions specified in non-positional format; did you mean to add the formatted="false" attribute?<br />
C:\dex\projects\foo\res\values-ko\plurals.xml:79: error: Found tag </item> where </plurals> is expected<br />
C:\dex\projects\foo\res\values-lt\plurals.xml:79: error: Multiple substitutions specified in non-positional format; did you mean to add the formatted="false" attribute?<br />
C:\dex\projects\foo\res\values-lt\plurals.xml:79: error: Found tag </item> where </plurals> is expected<br />
C:\dex\projects\foo\res\values-lv\plurals.xml:79: error: Multiple substitutions specified in non-positional format; did you mean to add the formatted="false" attribute?<br />
C:\dex\projects\foo\res\values-lv\plurals.xml:79: error: Found tag </item> where </plurals> is expected<br />
C:\dex\projects\foo\res\values-ms\plurals.xml:79: error: Multiple substitutions specified in non-positional format; did you mean to add the formatted="false" attribute?<br />
C:\dex\projects\foo\res\values-ms\plurals.xml:79: error: Found tag </item> where </plurals> is expected<br />
C:\dex\projects\foo\res\values-nb\plurals.xml:79: error: Multiple substitutions specified in non-positional format; did you mean to add the formatted="false" attribute?<br />
C:\dex\projects\foo\res\values-nb\plurals.xml:79: error: Found tag </item> where </plurals> is expected<br />
C:\dex\projects\foo\res\values-nl\plurals.xml:79: error: Multiple substitutions specified in non-positional format; did you mean to add the formatted="false" attribute?<br />
C:\dex\projects\foo\res\values-nl\plurals.xml:79: error: Found tag </item> where </plurals> is expected<br />
C:\dex\projects\foo\res\values-pl\plurals.xml:79: error: Multiple substitutions specified in non-positional format; did you mean to add the formatted="false" attribute?<br />
C:\dex\projects\foo\res\values-pl\pluException in thread "main" [URL=rals.xml:79]rals.xml:79[/URL]: error: Found tag </item> where </plurals> is expected<br />
C:\dex\projects\foo\res\values-pt\plurals.xml:79: error: Multiple substitutions specified in non-positional format; did you mean to add the formatted="false" attribute?<br />
C:\dex\projects\foo\res\values-pt\plurals.xml:79: error: Found tag </item> where </plurals> is expected<br />
C:\dex\projects\foo\res\values-pt-rPT\plurals.xml:79: error: Multiple substitutions specified in non-positional format; did you mean to add the formatted="false" attribute?<br />
C:\dex\projects\foo\res\values-pt-rPT\plurals.xml:79: error: Found tag </item> where </plurals> is expected<br />
C:\dex\projects\foo\res\values-ro\plurals.xml:79: error: Multiple substitutions specified in non-positional format; did you mean to add the formatted="false" attribute?<br />
C:\dex\projects\foo\res\values-ro\plurals.xml:79: error: Found tag </item> where </plurals> is expected<br />
C:\dex\projects\foo\res\values-ru\plurals.xml:79: error: Multiple substitutions specified in non-positional format; did you mean to add the formatted="false" attribute?<br />
C:\dex\projects\foo\res\values-ru\plurals.xml:79: error: Found tag </item> where </plurals> is expected<br />
C:\dex\projects\foo\res\values-sk\plurals.xml:79: error: Multiple substitutions specified in non-positional format; did you mean to add the formatted="false" attribute?<br />
C:\dex\projects\foo\res\values-sk\plurals.xml:79: error: Found tag </item> where </plurals> is expected<br />
C:\dex\projects\foo\res\values-sl\plurals.xml:79: error: Multiple substitutions specified in non-positional format; did you mean to add the formatted="false" attribute?<br />
C:\dex\projects\foo\res\values-sl\plurals.xml:79: error: Found tag </item> where </plurals> is expected<br />
C:\dex\projects\foo\res\values-sr\plurals.xml:79: error: Multiple substitutions specified in non-positional format; did you mean to add the formatted="false" attribute?<br />
C:\dex\projects\foo\res\values-sr\plurals.xml:79: error: Found tag </item> where </plurals> is expected<br />
C:\dex\projects\foo\res\values-sv\plurals.xml:79: error: Multiple substitutions specified in non-positional format; did you mean to add the formatted="false" attribute?<br />
C:\dex\projects\foo\res\values-sv\plurals.xml:79: error: Found tag </item> where </plurals> is expected<br />
C:\dex\projects\foo\res\values-sw\plurals.xml:79: error: Multiple substitutions specified in non-positional format; did you mean to add the formatted="false" attribute?<br />
C:\dex\projects\foo\res\values-sw\plurals.xml:79: error: Found tag </item> where </plurals> is expected<br />
C:\dex\projects\foo\res\values-th\plurals.xml:79: error: Multiple substitutions specified in non-positional format; did you mean to add the formatted="false" attribute?<br />
C:\dex\projects\foo\res\values-th\plurals.xml:79: error: Found tag </item> where </plurals> is expected<br />
C:\dex\projects\foo\res\values-tl\plurals.xml:79: error: Multiple substitutions specified in non-positional format; did you mean to add the formatted="false" attribute?<br />
C:\dex\projects\foo\res\values-tl\plurals.xml:79: error: Found tag </item> where </plurals> is expected<br />
C:\dex\projects\foo\res\values-tr\plurals.xml:79: error: Multiple substitutions specified in non-positional format; did you mean to add the formatted="false" attribute?<br />
C:\dex\projects\foo\res\values-tr\plurals.xml:79: error: Found tag </item> where </plurals> is expected<br />
C:\dex\projects\foo\res\values-uk\plurals.xml:79: error: Multiple substitutions specified in non-positional format; did you mean to add the formatted="false" attribute?<br />
C:\dex\projects\foo\res\values-uk\plurals.xml:79: error: Found tag </item> where </plurals> is expected<br />
C:\dex\projects\foo\res\values-vi\plurals.xml:79: error: Multiple substitutions specified in non-positional format; did you mean to add the formatted="false" attribute?<br />
C:\dex\projects\foo\res\values-vi\plurals.xml:79: error: Found tag </item> where </plurals> is expected<br />
C:\dex\projects\foo\res\values-zh-rCN\plurals.xml:79: error: Multiple substitutions specified in non-positional format; did you mean to add the formatted="false" attribute?<br />
C:\dex\projects\foo\res\values-zh-rCN\plurals.xml:79: error: Found tag </item> where </plurals> is expected<br />
C:\dex\projects\foo\res\values-zh-rTW\plurals.xml:79: error: Multiple substitutions specified in non-positional format; did you mean to add the formatted="false" attribute?<br />
C:\dex\projects\foo\res\values-zh-rTW\plurals.xml:79: error: Found tag </item> where </plurals> is expected<br />
C:\dex\projects\foo\res\values-zu\plurals.xml:79: error: Multiple substitutions specified in non-positional format; did you mean to add the formatted="false" attribute?<br />
C:\dex\projects\foo\res\values-zu\plurals.xml:79: error: Found tag </item> where </plurals> is expected<br />
brut.androlib.AndrolibException: brut.common.BrutException: could not exec command: [aapt, p, -F, C:\Windows\Temp\APKTOOL2346818939340239273.tmp, -x, -S, C:\dex\projects\foo\res, -<br />
M, C:\dex\projects\foo\AndroidManifest.xml]<br />
		at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.java:193)<br />
		at brut.androlib.Androlib.buildResourcesFull(Androlib.java:301)<br />
		at brut.androlib.Androlib.buildResources(Androlib.java:248)<br />
		at brut.androlib.Androlib.build(Androlib.java:171)<br />
		at brut.androlib.Androlib.build(Androlib.java:154)<br />
		at brut.apktool.Main.cmdBuild(Main.java:182)<br />
		at brut.apktool.Main.main(Main.java:67)<br />
Caused by: brut.common.BrutException: could not exec command: [aapt, p, -F, C:\Windows\Temp\APKTOOL2346818939340239273.tmp, -x, -S, C:\dex\projects\foo\res, -M, C:\dex\projects\foo<br />
\AndroidManifest.xml]<br />
		at brut.util.OS.exec(OS.java:83)<br />
		at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.java:191)<br />
		... 6 more<br />
```


----------



## bp328i (Jul 22, 2011)

I have a different problem with the framework-res.apk. I have been able to decompile and recompile without errors but the recompilied app always makes my lock screen app drawer and setting look like it is a tablet.

I did find where someone else said something about two extra folders folders, drawable-xhdpi-v13 and layout-v13.

When I use 7-zip and open the un-decompiled app these folders are hidden just like all the values folders. Now when I edit any xml and delete the resources.arsc file when it recompiles these two folders are no longer hidden.


----------



## skylordusa1 (Dec 21, 2011)

Is apktool the only thing we can use now for ICS to compile and decompile apks. I used to use apk manager for the og droid and didn't have any problems compiling. Tried using apk manager with a few apks from droid theorys 4.0.3 ICS rom but it was erroring out. Are there any videos/tutorials on how to use apktool? I downloaded it and it seems to spit out the help menu when I open cmd and type apktool. But not to sure where to go from there. I really liked apk manager because it was easy to use. Any help would be appreciated.


----------



## Snow02 (Jun 14, 2011)

skylordusa1 said:


> Is apktool the only thing we can use now for ICS to compile and decompile apks. I used to use apk manager for the og droid and didn't have any problems compiling. Tried using apk manager with a few apks from droid theorys 4.0.3 ICS rom but it was erroring out. Are there any videos/tutorials on how to use apktool? I downloaded it and it seems to spit out the help menu when I open cmd and type apktool. But not to sure where to go from there. I really liked apk manager because it was easy to use. Any help would be appreciated.


-Grab latest apktool package.
-Overwrite aapt.exe with the one from an updated sdk installation.
-Pull framework-res.apk into the folder.
-Type
apktool if framework-res.apk
-This installs the framework.
-Then pull the apk you want to decompile. Let's say systemui.
-Type
apktool d SystemUI.apk
-This will decompile it, loading the framework you just installed.
-To recompile, type
apktool b SystemUI
(note the omission of .apk)
-Now open the compiled apk (now in SystemUI/dist) and copy out what you changed (typically a layout xml and/or resources.arsc, classes.dex if you edited smali), and overwrite it in the original. This is done to maintain the system signature. 
-Push the apk, or load it in a flashable zip.


----------



## skylordusa1 (Dec 21, 2011)

Thanks a lot snow. I appreciate it. I will give it a shot. Just to confirm. I just need to put the framwework-res.apk in the same place apktool is. And also the other apks. Before running the commands? It will decompile/compile them right there in the same folder?


----------



## Snow02 (Jun 14, 2011)

skylordusa1 said:


> Thanks a lot snow. I appreciate it. I will give it a shot. Just to confirm. I just need to put the framwework-res.apk in the same place apktool is. And also the other apks. Before running the commands? It will decompile/compile them right there in the same folder?


Correct. In the folder you should have aapt.exe, apktool.bat, and apktool.jar. Then whatever apks you pulled.


----------



## bp328i (Jul 22, 2011)

Snow02 said:


> -Grab latest apktool package.
> -Overwrite aapt.exe with the one from an updated sdk installation.
> -Pull framework-res.apk into the folder.
> -Type
> ...


Could you tell me why I'm getting the error on the attched log? All I'm doing is decompiling the framework-res.apk changing one color in an xml and recompiling.


----------



## skylordusa1 (Dec 21, 2011)

Ok awesome. Sorry to be a pain Snow. Just remembered that I read somewhere think on xda that the latest apktool had the framework already built in so we didnt have to do the apktool if framework-res.apk anymore. You know anything about that? Is it still needed? I have no problem doing it just thought I saw some people running into issues when they did with the newest apktool. The reason I ask is because I took the SystemUI.apk and put it in the folder with apktool. I ran the apktool d SystemUI.apk. and it seems to work ok. I see the SystemUI folder now with alot of the decompiled stuff. But the output in cmd looks a little strange so im wondering if this is normal or if it is because I didnt run the install framework.

Here is some of the output there was some more of these same lines.

I: Baksmaling...
testI: Loading resource table...
I: Loaded.
I: Loading resource table from file: C:\Users\cdogg\apktool\framework\1.apk
I: Loaded.
W: Could not decode attr value, using undecoded value instead: ns=android, name=
hardwareAccelerated, value=0xffffffff
W: Could not decode attr value, using undecoded value instead: ns=android, name=
label, value=0x01040404
W: Could not decode attr value, using undecoded value instead: ns=android, name=
theme, value=0x010302ee
W: Could not decode attr value, using undecoded value instead: ns=android, name=
theme, value=0x010302fc
W: Could not decode attr value, using undecoded value instead: ns=android, name=
theme, value=0x010302fc
W: Could not decode attr value, using undecoded value instead: ns=android, name=
theme, value=0x010302fc
W: Could not decode attr value, using undecoded value instead: ns=android, name=
theme, value=0x010302fc
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=
opacity, value=0xfffffffd
W: Could not decode attr value, using undecoded value instead: ns=android, name=
drawable, value=0x010804b6
W: Could not decode attr value, using undecoded value instead: ns=android, name=
drawable, value=0x010804b6
W: Could not decode attr value, using undecoded value instead: ns=android, name=
drawable, value=0x010804b6

Here is the end of the output

I: Decoding values*/* XMLs...
Exception in thread "main" brut.androlib.err.UndefinedResObject: resource spec:
0x010301e9
at brut.androlib.res.data.ResPackage.getResSpec(ResPackage.java:61)
at brut.androlib.res.data.ResTable.getResSpec(ResTable.java:55)
at brut.androlib.res.data.ResTable.getResSpec(ResTable.java:51)
at brut.androlib.res.data.value.ResReferenceValue.getReferent(ResReferen
ceValue.java:59)
at brut.androlib.res.data.value.ResReferenceValue.encodeAsResXml(ResRefe
renceValue.java:46)
at brut.androlib.res.data.value.ResScalarValue.encodeAsResXmlAttr(ResSca
larValue.java:43)
at brut.androlib.res.data.value.ResStyleValue.serializeToResValuesXml(Re
sStyleValue.java:48)
at brut.androlib.res.AndrolibResources.generateValuesFile(AndrolibResour
ces.java:264)
at brut.androlib.res.AndrolibResources.decode(AndrolibResources.java:137
)
at brut.androlib.Androlib.decodeResourcesFull(Androlib.java:93)
at brut.androlib.ApkDecoder.decode(ApkDecoder.java:98)
at brut.apktool.Main.cmdDecode(Main.java:128)
at brut.apktool.Main.main(Main.java:65)


----------



## Snow02 (Jun 14, 2011)

skylordusa1 said:


> Ok awesome. Sorry to be a pain Snow. Just remembered that I read somewhere think on xda that the latest apktool had the framework already built in so we didnt have to do the apktool if framework-res.apk anymore. You know anything about that? Is it still needed? I have no problem doing it just thought I saw some people running into issues when they did with the newest apktool. The reason I ask is because I took the SystemUI.apk and put it in the folder with apktool. I ran the apktool d SystemUI.apk. and it seems to work ok. I see the SystemUI folder now with alot of the decompiled stuff. But the output in cmd looks a little strange so im wondering if this is normal or if it is because I didnt run the install framework.
> 
> Here is some of the output there was some more of these same lines.
> 
> ...


SystemUI should compile without error following my instructions. If it's not, you didn't follow them completely.


----------



## Snow02 (Jun 14, 2011)

bp328i said:


> Could you tell me why I'm getting the error on the attched log? All I'm doing is decompiling the framework-res.apk changing one color in an xml and recompiling.


Apktool still has some issues handling some formatting issues (some qualifier it looks like here). It's a known problem, and is being addressed. You'll have to manually fix those xmls. Sorry, I can't tell you how. But give it a day or two and this specific error will likely be addressed in an updated apktool.


----------



## skylordusa1 (Dec 21, 2011)

Snow02 said:


> SystemUI should compile without error following my instructions. If it's not, you didn't follow them completely.


Oh ok. I went ahead and did the apktool if framework-res.apk and was able to decompile and recompile the SystemUI.apk without any errors. You are the friggin man hahahhahaa. Just a few last questions and I will not bother you anymore. Do you have to run the install framework everytime you are going to decompile an apk? Or because I did it once already I no longer have to do it? Also now that the apk was compiled and built out in the dist folder. I see you said copy out what I edited and put it in the original apk. Since I dont know how to edit smali I only make a few edits to the xml files like a few in the values folder. But once the apk is compiled you no longer see those files anymore to copy out and bring to the original. So if I am only editing xml files while decompiled then once I compile I should only need to copy the resources.arsc and bring that over to the original? I really appreciate all your help man.


----------



## Snow02 (Jun 14, 2011)

skylordusa1 said:


> Oh ok. I went ahead and did the apktool if framework-res.apk and was able to decompile and recompile the SystemUI.apk without any errors. You are the friggin man hahahhahaa. Just a few last questions and I will not bother you anymore. Do you have to run the install framework everytime you are going to decompile an apk? Or because I did it once already I no longer have to do it? Also now that the apk was compiled and built out in the dist folder. I see you said copy out what I edited and put it in the original apk. Since I dont know how to edit smali I only make a few edits to the xml files like a few in the values folder. But once the apk is compiled you no longer see those files anymore to copy out and bring to the original. So if I am only editing xml files while decompiled then once I compile I should only need to copy the resources.arsc and bring that over to the original? I really appreciate all your help man.


Correct. Any xml you edited that's not present in the compiled apk will be in the resources.arsc.

And you do not need to reinstall the framework unless modding a different rom.


----------



## vacaloca (Dec 19, 2011)

Since this thread derailed. the OP would still like some insight on his problem =) Surely it has to be something simple... but I see no out of place syntax in plurals.xml.
Is there a manual way to recompile the apk myself since the tool appears to be broken? I'm all ears on this one.


----------



## skylordusa1 (Dec 21, 2011)

Hey Vacaloca,

Sorry about your thread being derailed. But Im real happy you started this thread cause Snow helped me out to get back to where I needed to be for theming. So thank you and Thank you Snow for all the help.
Not sure if you saw what Snow wrote above but it seems apktool has been having some trouble with decompiling or compiling the framework-res.apk. He said it is a known issue and being worked on so will probably
be resolved soon.

Im not sure if you ever used Apk Manager but it seems that the last one that was put out works with the framework-res.apk. I just tried it and was able to decompile and recompile the framework-res.apk with out any errors.
I havent tried to flash it or install it yet to see if it will bootup but there are no errors so that is a good thing. Most likely will work. Give it a shot.

If you never used it before you just need to create a folder somewhere in your androidsdk path. then extract the zip in it. Put the framework-res.apk in the place-here-for-modding folder. then run the script.bat. Hit 9 for decompile then your decompiled apk will be in the projects folder. make your edits there. then open the script back up and hit 10 to compile. once done you will see the newly built framework-res.apk in the place-here-for-modding folder it will now be called unsignedframework-res.apk. Since it is a system app it doesnt need to be signed so just rename it from unsignedframework-res.apk to framework-res.apk and you should be all set. Flash it and see if it works. If you know all this already im sorry. Just excited to get into theming again. Let me know how it works out for you. Im just gonna use apktool for the other apps and apk manager 5.0.2 for the framework for now until the issues with apktool/framework get resolved.

I attached the tool for you. Not sure if im allowed to post other threads for other sites here but if you want to read the thread about it. Just google apkmanager 5 and you should see the xda link pop up.

Update: Ok actually it didnt let me attach file was to big. So here is the link to xda for the download http://forum.xda-developers.com/showthread.php?t=1227179


----------



## Snow02 (Jun 14, 2011)

I got it to compile and it works. Just add a % in front of the second %d in each plurals.xml that errors out.


----------



## ArrTooDeeToo (Dec 31, 2011)

I'm having the exact same problem. I posted the question on XDA, but it seems to have gone ignored (Do devs actually read the Q&A forum? lol)

I'm working with a stock 4.02 framework-res.apk. I have the latest SDK and aapt with framework isntalled. I can decomp, but I get the exact same errors as listed in bp388i's log above when attempting to recomp the apk, even without editing anything.


----------



## bp328i (Jul 22, 2011)

Snow02 said:


> I got it to compile and it works. Just add a % in front of the second %d in each plurals.xml that errors out.


I could kiss you right now (not really but that's how happy I am)!!! It worked!!!

Now it's time to get going on some themes!!!


----------



## Snow02 (Jun 14, 2011)

bp328i said:


> I could kiss you right now (not really but that's how happy I am)!!! It worked!!!
> 
> Now it's time to get going on some themes!!!


Heh. My pleasure. Glad I could do my part to get the ball rolling.


----------



## bp328i (Jul 22, 2011)

Snow02 said:


> Heh. My pleasure. Glad I could do my part to get the ball rolling.


I'm going to put you at 100 Thanks right now!


----------



## ArrTooDeeToo (Dec 31, 2011)

Snow02 said:


> I got it to compile and it works. Just add a % in front of the second %d in each plurals.xml that errors out.


That didn't seem to work for me. Let me make sure I'm reading what you wrote correctly.

Should it look like this:


```
<?xml version="1.0" encoding="utf-8"?><br />
<resources><br />
	<plurals name="num_seconds_ago"><br />
		<item quantity="other">%d seconds ago</item><br />
		<item quantity="one">1 second ago</item><br />
	</plurals><br />
	<plurals name="num_minutes_ago"><br />
		<item quantity="other">%%d minutes ago</item><br />
		<item quantity="one">1 minute ago</item><br />
	</plurals><br />
<br />
etc...
```
?


----------



## Snow02 (Jun 14, 2011)

ArrTooDeeToo said:


> That didn't seem to work for me. Let me make sure I'm reading what you wrote correctly.Should it look like this:
> 
> ```
> %d seconds ago		1 second ago				%%d minutes ago		1 minute ago	etc...
> ...


No. The error is on line 79. That's not line 79. You're using notepad, aren't you?


----------



## ArrTooDeeToo (Dec 31, 2011)

Snow02 said:


> No. The error is on line 79. That's not line 79. You're using notepad, aren't you?


Ah, stupid me. I read this...



Snow02 said:


> "Just add a % in front of the *second %d* in each plurals.xml that errors out.


Can you see how that would confuse?


----------



## Snow02 (Jun 14, 2011)

ArrTooDeeToo said:


> Ah, stupid me. I read this...
> 
> Can you see how that would confuse?


Not really. The error messages specify on which line the error is.


----------



## ArrTooDeeToo (Dec 31, 2011)

<----- n00b.









Also, it worked. Thanks


----------

