如何编辑 android apk 的 android 清单并为 chrome 应用程序重建它
我正在尝试编辑 chrome 应用 使用 apktool
使用
下面的命令反编译 jar,我能够获取 AndroidManifest.xml 文件并编辑文件以删除application
节点的 android:allowAudioPlaybackCapture="false"
属性。
<application android:allowAudioPlaybackCapture="false" android:allowBackup="true" android:appComponentFactory="org.chromium.chrome.browser.base.SplitCompatAppComponentFactory" android:backupAgent="org.chromium.chrome.browser.ChromeBackupAgent" android:fullBackupOnly="false" android:icon="@drawable/APKTOOL_DUPLICATE_drawable_0x7f08022c" android:label="@string/APKTOOL_DUPLICATE_string_0x7f1401e0" android:largeHeap="false" android:manageSpaceActivity="@string/APKTOOL_DUPLICATE_string_0x7f1405e9" android:name="org.chromium.chrome.browser.base.SplitChromeApplication" android:networkSecurityConfig="@xml/APKTOOL_DUPLICATE_xml_0x7f180025" android:restoreAnyVersion="true" android:roundIcon="@drawable/APKTOOL_DUPLICATE_drawable_0x7f08022d" android:supportsRtl="true" android:zygotePreloadName="org.chromium.content_public.app.ZygotePreload">
apktool d google-chrome-98-0-4758-101.apk
但是当我尝试使用下面的命令再次构建时,出现以下错误
apktool b google-chrome-98-0-4758-101
brut.androlib.AndrolibException: brut.common.BrutException: could not exec (exit code = 1): [/var/folders/dk/1p87jm1d4c1c7rq4s385xfqc0000gn/T/brut_util_Jar_44412591478507968185529954203449703541.tmp, p, --forced-package-id, 127, --min-sdk-version, 23, --target-sdk-version, 23, --max-sdk-version, 23, --max-res-version, 23, --version-code, 475810110, --version-name, 98.0.4758.101, --no-version-vectors, -F, /var/folders/dk/1p87jm1d4c1c7rq4s385xfqc0000gn/T/APKTOOL503548586151793248.tmp, -e, /var/folders/dk/1p87jm1d4c1c7rq4s385xfqc0000gn/T/APKTOOL1736943765463305431.tmp, -0, arsc, -I, /apktool/framework/1.apk, -S, /androidrtc/ChromeApk/google-chrome-98-0-4758-101/res, -M, /androidrtc/ChromeApk/google-chrome-98-0-4758-101/AndroidManifest.xml]
I am trying to edit AndroidManifest.xml
for chrome app using apktool
Using the below command to decompile the jar, I am able to get the AndroidManifest.xml file and edit file to remove android:allowAudioPlaybackCapture="false"
attribute from application
node.
<application android:allowAudioPlaybackCapture="false" android:allowBackup="true" android:appComponentFactory="org.chromium.chrome.browser.base.SplitCompatAppComponentFactory" android:backupAgent="org.chromium.chrome.browser.ChromeBackupAgent" android:fullBackupOnly="false" android:icon="@drawable/APKTOOL_DUPLICATE_drawable_0x7f08022c" android:label="@string/APKTOOL_DUPLICATE_string_0x7f1401e0" android:largeHeap="false" android:manageSpaceActivity="@string/APKTOOL_DUPLICATE_string_0x7f1405e9" android:name="org.chromium.chrome.browser.base.SplitChromeApplication" android:networkSecurityConfig="@xml/APKTOOL_DUPLICATE_xml_0x7f180025" android:restoreAnyVersion="true" android:roundIcon="@drawable/APKTOOL_DUPLICATE_drawable_0x7f08022d" android:supportsRtl="true" android:zygotePreloadName="org.chromium.content_public.app.ZygotePreload">
apktool d google-chrome-98-0-4758-101.apk
But when I trying to build again using below command I get following error
apktool b google-chrome-98-0-4758-101
brut.androlib.AndrolibException: brut.common.BrutException: could not exec (exit code = 1): [/var/folders/dk/1p87jm1d4c1c7rq4s385xfqc0000gn/T/brut_util_Jar_44412591478507968185529954203449703541.tmp, p, --forced-package-id, 127, --min-sdk-version, 23, --target-sdk-version, 23, --max-sdk-version, 23, --max-res-version, 23, --version-code, 475810110, --version-name, 98.0.4758.101, --no-version-vectors, -F, /var/folders/dk/1p87jm1d4c1c7rq4s385xfqc0000gn/T/APKTOOL503548586151793248.tmp, -e, /var/folders/dk/1p87jm1d4c1c7rq4s385xfqc0000gn/T/APKTOOL1736943765463305431.tmp, -0, arsc, -I, /apktool/framework/1.apk, -S, /androidrtc/ChromeApk/google-chrome-98-0-4758-101/res, -M, /androidrtc/ChromeApk/google-chrome-98-0-4758-101/AndroidManifest.xml]
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不建议这样做。 Google 要求您在上传之前对 APK/AAB 文件进行签名是有原因的,这是为了防止像您在这里所做的那样被篡改。
最多,如果您想在应用程序中使用 Chrome,最好的选择是使用 Chrome 自定义标签。
I wouldn't recommend doing that. There is a reason why Google requires you to sign the APK/AAB files before uploading, and that is to prevent tampering like you are doing here.
At most, if you want to use Chrome in your app, your best bet is to use Chrome Custom Tabs.