My favorites | Sign in
Project Home Downloads Wiki Issues Source
Search
for
FrameworkFiles  
Instructions on how to manage framework files
Featured, framework, resources, htc
Updated Jun 14, 2010 by Brut.alll

Overview

As you probably know, Android apps use some code and resources that are built into the Android system on your device. Apktool needs these framework files to decode and build apks.

Standard framework is embedded into apktool, so you don't need to do anything for most apk files. But some manufacturers, for example HTC, add their own framework files and use them in system apps. To use apktool against such apps, you must pull framework from a device and install/register it to apktool.

Example

You want to decode HtcContacts.apk from Hero device. If you try to do that, you will get an error message:

$ apktool d HtcContacts.apk 
I: Loading resource table...
I: Decoding resources...
I: Loading resource table from file: /home/brutall/apktool/framework/1.apk
W: Could not decode attr value, using undecoded value instead: ns=android, name=drawable, value=0x02020542
...
W: Could not decode attr value, using undecoded value instead: ns=android, name=icon, value=0x02020520
Can't find framework resources for package of id: 2. You must install proper framework files, see project website for more info.

You must pull HTC resources from your device and install them:

$ apktool if com.htc.resources.apk
I: Framework installed to: /home/brutall/apktool/framework/2.apk

Then:

$ apktool d HtcContacts.apk 
I: Loading resource table...
I: Decoding resources...
I: Loading resource table from file: /home/brutall/apktool/framework/1.apk
I: Loading resource table from file: /home/brutall/apktool/framework/2.apk
I: Copying assets and libs...

Yay, that works :-)

Pulling frameworks

They are usually in /system/framework/ dir, but system maker could move them to other place: e.g. on some custom roms they are in /data/system-framework/ dir (problems with too small system partition, I guess). They are named with some "resources", "res", "framework", etc., for example HTC uses com.htc.resources.apk name. framework-res.apk is usually main Android framework and you probably don't need to install it, because apktool embeds it.

When you find framework file, you could pull it using "adb pull" command or use some file manager app. Also you could look, how apktool has named installed file: usually it should be "2.apk", if it's something different, then this may not be a file, which you are looking for.

Tagging and managing framework files

Frameworks are stored in: $HOME/apktool/framework/<id>-<tag>.apk . They are identified by package id and optionally custom tag. Usually tagging frameworks isn't necessary, but if you work on apps from many different devices and they have incompatible frameworks, you will need some way to easily switch between them.

You could tag frameworks by:

$ apktool if com.htc.resources.apk hero
I: Framework installed to: /home/brutall/apktool/framework/2-hero.apk
$ apktool if com.htc.resources.apk desire
I: Framework installed to: /home/brutall/apktool/framework/2-desire.apk

Then:

$ apktool d -f -t hero HtcContacts.apk 
I: Loading resource table...
I: Decoding resources...
I: Loading resource table from file: /home/brutall/apktool/framework/1.apk
I: Loading resource table from file: /home/brutall/apktool/framework/2-hero.apk
I: Copying assets and libs...
$ apktool d -f -t desire HtcContacts.apk 
I: Loading resource table...
I: Decoding resources...
I: Loading resource table from file: /home/brutall/apktool/framework/1.apk
I: Loading resource table from file: /home/brutall/apktool/framework/2-desire.apk
I: Copying assets and libs...

You don't have to select a tag when building apk - apktool automatically uses same tag, as when decoding.

I think both standard Android and HTC resources are backward compatible so far, so if you often switch between e.g. Magic and Hero, then framework from Hero should work for Magic too - you don't have to tag them, just install one from newer device. But this isn't a rule - all depends on manufacturer decisions. If apktool decode and build an app without any errors, then most probably everything is ok.

Apktool doesn't have an option to remove or rename already installed framework files, but you could manage these files directly - it's easy thing.

Comment by text.and...@gmail.com, Jan 11, 2011

It seems that this is a standalone app. Can I use it as a library in my Android project?

Comment by fadi...@gmail.com, Jan 13, 2011

Hey, thanks for making this app and going through such pains to provide documentation and help.

Comment by chandra....@gmail.com, Jan 18, 2011

hi, i using samsung galaxy 5 (GT-I5500), i try decompile apk and the compile again after little editing. but when istalled i got error: "Application Not Installed". Any solve?

Comment by tonyleeloveyou@gmail.com, Feb 24, 2011

it can't install the framework-res.apk from honeycomb sdk i'm wonding whether it support the structure of honeycomb ? and if not, when will it update ?

Comment by Jwti...@gmail.com, May 3, 2011

cutiyar@cutiyar-laptop:~$ apktool apktool: command not found cutiyar@cutiyar-laptop:~$

what to do?

Comment by lordde...@gmail.com, Jul 4, 2011

./apktool not apktool. only programs located in /sbin/ and /usr/bin are executed in that way. remember to do chmod +x apktool_file

Comment by zhmstar0...@gmail.com, Jul 12, 2011

