Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I can't compile framework-res.apk (sdk 17) #441

Closed
GoogleCodeExporter opened this issue Mar 18, 2015 · 34 comments
Closed

I can't compile framework-res.apk (sdk 17) #441

GoogleCodeExporter opened this issue Mar 18, 2015 · 34 comments

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
1. apktool d framework-res.apk
2. apktool b framework-res framework-res.apk

What is the expected output? What do you see instead?
W: Could not find sources
I: Checking whether resources has changed...
I: Building resources...
aapt: warning: string 'default_audio_route_name_hdmi' has no default 
translation in /home/tito/framework-res/res; found: en_GB es
aapt: warning: string 'default_permission_group' has no default translation in 
/home/tito/framework-res/res; found: en_GB es
aapt: warning: string 'perms_hide' has no default translation in 
/home/tito/framework-res/res; found: en_GB es
aapt: warning: string 'perms_show_all' has no default translation in 
/home/tito/framework-res/res; found: en_GB es
/home/tito/framework-res/res/layout/keyguard_screen_password_landscape.xml:22: 
error: Error: No resource found that matches the given name (at 'layout' with 
value '@layout/keyguard_transport_control').
/home/tito/framework-res/res/layout/keyguard_screen_password_portrait.xml:22: 
error: Error: No resource found that matches the given name (at 'layout' with 
value '@layout/keyguard_transport_control').
/home/tito/framework-res/res/layout/keyguard_screen_tab_unlock.xml:23: error: 
Error: No resource found that matches the given name (at 'layout' with value 
'@layout/keyguard_transport_control').
/home/tito/framework-res/res/layout/keyguard_screen_tab_unlock_land.xml:17: 
error: Error: No resource found that matches the given name (at 'layout' with 
value '@layout/keyguard_transport_control').
/home/tito/framework-res/res/layout/keyguard_screen_unlock_landscape.xml:18: 
error: Error: No resource found that matches the given name (at 'layout' with 
value '@layout/keyguard_transport_control').
/home/tito/framework-res/res/layout/keyguard_screen_unlock_portrait.xml:23: 
error: Error: No resource found that matches the given name (at 'layout' with 
value '@layout/keyguard_transport_control').
Exception in thread "main" brut.androlib.AndrolibException: 
brut.androlib.AndrolibException: brut.common.BrutException: could not exec 
command: [aapt, p, --min-sdk-version, 17, --target-sdk-version, 17, -F, 
/tmp/APKTOOL4763416094217335307.tmp, -x, -0, arsc, -S, 
/home/tito/framework-res/res, -M, /home/tito/framework-res/AndroidManifest.xml]
    at brut.androlib.Androlib.buildResourcesFull(Androlib.java:358)
    at brut.androlib.Androlib.buildResources(Androlib.java:283)
    at brut.androlib.Androlib.build(Androlib.java:206)
    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.androlib.AndrolibException: brut.common.BrutException: could 
not exec command: [aapt, p, --min-sdk-version, 17, --target-sdk-version, 17, 
-F, /tmp/APKTOOL4763416094217335307.tmp, -x, -0, arsc, -S, 
/home/tito/framework-res/res, -M, /home/tito/framework-res/AndroidManifest.xml]
    at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.java:357)
    at brut.androlib.Androlib.buildResourcesFull(Androlib.java:336)
    ... 5 more
Caused by: brut.common.BrutException: could not exec command: [aapt, p, 
--min-sdk-version, 17, --target-sdk-version, 17, -F, 
/tmp/APKTOOL4763416094217335307.tmp, -x, -0, arsc, -S, 
/home/tito/framework-res/res, -M, /home/tito/framework-res/AndroidManifest.xml]
    at brut.util.OS.exec(OS.java:89)
    at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.java:355)
    ... 6 more


What version of the product are you using? On what operating system?
apktool 1.5.2
Linux Mint 64 bits and Windows 7 64 bits

Please provide any additional information below.
It gives this error even if I don't modify a single file. Here is a link to the 
file https://www.dropbox.com/s/39rijymoysvb4lp/framework-res.apk

Original issue reported on code.google.com by juanmart...@gmail.com on 4 Apr 2013 at 1:18

