面向 Android 12 及更高版本的应用需要为“android:exported”指定显式值 [Cordova]

2024-03-26

当我在 GitHub 中运行 Apk 时,出现错误。当我在 GitHub 中构建 Apk 时。无法定义清单内的某些内容,因为它每次都是新鲜构建的。我所能做的就是在 Config.Xml 文件中。添加后android:exported="false"到它,也得到同样的错误。此问题参考的两张图片均附在此处。GitHub 错误 https://i.stack.imgur.com/LLMnt.png and 配置文件 https://i.stack.imgur.com/yBSTy.png。帮助将不胜感激。

<?xml version='1.0' encoding='utf-8'?>
<widget id="com.likehub.sweetheart" version="1.1.64" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
    <name>sweetheart</name>
    <description>making love bird together</description>
    <author email="[email protected] /cdn-cgi/l/email-protection" href="">likehub</author>
    <content src="index.html" />
    <access origin="*" />
    <allow-intent href="http://*/*" />
    <allow-intent href="https://*/*" />
    <allow-intent href="tel:*" />
    <allow-intent href="sms:*" />
    <allow-intent href="mailto:*" />
    <allow-intent href="geo:*" />
    <preference name="AndroidXEnabled" value="true" />
    <preference name="WebViewBounce" value="false" />
    <preference name="UIWebViewBounce" value="false" />
    <preference name="DisallowOverscroll" value="true" />
    <preference name="LoadUrlTimeoutValue" value="700000" />
    <preference name="ScrollEnabled" value="false" />
    <preference name="SplashMaintainAspectRatio" value="true" />
    <preference name="FadeSplashScreenDuration" value="1000" />
    <preference name="FadeSplashScreen" value="true" />
    <preference name="SplashShowOnlyFirstTime" value="false" />
    <preference name="SplashScreen" value="screen" />
    <preference name="SplashScreenDelay" value="5000" />
    <preference name="AutoHideSplashScreen" value="true" />
    <preference name="ShowSplashScreen" value="false" />
    <preference name="ShowSplashScreenSpinner" value="false" />
    <preference name="android-minSdkVersion" value="22" />
    <preference name="BackupWebStorage" value="none" />
    <preference name="Orientation" value="portrait" />
    <preference name="AndroidPersistentFileLocation" value="Compatibility" />
    <preference name="GradlePluginKotlinEnabled" value="true" />
    <preference name="GradlePluginKotlinCodeStyle" value="official" />
    <preference name="GradlePluginKotlinVersion" value="1.3.50" />
    <preference name="AndroidLaunchMode" value="singleTask" />
    <feature name="StatusBar">
        <param name="ios-package" onload="true" value="CDVStatusBar" />
    </feature>
    <platform  name="android">
        <preference name="android-targetSdkVersion" value="31" />
        <edit-config  file="app/src/main/AndroidManifest.xml" mode="merge" android:exported="true" target="/manifest/application" xmlns:android="http://schemas.android.com/apk/res/android">
            <application android:usesCleartextTraffic="true" />
            <application android:networkSecurityConfig="@xml/network_security_config" />
            
            <intent-filter>
                <action  android:name="MainActivity" android:exported="false"/>
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </edit-config>
        <resource-file src="resources/android/xml/network_security_config.xml" target="app/src/main/res/xml/network_security_config.xml" />
        <allow-intent href="market:*" />
        <icon density="ldpi" src="resources/android/icon/drawable-ldpi-icon.png" />
        <icon density="mdpi" src="resources/android/icon/drawable-mdpi-icon.png" />
        <icon density="hdpi" src="resources/android/icon/drawable-hdpi-icon.png" />
        <icon density="xhdpi" src="resources/android/icon/drawable-xhdpi-icon.png" />
        <icon density="xxhdpi" src="resources/android/icon/drawable-xxhdpi-icon.png" />
        <icon density="xxxhdpi" src="resources/android/icon/drawable-xxxhdpi-icon.png" />
        <splash density="land-ldpi" src="resources/android/splash/drawable-land-ldpi-screen.png" />
        <splash density="land-mdpi" src="resources/android/splash/drawable-land-mdpi-screen.png" />
        <splash density="land-hdpi" src="resources/android/splash/drawable-land-hdpi-screen.png" />
        <splash density="land-xhdpi" src="resources/android/splash/drawable-land-xhdpi-screen.png" />
        <splash density="land-xxhdpi" src="resources/android/splash/drawable-land-xxhdpi-screen.png" />
        <splash density="land-xxxhdpi" src="resources/android/splash/drawable-land-xxxhdpi-screen.png" />
        <splash density="ldpi" src="resources/android/splash/drawable-port-ldpi-screen.png" />
        <splash density="port-ldpi" src="resources/android/splash/drawable-port-ldpi-screen.png" />
        <splash density="mdpi" src="resources/android/splash/drawable-port-mdpi-screen.png" />
        <splash density="port-mdpi" src="resources/android/splash/drawable-port-mdpi-screen.png" />
        <splash density="hdpi" src="resources/android/splash/drawable-port-hdpi-screen.png" />
        <splash density="port-hdpi" src="resources/android/splash/drawable-port-hdpi-screen.png" />
        <splash density="xhdpi" src="resources/android/splash/drawable-port-xhdpi-screen.png" />
        <splash density="port-xhdpi" src="resources/android/splash/drawable-port-xhdpi-screen.png" />
        <splash density="xxhdpi" src="resources/android/splash/drawable-port-xxhdpi-screen.png" />
        <splash density="port-xxhdpi" src="resources/android/splash/drawable-port-xxhdpi-screen.png" />
        <splash density="xxxhdpi" src="resources/android/splash/drawable-port-xxxhdpi-screen.png" />
        <splash density="port-xxxhdpi" src="resources/android/splash/drawable-port-xxxhdpi-screen.png" />
    </platform>
    <platform name="ios">
        <allow-intent href="itms:*" />
        <allow-intent href="itms-apps:*" />
        <icon height="57" src="resources/ios/icon/icon.png" width="57" />
        <icon height="114" src="resources/ios/icon/[email protected] /cdn-cgi/l/email-protection" width="114" />
        <icon height="29" src="resources/ios/icon/icon-small.png" width="29" />
        <icon height="58" src="resources/ios/icon/[email protected] /cdn-cgi/l/email-protection" width="58" />
        <icon height="87" src="resources/ios/icon/[email protected] /cdn-cgi/l/email-protection" width="87" />
        <icon height="20" src="resources/ios/icon/icon-20.png" width="20" />
        <icon height="40" src="resources/ios/icon/[email protected] /cdn-cgi/l/email-protection" width="40" />
        <icon height="60" src="resources/ios/icon/[email protected] /cdn-cgi/l/email-protection" width="60" />
        <icon height="48" src="resources/ios/icon/[email protected] /cdn-cgi/l/email-protection" width="48" />
        <icon height="55" src="resources/ios/icon/[email protected] /cdn-cgi/l/email-protection" width="55" />
        <icon height="29" src="resources/ios/icon/icon-29.png" width="29" />
        <icon height="58" src="resources/ios/icon/[email protected] /cdn-cgi/l/email-protection" width="58" />
        <icon height="87" src="resources/ios/icon/[email protected] /cdn-cgi/l/email-protection" width="87" />
        <icon height="40" src="resources/ios/icon/icon-40.png" width="40" />
        <icon height="80" src="resources/ios/icon/[email protected] /cdn-cgi/l/email-protection" width="80" />
        <icon height="120" src="resources/ios/icon/[email protected] /cdn-cgi/l/email-protection" width="120" />
        <icon height="88" src="resources/ios/icon/[email protected] /cdn-cgi/l/email-protection" width="88" />
        <icon height="50" src="resources/ios/icon/icon-50.png" width="50" />
        <icon height="100" src="resources/ios/icon/[email protected] /cdn-cgi/l/email-protection" width="100" />
        <icon height="60" src="resources/ios/icon/icon-60.png" width="60" />
        <icon height="120" src="resources/ios/icon/[email protected] /cdn-cgi/l/email-protection" width="120" />
        <icon height="180" src="resources/ios/icon/[email protected] /cdn-cgi/l/email-protection" width="180" />
        <icon height="72" src="resources/ios/icon/icon-72.png" width="72" />
        <icon height="144" src="resources/ios/icon/[email protected] /cdn-cgi/l/email-protection" width="144" />
        <icon height="76" src="resources/ios/icon/icon-76.png" width="76" />
        <icon height="152" src="resources/ios/icon/[email protected] /cdn-cgi/l/email-protection" width="152" />
        <icon height="167" src="resources/ios/icon/[email protected] /cdn-cgi/l/email-protection" width="167" />
        <icon height="172" src="resources/ios/icon/[email protected] /cdn-cgi/l/email-protection" width="172" />
        <icon height="196" src="resources/ios/icon/[email protected] /cdn-cgi/l/email-protection" width="196" />
        <icon height="1024" src="resources/ios/icon/icon-1024.png" width="1024" />
        <splash height="480" src="resources/ios/splash/Default~iphone.png" width="320" />
        <splash height="960" src="resources/ios/splash/Default@2x~iphone.png" width="640" />
        <splash height="1024" src="resources/ios/splash/Default-Portrait~ipad.png" width="768" />
        <splash height="768" src="resources/ios/splash/Default-Landscape~ipad.png" width="1024" />
        <splash height="1125" src="resources/ios/splash/Default-Landscape-2436h.png" width="2436" />
        <splash height="1242" src="resources/ios/splash/Default-Landscape-736h.png" width="2208" />
        <splash height="2048" src="resources/ios/splash/Default-Portrait@2x~ipad.png" width="1536" />
        <splash height="1536" src="resources/ios/splash/Default-Landscape@2x~ipad.png" width="2048" />
        <splash height="2732" src="resources/ios/splash/Default-Portrait@~ipadpro.png" width="2048" />
        <splash height="2048" src="resources/ios/splash/Default-Landscape@~ipadpro.png" width="2732" />
        <splash height="1136" src="resources/ios/splash/Default-568h@2x~iphone.png" width="640" />
        <splash height="1334" src="resources/ios/splash/Default-667h.png" width="750" />
        <splash height="2208" src="resources/ios/splash/Default-736h.png" width="1242" />
        <splash height="2436" src="resources/ios/splash/Default-2436h.png" width="1125" />
        <splash height="2732" src="resources/ios/splash/Default@2x~universal~anyany.png" width="2732" />
        <icon height="216" src="resources/ios/icon/[email protected] /cdn-cgi/l/email-protection" width="216" />
        <splash height="2688" src="resources/ios/splash/Default-2688h~iphone.png" width="1242" />
        <splash height="1242" src="resources/ios/splash/Default-Landscape-2688h~iphone.png" width="2688" />
        <splash height="1792" src="resources/ios/splash/Default-1792h~iphone.png" width="828" />
        <splash height="828" src="resources/ios/splash/Default-Landscape-1792h~iphone.png" width="1792" />
    </platform>
    <plugin name="cordova-plugin-googleplus" spec="^8.4.0">
        <variable name="WEB_APPLICATION_CLIENT_ID" value="0000000000000-wwwwwwwmkv51oxxxxxxxxxxx.apps.googleusercontent.co" />
    </plugin>
    <platform name="android">
        <preference name="GoogleAndroidClientId" value="888809hhju-i9hd0hc6v51obgdubbgxwbnhiywgdiueh.apps.googleusercontent.com" />
    </platform>
    <plugin name="cordova-plugin-whitelist" spec="1.3.5" />
    <plugin name="cordova-plugin-statusbar" spec="2.4.3" />
    <plugin name="cordova-plugin-device" spec="2.0.3" />
    <plugin name="cordova-plugin-splashscreen" spec="6.0.0" />
    <plugin name="cordova-plugin-ionic-webview" spec="5.0.0" />
    <plugin name="cordova-plugin-ionic-keyboard" spec="^2.2.0" />
</widget>

面向 Android 12 及更高版本的应用需要指定显式值android:exported当相应的组件定义了意图过滤器时。看https://developer.android.com/guide/topics/manifest/activity-element#exported https://developer.android.com/guide/topics/manifest/activity-element#exported了解详情。


你可以这样尝试config.xmlandroid平台下——

<edit-config
  file="app/src/main/AndroidManifest.xml"
  target="/manifest/application/activity[@android:name='MainActivity']"
  mode="merge">
    <activity android:exported="true"/>
</edit-config>

确保正确定位文件和活动名称。

Due to merge mode, android:exported="true"将添加到目标活动元素。如果目标元素中已存在这些值,则这将替换这些值。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

面向 Android 12 及更高版本的应用需要为“android:exported”指定显式值 [Cordova] 的相关文章

  • 在文件之间共享 mqtt 客户端对象

    我这样连接到 MQTT mqtt js const mqtt require mqtt var options needed options var client mqtt connect mqtt someURL options clie
  • 监听文件夹和文件(更改)

    可以直接在 PHP 或 Node 上监听文件夹和文件的更改 通过事件 还是我需要创建自己的方法来执行此操作 Example 我需要听文件夹 user 如果我将一些文件添加到该目录中 PHP 或 Node 会收到信息并运行PathEvent
  • 尝试安装 LESS 时出现“请尝试以 root/管理员身份再次运行此命令”错误

    我正在尝试在我的计算机上安装 LESS 并且已经安装了节点 但是 当我输入 node install g less 时 出现以下错误 并且不知道该怎么办 FPaulMAC bin paul npm install g less npm ER
  • 模块解析失败:意外的标记 (4:0)

    我正在尝试将 FULLCALENDAR 添加到我的 Angular v14 项目中 但在所有设置之后我突然面临这个错误 知道如何处理这个错误吗 包 json fullcalendar angular 5 11 0 fullcalendar
  • 为什么 Node.js 应用程序只能从 127.0.0.1/localhost 访问?

    我本来打算教我的朋友介绍 Node 但是后来 我想知道为什么这个代码来自nodejs org var http require http http createServer function req res res writeHead 20
  • 如何在查询语句之外从mysql查询中获取值?

    这是下面的函数console log function quo value value connection query SELECT role from roles where id 1 function error results fi
  • Node.js http get 请求错误事件未拾取 404 或 403

    我正在对图像发出 HTTP GET 请求 有时图像会以 404 或 403 的形式返回 令我惊讶的是 我必须明确检查这一点 而不是在错误事件中选择它 这是它的工作原理还是我在这里遗漏了一些东西 function processRequest
  • 护照本地猫鼬帐户注册的附加字段?

    我将 Passport local mongoose 与 Node js Express js MongoDB 一起用于 Web 应用程序 我想使用用户名字段 密码字段 公司名称字段和电话号码字段 所有字段 来注册用户作为字符串 但是 我只
  • Node JS - 如何检测用户语言

    我正在尝试在纯 Node js 中检查用户语言 而不使用 npm 的任何扩展 我使用了进程和全局命令 有很多规范但我找不到系统语言 这是获取默认区域设置的独立于操作系统 节点 浏览器的方法 let locale Intl DateTimeF
  • 如何使用 GitHub GraphQL API 查看问题已在项目的列之间转移?

    我想确定卡片何时从一列移动到另一列GitHub 项目板 https help github com articles about project boards 使用 GitHub GraphQL API 我可以在项目板中列出所有问题 例如
  • libxmljs 的替代品 [关闭]

    Closed 此问题正在寻求书籍 工具 软件库等的推荐 不满足堆栈溢出指南 help closed questions 目前不接受答案 目标 使用 Node js 访问网页 使用 xpath 语法操作 DOM 并打印新的 DOM libxm
  • 如何设置上传的文件名?

    By using multer I made it to request image file like this 这个文件存储在我设置的 上传 文件夹中 我的代码如下 var multer require multer var uploa
  • 缺少节点-v59-linux-x64/grpc_node.node

    我正在尝试在我的服务器中使用 Firebase admin SDK 当我部署时 出现错误 我在 firebase admin node module 映射中缺少文件 node v59 linux x64 grpc node node 我在包
  • Composer 无法获取 github

    今天 我尝试通过运行来安装 Laravelcomposer create project laravel laravel 5 1 myproject prefer dist我收到此错误 Could not fetch https api g
  • firebase 和 firebase-admin npm 模块有什么区别?

    我想使用 Firebase 身份验证 数据库和存储 构建 Node js Web 应用程序 但我对应该使用哪个模块感到困惑 firebase or firebase 管理员 或两者 管理 SDK 运行您的代码管理权限 https fireb
  • 如何让 vsCode 了解自动补全的深度依赖导入?

    我创建了多个角度库 让我可以使用一堆组件更快地创建网站 例如 sidenav 卡片 我创建了一个 超级库 来导入所有这些库 这样我就可以使用npm i myWebsiteBundle立即下载所有依赖项 我已将每个类似的插件列入白名单ng p
  • 使当前提交成为 Git 存储库中唯一(初始)提交?

    我目前有一个本地 Git 存储库 我将其推送到 Github 存储库 本地存储库有约 10 次提交 Github 存储库是其同步副本 我想要做的是从本地 Git 存储库中删除所有版本历史记录 以便存储库的当前内容显示为唯一提交 因此存储库中
  • Github - 上传文件

    我正在尝试将文件夹添加到 github 存储库 该文件在 github 上显示为空 并有一个绿色箭头 有谁知道如何解决这个问题 我将不胜感激你的帮助 谢谢 这看起来类似于 Git 如何跟踪未跟踪的内容 https stackoverflow
  • Nodejs Express中间件函数返回值

    我正在使用 NodeJS 和 Express 我有以下路线 中间件功能是Mobile 如果我不使用 return next 在 isMobile 函数中 应用程序会卡住 因为 NodeJS 不会移至下一个函数 但我需要 isMobile 函
  • Angular 7测试重试当模拟http请求无法实际重试时

    我有以下尝试使用 OAuth 的拦截器refresh token每当获得任何 401 错误 响应时 基本上 刷新令牌是在第一个 401 请求上获取的 获取后 代码会等待 2 5 秒 在大多数情况下 第二个请求不会触发错误 但如果触发错误 令

