当我将 Phone 更新为 Android 12 时,安装没有成功。无法安装应用程序:INSTALL_PARSE_FAILED_MANIFEST_MALFORMED

When I Update my Phone to Android 12, Installation did not succeed. The application could not be installed: INSTALL_PARSE_FAILED_MANIFEST_MALFORMED

自从我将 phone 更新为 Android 12 以来,我一直在完美地处理我的项目,不幸的是,当我 运行 我的 phone 项目出现此错误时:

Installation did not succeed. The application could not be installed: INSTALL_PARSE_FAILED_MANIFEST_MALFORMED

List of apks: [0] 'C:\Users\Microsoft\AndroidStudioProjects\YmmyServer\app\build\outputs\apk\debug\app-debug.apk' Installation failed due to: 'null' Retry

这是我的build.gradle(项目)文件:

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.google.gms:google-services:4.3.10'
        classpath 'com.android.tools.build:gradle:4.0.0'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()
        maven { url "https://jitpack.io" }
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

这是我的build.gradle(模块)文件:

plugins {
    id 'com.android.application'
}

android {
    compileSdkVersion 32
    buildToolsVersion "30.0.3"

    defaultConfig {
        applicationId "com.example.ymmyserver"
        minSdkVersion 30
        targetSdkVersion 32
        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
    }
}
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
dependencies {

    implementation 'com.github.jd-alexander:android-flat-button:v1.1'
//    implementation 'info.hoang8f:fbutton:1.0.5'
    implementation 'com.google.firebase:firebase-auth'
    implementation 'com.google.firebase:firebase-storage'
    implementation 'com.firebaseui:firebase-ui-database:8.0.0'
    implementation 'com.squareup.picasso:picasso:2.71828'
    implementation "androidx.cardview:cardview:1.0.0"
    implementation "androidx.recyclerview:recyclerview:1.2.1"
    implementation 'com.rengwuxian.materialedittext:library:2.1.4'
    implementation 'com.google.firebase:firebase-core:10.2.0'
    implementation 'com.google.firebase:firebase-database'
    implementation 'com.google.firebase:firebase-analytics'
    implementation platform('com.google.firebase:firebase-bom:29.1.0')
    implementation 'androidx.appcompat:appcompat:1.4.1'
    implementation 'com.google.android.material:material:1.5.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
    implementation 'androidx.navigation:navigation-fragment:2.4.1'
    implementation 'androidx.navigation:navigation-ui:2.4.1'
    implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.4.1'
    implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.4.1'
    testImplementation 'junit:junit:4.+'
    androidTestImplementation 'androidx.test.ext:junit:1.1.3'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}

这是 Mainifest 文件:

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

    <application
        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/Theme.Ymmy">
        <activity android:name=".FoodList"></activity>
        <activity
            android:name=".Home"
            android:label="@string/title_activity_home"
            android:theme="@style/Theme.Ymmy.NoActionBar"></activity>
        <activity android:name=".SignIn" />
        <activity android:name=".MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

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

</manifest>

我该怎么办请帮帮我

通过在清单文件的主要 Activity 上添加 android:exported="true" 解决:

<activity android:name=".MainActivity"
        android:exported="true">

尝试在 AndroidManifest.xml 文件中为 activity

使用此标签
<activity 
   android:name=".MainActivity"
   android:exported="true">