gpt4 book ai didi

java - 需要帮助更改 APK 文件中的 AndroidManifest.xml

转载 作者:行者123 更新时间:2023-12-02 06:25:59 27 4
gpt4 key购买 nike

我正在尝试使用 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 吗?谢谢。

最佳答案

小技巧:向 styles.xml 添加新样式:

<style name="Preference" />

关于java - 需要帮助更改 APK 文件中的 AndroidManifest.xml,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20528080/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com