@GoogleCodeExporter
Copy link
Author

What ROM or phone did this come from?

Original comment by connor.tumbleson on 6 Apr 2013 at 6:23

  • Changed state: Waiting_For_Issuer

@GoogleCodeExporter
Copy link
Author

Samsung Galaxy S4 I9500

Original comment by juanmart...@gmail.com on 6 Apr 2013 at 11:04

@GoogleCodeExporter
Copy link
Author

Looks like a FrameworkFiles problem to me.

Try installing all apks found in /system/framework

like apktool if file;

Original comment by connor.tumbleson on 7 Apr 2013 at 12:20

@GoogleCodeExporter
Copy link
Author

/system/framework/ only has two apk files
I already installed both of them with "apktool if framework" & "apktool if 
twframework-res.apk".
But it stills shows the same error once I try to re-compile it (decompiling 
works ok).


Original comment by juanmart...@gmail.com on 7 Apr 2013 at 12:34

@GoogleCodeExporter
Copy link
Author

I get the same issue for the same ROM.I tried with different aapt, following 
many guides, Windows and Linux but with no luck. I though maybe adding in 
framework the SystemUi.apk but even decompile and recompile the SystemUi also 
doesn't work. I don't get what is wrong.

Original comment by edwin.an...@gmail.com on 8 Apr 2013 at 1:35

@GoogleCodeExporter
Copy link
Author

Okay, lets try this.

1) Post all the apks in /system/framework so I can take a look.
2) Post the apktool.yml file after decompilation of this apk.
3) Tell me the IDs that each framework installed under.
(ex installing framework-res, will give it ID 1, which is the package id)

Original comment by connor.tumbleson on 8 Apr 2013 at 1:53

@GoogleCodeExporter
Copy link
Author

1) Here you got the deodexed /system/framework/ folder: 
https://www.dropbox.com/s/6j8fxvhnpugya2l/I9500XXUAMCH_framework_files-%26_Syste
mUI.zip

2)apktool.yml file after decompilation of framework-res.apk:
version: 1.5.2
apkFileName: framework-res.apk
isFrameworkApk: true
sdkInfo:
  minSdkVersion: '17'
  targetSdkVersion: '17'
packageInfo:
  cur_package: android
  orig_package: android
compressionType: false

3) IDs of each framework installed:
framework-res.apk > 1.apkg and twframework-res.apk > 2.apk
I also tried installing SystemUI.apk > 127.apk but the error was the same.

Original comment by juanmart...@gmail.com on 9 Apr 2013 at 10:12

@GoogleCodeExporter
Copy link
Author

try to add these lines in apktool.yml

usesFramework:
  ids:
  - 2

Original comment by sad...@gmail.com on 30 Apr 2013 at 3:39

@GoogleCodeExporter
Copy link
Author

I just tried but I still receive the same error.

Original comment by juanmart...@gmail.com on 30 Apr 2013 at 9:44

@GoogleCodeExporter
Copy link
Author

I can duplicate this :/

Will see what I can do. Seems to be these styles/layouts going crazy again. 
Somehow there is also nearly 100 INVALID TYPE CONFIG FOR RESOURCE errors.

If aapt can't talk with this apk, apktool won't have much luck either. 

Original comment by connor.tumbleson on 30 Apr 2013 at 12:52

  • Changed state: Accepted

@GoogleCodeExporter
Copy link
Author

Any update on this? I am having the same problem and can't find a way around it.

Original comment by RoyJCraw...@gmail.com on 4 May 2013 at 3:50

@GoogleCodeExporter
Copy link
Author

I haven't tracked down what is causing it. It might be a newer aapt vs the old 
aapt that those apks were built it, but I have fixed it without apktool.

Simply go to those 5 layout resources that are undefined and append a +. So it 
becomes +@layout etc

That should fix it, till I figure out a real fix.

Original comment by connor.tumbleson on 4 May 2013 at 1:53

@GoogleCodeExporter
Copy link
Author

Thank you that worked. Know of any side effects?

Original comment by RoyJCraw...@gmail.com on 4 May 2013 at 11:30

@GoogleCodeExporter
Copy link
Author

Even i am facing the same problem while deccompiling ! Framework-res.apk 

