2023-02-14 Apps targeting Android 12 and higher are required to specify an explicit val
新建android项目,选择basic active一项,在跑模拟器的时候,报错。
解决方案:找到AndroidManifest.xml文件,在<activity 里面添加一行属性 android:exported="true"
详情Gpt给出的解决方案:
=======================================================================================================================================================
This error message indicates that you have an issue with the `AndroidManifest.xml` file in your Android app. It specifically states that if your app targets Android 12 (or higher), you must explicitly set the value for the `android:exported` attribute when you have an `intent-filter` defined for a component in your app.
(此错误消息表示您的Android应用程序中的“AndroidManifest.xml”文件存在问题。它特别指出,如果您的应用程序以Android 12(或更高版本)为目标,则当您为应用程序中的组件定义了“intent filter”时,必须显式设置“Android:exported”属性的值。)
The `android:exported` attribute specifies whether or not an activity, service, or broadcast receiver is exported, meaning that it can be started by other apps. If you have an `intent-filter` defined for a component, you must set `android:exported` to either `true` or `false` to specify if the component should be exported or not.
(“android:exported”属性指定是否导出活动、服务或广播接收器,这意味着它可以由其他应用程序启动。如果为组件定义了“intent filter”,则必须将“android:exported”设置为“true”或“false”,以指定是否应导出组件。)
Here's an example of how you can specify `android:exported` for an activity in your `AndroidManifest.xml`:
(下面是一个示例,说明如何为“AndroidManifest.xml”中的活动指定“android:exported”:)
```
<activity android:name=".MainActivity" android:exported="true"
> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity>
```
In the example above, `android:exported` is set to `true`, meaning that the MainActivity is exported and can be started by other apps. If you want to make the MainActivity not exported, you can set `android:exported` to `false`.
(在上面的示例中,“android:exported”设置为“true”,这意味着MainActivity已导出,可以由其他应用程序启动。如果要使MainActivity不导出,可以将“android:exported”设置为“false”。)
=======================================================================================================================================================
不得不说,Gpt确实厉害。
» 下一篇: 2023-02-23 {"errMsg": "getImageInfo:fail download image fail. reason: downloadFile:fail url not in domain list"}
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· DeepSeek 开源周回顾「GitHub 热点速览」
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了