首页 > 其他分享 >2023-02-14 Apps targeting Android 12 and higher are required to specify an explicit val

2023-02-14 Apps targeting Android 12 and higher are required to specify an explicit val

时间:2023-02-14 10:34:28浏览次数:48  
标签:02 xml 12 targeting 应用程序 exported AndroidManifest android Android

新建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确实厉害。

标签:02,xml,12,targeting,应用程序,exported,AndroidManifest,android,Android
From: https://www.cnblogs.com/iuniko/p/17118834.html

相关文章

  • Helix QAC 2022.4 中的新增功能
     前言  HelixQAC2022.4为MISRAC:2012AMD3提供了100%的规则覆盖,数据流被拆分为一个新的组件,提供了改进的分析性能,并升级了对C++20和C23的语言支持。 此外,此版......
  • 12-Verilog-同步FIFO设计
    同步FIFO和异步FIFOFIFO分为一个同步FIFO,一个异步FIFO,FIFO有读口和写口读写时钟是一个,就是同步FIFO;读写时钟不是一个,异步FIFOIP核设计中,一般使用同步FIFO设计SO......
  • 2023年2月14日第十一节课 linux 网络相关
    第十一节课linux网络相关安装net-tools(ifconfig)[root@localhost~]#yuminstall-ynet-tools[root@localhost~]#ifconfigens33:flags=4163<UP,BROADCAST,RU......
  • clion 2022 win10上编译的程序不可运行---问题解决
    会报错,0xc000007b网上说,可能是dll库丢失等问题,我试了无效我的修复过程如下编译的时候,默认是使用ninja,将buildtool改成make即可 ......
  • Visual Studio 2022 安装低版本的 .Net Framework(2.0~4.5)
    首先打开VisualStudioInstaller可以看到vs2022只支持安装4.6及以上的版本,如图所示。那么该如何安装4.6以下的版本,下面将详细介绍。 安装4.0~4.5系列首先......
  • 2022/02/13--开学考总结
    我甚至找不出我写的东西的优点,那来总结下思路吧。思路:首先,应该对项目需求了解。对需求分析,然后建数据库的表,分析有三部分:评论为一个板块,新闻为一个板块,人的板块。其次,应......
  • 12. Oracle的初始化参数和性能视图
    一.性能参数1.CPUparametercpu_count:显示的是逻辑cpu数量(thread),主要是对并行度有影响2.Memoryparameterpga_aggregate_target:可以自动对pga进行调......
  • 2023.2.13环保环保监测中心网络新闻发布系统
         2021级《软件工程》课前测试试卷(180分钟) 河北省环保监测中心网络新闻发布系统(卷面成绩40分,占课程过程考核20分) 1、项目需求:河北省环保监测中心网络新闻......
  • x210-2023-02-13
    1、虚拟机能够识别到SD卡读卡器,但是只要一点击连接就会导致蓝屏,由于是在笔记本上,只有两个USB口,尝试过插到另一个USB口,但不可行,又由于SD卡读卡器识别出来的USB为3.0的,所以继......
  • 「考试总结」2023-02-13 联合省选模拟赛 – Day1
    爆搜$\texttt{(dfs)}$$\texttt{Statement}$给定一个$n$个点$m$条边的简单无向图,你需要对所有匹配$S$,把$c^{|S|}$求和,其中$|S|$是匹配......