我正在尝试使用APK Multi Tool(apktool)对AndroidManifest.xml进行微小更改。我可以反汇编并进行更改,但是当我尝试重新组装成新的APK时,我收到错误:
error: Error retrieving parent for item: No resource found that matches the given name 'Preference'.
我相信styles.xml中的行是:
<style name="Preference.SwitchPreference">
<item name="android:layout">@layout/preference</item>
<item name="android:widgetLayout">@layout/preference_widget_switch</item>
</style>
以下是完整的错误日志:
--------------------------------------------------------------------------
|Tue 12/10/2013 -- 23:18:05.27|
--------------------------------------------------------------------------
java version "1.7.0_13"
Java(TM) SE Runtime Environment (build 1.7.0_13-b20)
Java HotSpot(TM) 64-Bit Server VM (build 23.7-b01, mixed mode)
I: Baksmaling...
I: Loading resource table...
I: Loaded.
I: Decoding AndroidManifest.xml with resources...
I: Loading resource table from file: C:\Users\Sean\apktool\framework\1.apk
I: Loaded.
I: Renamed manifest package found! Fixing...
I: Decoding file-resources...
I: Decoding values */* XMLs...
I: Done.
I: Copying assets and libs...
I: Checking whether sources has changed...
I: Smaling...
I: Checking whether resources has changed...
I: Building resources...
C:\Users\Sean\Downloads\APK-Multi-Tool\other\..\projects\Test.apk\res\values\styles.xml:105: error: Error retrieving parent for item: No resource found that matches the given name 'Preference'.
Exception in thread "main" brut.androlib.AndrolibException: brut.androlib.AndrolibException: brut.common.BrutException: could not exec command: [aapt, p, --min-sdk-version, 13, --target-sdk-version, 17, -F, C:\Users\Sean\AppData\Local\Temp\APKTOOL1118131662295957481.tmp, -0, arsc, -I, C:\Users\Sean\apktool\framework\1.apk, -S, C:\Users\Sean\Downloads\APK-Multi-Tool\other\..\projects\Test.apk\res, -M, C:\Users\Sean\Downloads\APK-Multi-Tool\other\..\projects\Test.apk\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, 13, --target-sdk-version, 17, -F, C:\Users\Sean\AppData\Local\Temp\APKTOOL1118131662295957481.tmp, -0, arsc, -I, C:\Users\Sean\apktool\framework\1.apk, -S, C:\Users\Sean\Downloads\APK-Multi-Tool\other\..\projects\Test.apk\res, -M, C:\Users\Sean\Downloads\APK-Multi-Tool\other\..\projects\Test.apk\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, 13, --target-sdk-version, 17, -F, C:\Users\Sean\AppData\Local\Temp\APKTOOL1118131662295957481.tmp, -0, arsc, -I, C:\Users\Sean\apktool\framework\1.apk, -S, C:\Users\Sean\Downloads\APK-Multi-Tool\other\..\projects\Test.apk\res, -M, C:\Users\Sean\Downloads\APK-Multi-Tool\other\..\projects\Test.apk\AndroidManifest.xml]
at brut.util.OS.exec(OS.java:89)
at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.java:355)
... 6 more
有关如何解决此问题的任何想法?我可以以某种方式构建APK而不反编译和编译代码,因为我没有进行代码更改?感谢。
答案 0 :(得分:2)
小技巧:为styles.xml
添加新样式:
<style name="Preference" />