Exception in thread "main" brut.androlib.AndrolibException: Multiple resources:
spec=0x010800cf drawable/background_holo_dark, config=-nodpi
        at brut.androlib.res.data.ResConfig.addResource(ResConfig.java:65)
        at brut.androlib.res.data.ResConfig.addResource(ResConfig.java:58)
        at brut.androlib.res.decoder.ARSCDecoder.readEntry(ARSCDecoder.java:201)

        at brut.androlib.res.decoder.ARSCDecoder.readConfig(ARSCDecoder.java:170
)
        at brut.androlib.res.decoder.ARSCDecoder.readType(ARSCDecoder.java:135)
        at brut.androlib.res.decoder.ARSCDecoder.readPackage(ARSCDecoder.java:11
0)
        at brut.androlib.res.decoder.ARSCDecoder.readTable(ARSCDecoder.java:83)
        at brut.androlib.res.decoder.ARSCDecoder.decode(ARSCDecoder.java:49)
        at brut.androlib.res.decoder.ARSCDecoder.decode(ARSCDecoder.java:40)
        at brut.androlib.res.AndrolibResources.installFramework(AndrolibResource
s.java:562)
        at brut.androlib.Androlib.installFramework(Androlib.java:473)
        at brut.apktool.Main.cmdInstallFramework(Main.java:250)
        at brut.apktool.Main.main(Main.java:81)

Please tell me a solution !

Original comment by sanket1...@gmail.com on 5 May 2013 at 6:53

@GoogleCodeExporter
Copy link
Author

Post here your full log http://forum.xda-developers.com/showthread.php?t=2264380

Original comment by Biess...@gmail.com on 5 May 2013 at 10:43

@GoogleCodeExporter
Copy link
Author

ye, same here....I get the same when trying to compile Framwork-res without any 
changes ^^^^^^^^^^

Original comment by reverepa...@gmail.com on 18 May 2013 at 2:29

@GoogleCodeExporter
Copy link
Author

OK the apk builds now with Connors workaround, but still get aapt errors Is the 
Frmaework-res.apk still ok to flash even with getting the aapt erros>

Original comment by reverepa...@gmail.com on 18 May 2013 at 3:07

@GoogleCodeExporter
Copy link
Author

I had recompile framework-res.apk
apktool b framework-res

What is the expected output? What do you see instead?
W: Could not find sources
I: Checking whether resources has changed...
I: Building apk file.....

what problem this recompile

Original comment by Bunthoeu...@gmail.com on 26 May 2013 at 7:48

@GoogleCodeExporter
Copy link
Author

any answer Please!

Original comment by kj.tongk...@gmail.com on 26 May 2013 at 2:56

@GoogleCodeExporter
Copy link
Author

The correct fix is to move the "private extended" styles into that applications 
styles.xml. You can look at AOSP styles.xml to get the list of those styles 
which are private. Then simply add them into that APKs styles and all should 
work. This was tested and worked with the problematic apks.

Apktool isn't met to "fix" apks. As AAPT becomes more restrictive, Apktool will 
become more difficult to use. These APKs that have this problem were obviously 
built with an older AAPT before this was enforced. So this actually is NOT an 
apktool problem. Just a problem building old vs new aapt.

I am writing a good deal of documentation to explain stuff like this for 2.0, 
but this bug in particular is not really a bug, but a feature request to 
somehow automatically re-map privately extended styles automatically into the 
local styles.

Original comment by connor.tumbleson on 28 May 2013 at 2:36

@GoogleCodeExporter
Copy link
Author

thx for reply and detail ...:) 

Original comment by Bunthoeu...@gmail.com on 28 May 2013 at 3:22

@GoogleCodeExporter
Copy link
Author

[deleted comment]

@GoogleCodeExporter
Copy link
Author

