相关疑难解决方法(0)

添加了 android:exported 但仍然出现错误面向 Android 12 及更高版本的应用程序需要为 android:exported 指定显式值

我已添加android:exported="true"到清单中唯一的活动,但在将编译 sdk 和目标 sdk 版本更新为 31 后仍然出现以下错误。我还尝试重建项目、使缓存无效并重新启动,但这没有帮助

错误- Apps targeting Android 12 and higher are required to specify an explicit value for android:exported when the corresponding component has an intent filter defined. See https://developer.android.com/guide/topics/manifest/activity-element#exported for details.

AndroidManifest文件

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.xyz.abc">

    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />

    <application
        android:name=".framework.presentation.BaseApplication"
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity android:name="com.xyz.presentation.MainActivity"
            android:exported="true">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>
Run Code Online (Sandbox Code Playgroud)

合并清单错误

play-services-auth-api-phone:17.4.0 清单、leakcanary-android:2.0-alpha-3 清单、firebase-auth-interop:20.0.0 清单、生命周期-viewmodel:2.3.1 清单、浏览器:1.0。 0 …

android manifest android-manifest targetsdkversion android-12

47
推荐指数
6
解决办法
8万
查看次数

清单合并失败:针对 Android 12 的应用程序 - Android Studio 错误

首先,这不是重复的。

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

***Manifest merger failed: Apps targeting Android 12 and higher are required to specify an explicit value for `android: exported` when the corresponding component has an intent filter defined. See https://developer.android.com/guide/topics/manifest/activity-element#exported for details.***
Run Code Online (Sandbox Code Playgroud)

请任何人都可以帮助我吗?

这是一个截图...

这是一个截图。

java android runtime-error android-emulator android-studio

29
推荐指数
8
解决办法
2万
查看次数

针对 Android 12 的清单合并失败

使用 Android Studio 4.2.1,在我的 build.gradle 文件中将 sdk 目标更改为 Android 12 后,出现Manifest merger failed with multiple errors, see logs错误。

Merged Manifest选项卡中显示的错误如下:

Merging Errors: 
Error: Apps targeting Android 12 and higher are required to specify an explicit value for `android:exported` when the corresponding component has an intent filter defined. See https://developer.android.com/guide/topics/manifest/activity-element#exported for details. My_App.app main manifest (this file) 
Error: Apps targeting Android 12 and higher are required to specify an explicit value for `android:exported` when the corresponding component has …
Run Code Online (Sandbox Code Playgroud)

android android-manifest android-studio android-12

17
推荐指数
3
解决办法
5839
查看次数

您上传了一个 APK 或 Android App Bundle,其中包含带有意图过滤器的活动、活动别名、服务或广播接收器,

您好,任何人都可以帮助我,我只需按照此处的说明进行操作:developer.android.com/about/versions/12/behavior-changes-12#exported

但我仍然收到相同的错误“您上传了一个 APK 或 Android 应用程序包,其中包含带有意图过滤器的活动、活动别名、服务或广播接收器,但没有设置“android:exported”属性。无法安装此文件在 Android 12 或更高版本上。请参阅:developer.android.com/about/versions/12/behavior-changes-12#exported”

将文件上传到 google play consule 应用程序包发布时

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.HatidRider.app"
xmlns:tools="http://schemas.android.com/tools">
<!-- io.flutter.app.FlutterApplication is an android.app.Application that
     calls FlutterMain.startInitialization(this); in its onCreate method.
     In most cases you can leave this as-is, but you if you want to provide
     additional functionality it is fine to subclass or reimplement
     FlutterApplication and put your custom class here. -->
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION"/>

<queries>
    <intent>
        <action android:name="android.intent.action.VIEW" /> …
Run Code Online (Sandbox Code Playgroud)

flutter

8
推荐指数
1
解决办法
9589
查看次数

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

我已将 SDK 版本更新为 31,之后出现此错误。这是我的摇篮:

    android {
    compileSdkVersion 31

    defaultConfig {
        applicationId "com.persiandesigners.alldentshops"
        minSdkVersion 16
        targetSdkVersion 31
        vectorDrawables.useSupportLibrary = true
        versionCode 1
        versionName "1"
    }

    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
    lintOptions {
        checkReleaseBuilds false
        abortOnError false
    }
}

