我正在尝试更新我的 Google Play 商店应用程序,但收到一条警告,指出我的某些设备无法更新,因为我拥有系统警报窗口权限 我正在世博会管理的工作流程中工作,请帮助我摆脱此权限 我尝试了很多,但是没有成功,我如何从我的博览会反应本机项目中删除此权限
Thanks
Expo 管理的工作流程不允许访问清单文件以删除权限,因此我们必须构建一个修改其内容的插件。
您必须添加一个配置插件以从 Info.plist 和 AndroidManifest.xml 中删除 SYSTEM_ALERT_WINDOW 权限。
首先,使用以下代码在项目文件夹中创建 android-manifest.plugin.js 文件:
const { withAndroidManifest } = require("@expo/config-plugins");
module.exports = function androiManifestPlugin(config) {
return withAndroidManifest(config, async (config) => {
let androidManifest = config.modResults.manifest;
androidManifest.$ = {
...androidManifest.$,
"xmlns:tools": "http://schemas.android.com/tools",
};
androidManifest["uses-permission"] = androidManifest["uses-permission"].map(
(perm) => {
if (
perm.$["android:name"] === "android.permission.SYSTEM_ALERT_WINDOW"
) {
perm.$["tools:node"] = "remove";
}
return perm;
}
);
return config;
});
};
然后将插件添加到 app.json 文件中,如下所示:
"expo":{
...
"plugins": ["./android-manifest.plugin.js"],
...
}
并使用 eas build 命令构建您的应用程序。
欲了解更多详情,请访问https://docs.expo.dev/guides/config-plugins/
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)