I can't compile framework-res.apk
Samsung galaxy s3 stock rom 4.2.2  
:(

Original comment by kemoxkem...@gmail.com on 2 Jun 2013 at 9:15

@GoogleCodeExporter
Copy link
Author

Also having issues with the newer 4.2.2 Galaxy 4 .apks , except I am not having 
issues with framework-res...it's systemUI. Decompiling is fine but even without 
any changes , I am getting string/translation errors such as this " 
18:20:28.659: [Error] - ApkTool.CompileApk: 'ApkTool: aapt: warning: string 
'abbrev_wday_abbrev_month_day_no_year' has no default translation in 
C:\Users\Jayson\AppData\Local\Temp\84259F\res; found: mk'"

There are of course many that follow from the above folder...figured it would 
be better to keep it simple. 

I'm running apktool as part of VTS 2.4.20.9530.... apktool_1.5.2, aapt.exe 
dated ‎February ‎16, ‎2013, on a Win7 OS

Since my framework is compiling,would the addition of the above workaround 
possibly fix my systemUI issues providing of course I make the modified 
framework-res my framework in apktool?

Original comment by jayrod7...@gmail.com on 3 Jun 2013 at 9:53

@GoogleCodeExporter
Copy link
Author

Any news on this topic?
Same issue with same Galaxy S4.

Original comment by bsi...@gmail.com on 22 Jul 2013 at 6:21

@GoogleCodeExporter
Copy link
Author

Did you try on the wip-2.0 branch built from source?

(btw, requires JDK 7 to build, and JRE 7 to run)

Original comment by connor.tumbleson on 22 Jul 2013 at 6:28

@GoogleCodeExporter
Copy link
Author

Unfortunately no. Maybe you can build a Windows version for us to test?

Original comment by bsi...@gmail.com on 23 Jul 2013 at 9:48

@GoogleCodeExporter
Copy link
Author

The same problem any soulation

Original comment by Ref2012...@gmail.com on 21 Nov 2013 at 10:59

@GoogleCodeExporter
Copy link
Author

hi all

why i can't decompile this apk ?

C:\apktool>apktool.bat d framework-res.apk
Exception in thread "main" java.lang.IllegalArgumentException: MALFORMED
    at java.util.zip.ZipCoder.toString(Unknown Source)
    at java.util.zip.ZipFile.getZipEntry(Unknown Source)
    at java.util.zip.ZipFile.access$900(Unknown Source)
    at java.util.zip.ZipFile$1.nextElement(Unknown Source)
    at java.util.zip.ZipFile$1.nextElement(Unknown Source)
    at brut.directory.ZipRODirectory.loadAll(ZipRODirectory.java:110)
    at brut.directory.ZipRODirectory.loadFiles(ZipRODirectory.java:95)
    at brut.directory.AbstractDirectory.getFiles(AbstractDirectory.java:39)
    at brut.directory.AbstractDirectory.getFiles(AbstractDirectory.java:33)
    at brut.directory.AbstractDirectory.containsFile(AbstractDirectory.java:66)
    at brut.androlib.ApkDecoder.hasSources(ApkDecoder.java:197)
    at brut.androlib.ApkDecoder.decode(ApkDecoder.java:83)
    at brut.apktool.Main.cmdDecode(Main.java:146)
    at brut.apktool.Main.main(Main.java:77)

Original comment by tranvant...@yahoo.com on 21 Nov 2013 at 11:32

@GoogleCodeExporter
Copy link
Author

The issue this was opened for was responded in comment #20. Anything else isn't 
related to this bug, thus I'm closing this.

Original comment by connor.tumbleson on 22 Nov 2013 at 9:18

  • Changed state: Done

@GoogleCodeExporter
Copy link
Author

Issue 548 has been merged into this issue.

Original comment by connor.tumbleson on 22 Nov 2013 at 10:56

@GoogleCodeExporter
Copy link
Author

Issue 548 has been merged into this issue.

Original comment by connor.tumbleson on 22 Nov 2013 at 11:40

@GoogleCodeExporter
Copy link
Author

Yep me too!! I encountered the same problem! But everything works fine till 
Jelly Bean 4.1.2. The problem is after that 4.2.2! 

Original comment by ghlsrini...@gmail.com on 7 Mar 2014 at 9:46

@GoogleCodeExporter
Copy link
Author

@connor.tumbleson

Could you share a link that shows where "documentation to explain stuff like 
this for 2.0..." exists? Or provide an example for how to do this for an APK 
ourselves?

Original comment by Matth...@gmail.com on 7 Mar 2014 at 11:40

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant