Error When apktool generates the APK package

Source: Internet
Author: User

Basic description:


An error occurred while packaging after decompiling apktool (error retrieving parent for item: no resource found that matches the given name '@ * Android: style/theme. Light ')

Error Log:

res\values\styles.xml:3: error: Error retrieving parent for item: No resource found that matches the given name '@*android:style/Theme.Light'.\res\values-v11\styles.xml:3: error: Error retrieving parent for item: No resource found that matches the given name '@*android:style/Theme.Holo.Light'.\res\values-v14\styles.xml:3: error: Error retrieving parent for item: No resource found that matches the given name '@*android:style/Theme.Holo.Light.DarkActionBar'.Exception in thread "main" brut.androlib.AndrolibException: brut.common.BrutException: could not exec command: [aapt, p, --min-sdk-version, 8, --target-sdk-version, 15, -F, C:\DOCUME~1\Me\LOCALS~1\Temp\APKTOOL8621427559288146532.tmp, -I, C:\Documents and Settings\Me\apktool\framework\1.apk, -S, E:\Tools\and_tool\AndTest\res, -M, E:\Tools\and_tool\AndTest\AndroidManifest.xml]        at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.java:255)        at brut.androlib.Androlib.buildResourcesFull(Androlib.java:324)        at brut.androlib.Androlib.buildResources(Androlib.java:269)        at brut.androlib.Androlib.build(Androlib.java:192)        at brut.androlib.Androlib.build(Androlib.java:174)        at brut.apktool.Main.cmdBuild(Main.java:188)        at brut.apktool.Main.main(Main.java:70)Caused by: brut.common.BrutException: could not exec command: [aapt, p, --min-sdk-version, 8, --target-sdk-version, 15, -F, C:\DOCUME~1\Me\LOCALS~1\Temp\APKTOOL8621427559288146532.tmp, -I, C:\Documents and Settings\Me\apktool\framework\1.apk, -S, E:\Tools\and_tool\AndTest\res, -M, E:\Tools\and_tool\AndTest\AndroidManifest.xml]        at brut.util.OS.exec(OS.java:83)        at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.java:253)        ... 6 more

Solution 1: (I am not applicable to this situation)

See the error. Styles. XML has an error. Enable the XML-to-decompiled XML comparison,
It is found that the parent attribute of <resources>/<style> In the decompiled XML file has an error, which is changed from Android: theme. xxx
@ * Android: style/theme. XXX. Add @ * in the front, and add style/in the middle. It is easy to find the cause and correct the XML,
Package the package!

Reference: http://dreamisx.blog.163.com/blog/static/1150048392012112024649308/

Solution 2: (not applicable)

It is estimated that the version is incorrect. The solution is to set Android-SDK-Windows \ platform-tools \ aapt.exe under Android SDK
Copy and replace it with the same directory of apktool. Jar. In a similar way, directly set F: \ Android-SDK-Windows \ platform-tools as an environment variable,
Delete the original directory aapt.exe and run it directly.
Because sdks of windows are not downloaded under linux, aapt.exe of the network cannot be used. Aapt download see http://download.csdn.net/detail/fql_zlyy/5366841

 
Reference: http://blog.sina.com.cn/s/blog_4a4f9fb50101dm5d.html

My solutions:
Observe that the/apktool/framework/1.apk file will be generated on my file system when an APK is generated in my file system,
It is assumed that the APK of the framework (including some theme, style, and so on in the System) folder has been generated before. When apktool is used again, it will not be regenerated,
However, if the version of the previously generated APK is different from the current version, the resource cannot be found. Therefore, after the directory is deleted,
We can use apktool again to reinvent our achievements.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.