dependencies {
    implementation 'androidx.appcompat:appcompat:1.4.0'
    implementation 'androidx.recyclerview:recyclerview:1.2.0-alpha01'
    implementation 'androidx.cardview:cardview:1.0.0-alpha01'
    implementation 'com.google.android.material:material:1.2.0-alpha01'
    implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta4'
Run Code Online (Sandbox Code Playgroud)

我收到此错误:清单合并失败:需要显式指定 android:exported for 。android:exported当相应组件定义了意图过滤器时,面向 Android 12 及更高版本的应用需要指定显式值。有关详细信息,请参阅 https://developer.android.com/guide/topics/manifest/activity-element#exported。

我按照它说的做了,这是我的清单代码:

<activity
        android:name="mypackage.MainActivity"
        android:exported="true"
        tools:node="merge"
        android:label="@string/app_name"
        android:screenOrientation="portrait"
        android:theme="@style/SplashScreenTheme"
        android:windowSoftInputMode="stateAlwaysHidden">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" …
Run Code Online (Sandbox Code Playgroud)

android android-manifest android-sdk-tools android-12

5
推荐指数
1
解决办法
6828
查看次数

Android Studio,更新 build.gradle TargetSdkVersion 31 问题

我们正在使用 targetSdkVersion 30,我正在尝试将其更新到 31

当我将 targetSdkVersion 设置为 31 时,我无法运行/编译该应用程序,因为它在 manifest.xml 中出现构建失败错误:

android:exported 需要明确指定。android:exported当相应组件定义了意图过滤器时,面向 Android 12 及更高版本的应用需要指定显式值。 有关详细信息,请参阅 https://developer.android.com/guide/topics/manifest/activity-element#exported 。src/main/AndroidManifest.xml

我检查了清单文件,为每个活动添加了 android:exported = true/false,接收者!

如果我将目标 SDK 版本设置为 30,则没有问题,但设置为 31,并且我确信我已将 android:exported 添加到清单中的所有适用组件

请帮我

android android-manifest kotlin android-studio build.gradle

4
推荐指数
1
解决办法
2万
查看次数

React Native:依赖项的 AAR 元数据中指定的 minCompileSdk (31) 大于此模块的compileSdkVersion (android-30)

我正在使用 React Native:

npx react-native run-android
Run Code Online (Sandbox Code Playgroud)

我还有很多其他解决方案。比如强制或更新targetsdk版本并编译SDK版本,但没有任何效果。

我尝试将compileSdkVersion 30更改为compileSdkVersion 31,将targetSdkVersion 30更改为targetSdkVersion 31。

问题

依赖项的 AAR 元数据 (META-INF/com/android/build/gradle/aar-metadata.properties) 中指定的 minCompileSdk (31) 大于此模块的compileSdkVersion (android-30)。

Dependency: androidx.appcompat:appcompat:1.4.1.
Run Code Online (Sandbox Code Playgroud)

我的 build.gradle 文件

// Top-level build file where you can add configuration
// options common to all sub-projects/modules.

buildscript {
    ext {
        buildToolsVersion = "30.0.2"
        minSdkVersion = 21
        compileSdkVersion = 31
        targetSdkVersion = 31
        ndkVersion = "21.4.7075529"
        firebaseMessagingVersion = "21.1.0"
        googlePlayServicesVisionVersion = "19.0.0"
        playServicesVersion = "17.0.0" // or find latest version
        androidMapsUtilsVersion = "2.2.5"
        kotlin_version = …
Run Code Online (Sandbox Code Playgroud)

android react-native

4
推荐指数
1
解决办法
5164
查看次数

facing below error "tools:node" associated with an element type "uses-permission" is not bound

We are facing issue related manifest marge after changed in merged file error is:

"The prefix "tools" for attribute "tools:node" associated with an element type "uses-permission" is not bound."

Why this error occur and how to solve this ?

We are trying to add line in application tag for override but not solve ,searching more all gives answer to add line in top for tools added this but also not solve.

After replace manifest with old files but also giving …

android android-layout

3
推荐指数
2
解决办法
906
查看次数

即使我已经指定了“android:exported”,也需要为 &lt;activity&gt; 显式指定它

我正在尝试 DJI SDK,并正在按照本教程了解如何将 SDK 集成到我创建的 Android Studio 项目中。我已将所有内容复制到文件名,唯一的区别是我在MainActivity.java.

当我尝试构建项目时出现以下错误:

> Task :app:processDebugMainManifest FAILED
[path to projects]\AndroidStudioProjects\ImportSDKDemo\app\src\main\AndroidManifest.xml Error:
    android:exported needs to be explicitly specified for <activity>. Apps targeting Android 12 and higher are required to specify an explicit value for `android:exported` when the corresponding component has an intent filter defined. See https://developer.android.com/guide/topics/manifest/activity-element#exported for details.

See http://g.co/androidstudio/manifest-merger for more information about the manifest merger.


Execution failed for task ':app:processDebugMainManifest'.
> Manifest merger failed : android:exported needs to be …
Run Code Online (Sandbox Code Playgroud)

android android-studio dji-sdk

3
推荐指数
1
解决办法
1万
查看次数