随机推荐

  • 如何使用 JMeter 将 application/x-www-form-urlencoded 参数发送到 RestServer?

    我开发了一个休息服务器 并将其在本地主机中运行 我尝试使用 JMeter 执行测试 发送请求帖子和获取 取决于调用的方法 我已经发送到 Rest 服务器并使用 JMeter 在简单的 post 请求 获取请求 通过 post 发送文件以及通
  • 活动目录与 OpenLDAP

    LDAP 协议的这两种实现之间的主要区别是什么 异构环境哪个更好 关于这个主题有什么好的网站吗 以下是我立即知道的一些差异 OpenLDAP 可以称为通用 LDAP 服务器 类似于许多其他供应商的 LDAP 服务器 Fedora DS 38
  • Pandas 替换所有列名称中的一个字符

    我的数据框的列名称 来自 csv 文件 包含 and 我想将它们替换为 我怎样才能对所有列进行此操作 Use str replace http pandas pydata org pandas docs stable generated p
  • 如何将 WPF DataGrid 绑定到可变数量的列?

    我的 WPF 应用程序生成的数据集每次可能具有不同的列数 输出中包含对将用于应用格式设置的每列的描述 输出的简化版本可能类似于 class Data IList
  • Cell Swift 中的 UITextView

    我已经搞乱这些限制几个小时了 但无法弄清楚这一点 我的文本视图需要动态单元格高度 正如你所看到的 它与我的时间戳重叠 截至目前 我对时间戳的限制为零 无 我已经尝试了所有可能的组合来完成这项工作 但我无法做到 我也在使用 override
  • MySQL触发器与事务插入或更新

    我正在使用 mysql db 和 java 所以在我的应用程序中我需要使用触发器 但我需要在插入或更新时保存它 当在表A中插入新记录时 触发器将完成在另一个表B中插入一些信息的工作 同样 当对表A中的记录进行更新时 触发器将更新表B中的记录
  • PHP:数组的索引、元素、键、值之间有区别吗?...它们是同一件事吗?

    当处理PHP arrays 我经常在这里使用这样的术语 Array Key Array Index Array Element Array Value 有人可以吗 PLEASE in simple术语解释了其中每一个的含义基本上 means
  • Visual C++ 中的嵌套注释?

    是否可以在 Visual C 中启用嵌套注释 如果有的话 我似乎找不到开关 C 标准中不允许嵌套注释 Visual C 支持该标准 抱歉 没有嵌套评论
  • 服务可以在 onBind 期间获取对 Activity 的引用吗?

    我有一项服务基本上管理媒体播放器播放实例podcasts 一旦活动绑定到服务 它就可以执行播放 暂停 停止等操作 我使用服务是因为我希望播客即使在活动被销毁后也能继续播放 我希望该服务能够在发生错误或正常状态更新时将消息发送回活动 该服务是
  • 如何在 Django-Registration 中使用不同的表单

    Django Registration 在 forms py 文件中有几个表单类 一是 类 RegistrationFormTermsOfService RegistrationForm 我需要对 Django 注册代码的其余部分进行哪些更
  • 会话在控制器方法中变为空

    我有以下控制器 在该控制器中我创建了会话来保存IENUMERABLE数据集 HttpPost ValidateInput false public ActionResult Create Brochure IEnumerable
  • Swift:一个数组中的不同对象?

    一个数组中是否可以有两个不同的自定义对象 我想在一个中显示两个不同的对象UITableView我认为最简单的方法是将所有对象放在一个数组中 根据您想要对数组进行多少控制 您可以创建两种对象类型都实现的协议 该协议不需要包含任何内容 可能是
  • 当拥有 @objcMembers 私有动态变量时 @objc 冗余?

    因此 我将 Realm 与 Swift 结合使用 并使用 objcMembers 关键字标记我的类 但是当我尝试创建一些私有变量时 Xcode 强制我在这些私有变量旁边添加 objc 这是有意的行为吗 看来这对我来说是多余的 objcMem
  • deepcopy 不尊重元类

    我有一堂课 根据设计 必须遵循单例图案 所以我继续使用元类 一切都运行良好 直到报告了一个错误 总而言之 deepcopy ied 我的实例单例类不是相同的实例 我可以通过从基础继承来解决这个错误单例 type 类 但我宁愿不这样做 原因在
  • 我如何确保 Spring roo 生成的方面是由依赖项目编织的?

    我有一个春天Roo多模块项目 我注意到在另一个项目中包含包含我的域模型的 jar 模块后 各个方面还没有被编织给我留下了没有任何可用的 getter setter 的域类 如何确保 Spring roo 生成的切面是由依赖项目编织的 EDI
  • 如何在没有 Windows iTunes 的情况下在 iPhone 上安装 IPA [已关闭]

    Closed 这个问题是与编程或软件开发无关 help closed questions 目前不接受答案 在没有 Mac 或不使用 iTunes 的情况下 如何在 iPhone 上安装 iPhone 应用程序 IPA 另外 如果这还不够困难
  • Qt 程序挂起(无响应)直到函数结束然后再次开始工作

    我在 Qt 中有一个 UI 应用程序 有几个函数可以运行大规模 SQL 查询 返回数千个结果 当单击运行此查询的按钮时 UI 窗口立即变为 无响应 但是我可以从控制台输出中看到 所有内容实际上仍在后台运行 一旦函数结束 数据就会按预期显示
  • mvc4 中没有为此对象定义无参数构造函数

    using Michell ClaimsAuditAdmin Models using Mitchell ClaimsAuditAdmin Repositories using Mitchell ClaimsAuditAdmin Web M
  • 为什么 sys.exit() 会导致回溯?

    根据如何在不回溯的情况下退出Python https stackoverflow com q 1187970 3357935 呼叫sys exit 在 Python 脚本中应该静默退出而不进行回溯 import sys sys exit 0
  • 面向 Android 12 及更高版本的应用需要为“android:exported”指定显式值 [Cordova]

    当我在 GitHub 中运行 Apk 时 出现错误 当我在 GitHub 中构建 Apk 时 无法定义清单内的某些内容 因为它每次都是新鲜构建的 我所能做的就是在 Config Xml 文件中 添加后android exported fal