Android "mainMergedManifest" 不存在

Android "mainMergedManifest" does not exist

我遇到了以下错误代码的构建问题:

A problem was found with the configuration of task ':app:processDebugManifest' (type 'ProcessMultiApkApplicationManifest').

File 'E:\DK\app\build\intermediates\merged_manifest\debug\out\AndroidManifest.xml' specified for property 'mainMergedManifest' does not exist.

build.gradle

apply plugin: 'com.android.application'
android {
compileSdkVersion 29
buildToolsVersion "29.0.2"
defaultConfig {
    applicationId "com.example.sample"
    minSdkVersion 21
    targetSdkVersion 29
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
    }
}

compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}
}

dependencies {
// Import the BoM for the Firebase platform
implementation platform('com.google.firebase:firebase-bom:26.1.0')

// Declare the dependency for the Firebase Authentication library
// When using the BoM, you don't specify versions in Firebase library dependencies
implementation 'com.google.firebase:firebase-auth'

implementation 'com.google.android.material:material:1.2.1'

implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'com.google.firebase:firebase-auth:16.0.5'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
implementation 'com.google.firebase:firebase-database:19.5.1'
implementation 'com.google.firebase:firebase-storage:19.2.0'
implementation 'com.github.bumptech.glide:glide:4.11.0'
implementation 'com.google.gms:google-services:4.3.4'
    implementation 'androidx.browser:browser:1.2.0'
}
apply plugin: 'com.google.gms.google-services'

AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.sample">
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

<application
    android:allowBackup="true"
    android:icon="@drawable/logo"
    android:label="@string/app_name"

    android:roundIcon="@mipmap/ic_launcher_round"
    android:supportsRtl="true"
    android:theme="@style/AppTheme">
    <activity
        android:name=".Activities.SplashActivity"
        android:theme="@style/AppTheme.Launcher"
        android:windowSoftInputMode="adjustPan"
        android:screenOrientation="portrait"
        android:configChanges="orientation">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <action android:name="android.intent.action.VIEW" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity android:name=".Activities.LoginActivity"
        android:screenOrientation="portrait"
        android:configChanges="orientation"/>
    <activity android:name=".Activities.MainActivity"
        android:windowSoftInputMode="adjustPan"
        android:screenOrientation="portrait"
        android:configChanges="orientation"/>
    <activity android:name=".Activities.SignUpActivity"
        android:screenOrientation="portrait"
        android:configChanges="orientation"/>
    <activity android:name=".Activities.DebugActivity"
        android:screenOrientation="portrait"
        android:configChanges="orientation"/>
</application>

我是新手,我似乎无法弄清楚可能是什么问题。 我们正在一起开发一个应用程序,似乎没有人知道这个问题。 我们是初学者,几乎没有经验。

在您的 build.gradle 中,您有这两行:

compileSdkVersion 29

targetSdkVersion 29

当未安装该 sdk 版本或与虚拟设备上的 API 版本不匹配时(假设您使用的是模拟器),就会出现您显示的错误。

有两件事要检查:

工具->SDK管理器中,检查安装的SDK版本。您的项目正在针对 SDK 版本 29 进行编译,因此如果您没有安装 29 并且想要使用它,请安装它。或者,如果您安装了 30 版,只需将 build.gradle 中的这两行从“29”更改为“30”即可。

工具->AVD 管理器 中,检查您的虚拟设备的API 级别。匹配吗?如果没有,请创建一个匹配的新设备,或者只需安装匹配的 API 或如上所述更改 2 行代码。

此外,对于这一行:

minSdkVersion 21

确保也安装了 SDK 版本 21。

我遇到了同样的错误: “为 属性 'mainMergedManifest' 指定的 app\build\intermediates\merged_manifest\debug\out\AndroidManifest.xml' 不存在。”

解决方案:

  1. 更新项目结构

在项目结构->模块->属性中更新

  • 编译SDK版本= 30 (API 30 Android 11.0(R))
  • 构建工具版本= 30 .0.2

在项目结构->模块->默认配置中更新

  • 目标 SDK 版本 = 30 (API 30 Android 11.0(R))
  1. 更新 2 个文件作为下一个:

文件:build.gradle 类路径“com.android.tools.build:gradle:4.0.2

文件:gradle-wrapper.properties

行: distributionUrl=https://services.gradle.org/distributions/gradle-6.4.1-bin.zip

这是包含第 2 步解决方案的视频

https://www.youtube.com/watch?v=U420dx6C60I

英语:React Native 有问题吗? 我通过将项目移动到驱动器 C: 并使用 React Native 文档中推荐的相同 SDK 解决了这个错误。

英语:来自 React Native? 我解决了这个问题,将我的项目移动到本地磁盘 C:,确保您拥有文档推荐的相同 SDK。