2013-12-11 61 views
0

我正在嘗試使用APK多工具(apktool)對AndroidManifest.xml進行較小的更改。我能拆卸和做出改變,但是當我試圖重新組合成一個新的APK,我得到一個錯誤:需要幫助更改APK文件中的AndroidManifest.xml

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而無需反編譯和編譯代碼,因爲我沒有更改代碼?謝謝。

回答

1

小竅門:添加一個新的風格styles.xml

<style name="Preference" /> 
+0

哇,我覺得工作。你是上帝。 –