i am using the sansung's spica-I5700, i can't decode the Settings.apk even i have installed the framework-res.apk,how shall i do ?

Comment by tmd.nb....@gmail.com, Jul 24, 2011

日 鸟语

Comment by sonawane...@gmail.com, Aug 3, 2011

how to identify which framework has been used in an apk, so that we can install corresponding framework before decoding and avoid errors?

Comment by JoshuaPe...@gmail.com, Aug 22, 2011

Hello,

I need to run the jar file directly as www-data user, witch doesn't have a home dir, and therefor can't find the frameworks (~/apktool/frameworks/1.apk).

How do i tell it where to look for the frameworks (instead of in the homedir).

Comment by klzs...@gmail.com, Aug 26, 2011

为什么没有中文···

Comment by hivip...@163.com, Dec 6, 2011

English! Chinese?

Comment by shendawe...@gmail.com, Dec 8, 2011

good

Comment by 59698544...@gmail.com, Jan 18, 2012

呵呵

Comment by chenzhou...@gmail.com, Apr 12, 2012
哪个翻译一下嘛
Comment by brianzz...@gmail.com, Apr 18, 2012

hey, i got an error something like this : http://pastebin.com/G4wzLkTt

can someone help me for this thing? thanks

Comment by inyuonl...@gmail.com, Apr 23, 2012

D:\APKTOOL>apktool d Phone.apk I: Baksmaling... I: Loading resource table... W: Skipping "android" package group I: Decoding resources... I: Loading resource table from file: D:\BACKUP\apktool\framework\1.apk I: Copying assets and libs...

D:\APKTOOL>apktool b Phone 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.BrutExce? ption: could not exec command: [aapt, p, -F, C:\Users\INYU\AppData?\Local\Temp\AP KTOOL4156902389730964592.tmp, -I, D:\BACKUP\apktool\framework\1.apk, -S, D:\APKT OOL\Phone\res, -M, D:\APKTOOL\Phone\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\INYU\AppData?\Local\Temp\APKTOOL4156902389730964592.tmp, -I, D:\BACKUP\apkto ol\framework\1.apk, -S, D:\APKTOOL\Phone\res, -M, D:\APKTOOL\Phone\AndroidManife? st.xml]
at brut.util.OS.exec(Unknown Source) ... 7 more
D:\APKTOOL\Phone\res\values-da\strings.xml:185: error: Multiple substitutions sp ecified in non-positional format; did you mean to add the formatted="false" attr ibute? D:\APKTOOL\Phone\res\values-da\strings.xml:185: error: Unexpected end tag string

D:\APKTOOL\Phone\res\values-es\strings.xml:185: error: Multiple substitutions sp ecified in non-positional format; did you mean to add the formatted="false" attr ibute? D:\APKTOOL\Phone\res\values-es\strings.xml:185: error: Unexpected end tag string

D:\APKTOOL\Phone\res\values-hu\strings.xml:185: error: Multiple substitutions sp ecified in non-positional format; did you mean to add the formatted="false" attr ibute? D:\APKTOOL\Phone\res\values-hu\strings.xml:185: error: Unexpected end tag string

D:\APKTOOL\Phone\res\values-it\strings.xml:188: error: Multiple substitutions sp ecified in non-positional format; did you mean to add the formatted="false" attr ibute? D:\APKTOOL\Phone\res\values-it\strings.xml:188: error: Unexpected end tag string

D:\APKTOOL\Phone\res\values-nb\strings.xml:185: error: Multiple substitutions sp ecified in non-positional format; did you mean to add the formatted="false" attr ibute? D:\APKTOOL\Phone\res\values-nb\strings.xml:185: error: Unexpected end tag string

D:\APKTOOL\Phone\res\values-ru\strings.xml:188: error: Multiple substitutions sp ecified in non-positional format; did you mean to add the formatted="false" attr ibute? D:\APKTOOL\Phone\res\values-ru\strings.xml:188: error: Unexpected end tag string

D:\APKTOOL\Phone\res\values-sv\strings.xml:185: error: Multiple substitutions sp ecified in non-positional format; did you mean to add the formatted="false" attr ibute? D:\APKTOOL\Phone\res\values-sv\strings.xml:185: error: Unexpected end tag string

D:\APKTOOL\Phone\res\values-zh-rTW\strings.xml:186: error: Multiple substitution s specified in non-positional format; did you mean to add the formatted="false" attribute? D:\APKTOOL\Phone\res\values-zh-rTW\strings.xml:186: error: Unexpected end tag st ring

D:\APKTOOL>

how solve ?

Comment by thevpllo...@gmail.com, May 1, 2012

I need help installing the framework from Sony Xperia X10t get this to work. please. I'm a noob so please help in explaining where to put the framework-res.apk on linux(example home directory) then exactly what do i type in the terminal to get this shit to work. I've searched on google and 5 hours later I can'


Sign in to add a comment
Powered by Google Project Hosting