Android“mainMergedManifest”不存在

Ale*_*lag 7 android build android-studio

我遇到构建问题,错误代码如下:

A problem was found with the configuration of task ':app:processDebugManifest' (type 'ProcessMultiApkApplicationManifest').
Run Code Online (Sandbox Code Playgroud)

为属性“mainMergedManifest”指定的文件“E:\DK\app\build\intermediates\merged_manifest\debug\out\AndroidManifest.xml”不存在。

构建.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'
Run Code Online (Sandbox Code Playgroud)

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>
Run Code Online (Sandbox Code Playgroud)

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

Gim*_*411 5

在你的 build.gradle 中,你有以下两行:

compileSdkVersion 29
Run Code Online (Sandbox Code Playgroud)

targetSdkVersion 29
Run Code Online (Sandbox Code Playgroud)

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

有两件事需要检查:

Tools->SDK Manager中,检查安装的 SDK 版本。您的项目正在针对 SDK 版本 29 进行编译,因此如果您尚未安装 29 版本但想要使用它,请安装它。或者,如果您安装了版本 30,只需将 build.gradle 中的这两行从“29”更改为“30”即可。

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

另外,对于这一行:

minSdkVersion 21
Run Code Online (Sandbox Code Playgroud)

确保 SDK 版本 21 也已安装。