本文介绍了清单合并失败:针对 Android 12 的应用程序 - Android Studio 错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已将模拟器版本和 Android SDK 版本更新为 Android S (Android 12).更新后,我无法运行该项目.我无法运行 hello world 项目(空项目),但我可以构建成绩,但无法运行该项目.我总是收到错误:

清单合并失败:针对 Android 12 及更高版本的应用程序是需要为 android:exported 指定一个显式值,当相应的组件定义了一个意图过滤器.看

那么问题是在使用android 12 SDK时如何解决这个问题?问题 是关于将解决方案应用于此后的问题,此问题不同比重复提到的问题,这个问题比这个>

解决方案

您需要指定 android:exported="false"android:exported="true"代码>

清单:

<意图过滤器><action android:name="android.intent.action.MAIN";/><category android:name="android.intent.category.LAUNCHER";/></意图过滤器></活动>

文档

如果您的应用面向 Android 12 并且包含活动、服务或使用意图过滤器的广播接收器,您必须明确为这些应用组件声明 android: 导出属性.

警告:如果活动、服务或广播接收器使用意图过滤器并且没有明确声明的值android:exported,你的应用无法安装在运行的设备上安卓 12.

另外检查何时对'使用真/假android:exported' 值

I hava updated my emulator version and Android SDK version to Android S (Android 12). After the update, I cannot run the project. I cannot run a hello world project (empty project), but I can build Grades as well as but can not run the project. I always got the error :

Please anyone can help me?

Here is a screenshot:

So the question is how to solve this issue when using android 12 SDK?question is about the issue after applying the solution to this, This question is different than the question mentioned with the duplicate also this question is oldest than this

解决方案

You need to specify android:exported="false" or android:exported="true"

Manifest:

<activity
          android:name=".MainActivity"
          android:exported="true"
          android:theme="@style/Theme.MyApplication.NoActionBar">
          <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
          </intent-filter>
    </activity>

as mentioned in the document

Also check when to use true/false for 'android:exported' value

这篇关于清单合并失败:针对 Android 12 的应用程序 - Android Studio 错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-04 01:07
查看更多