简体   繁体   English

Flutter:处理清单失败

[英]Flutter : Failed processing manifest

Below is the problem i'm facing right now when using VSCode flutter to debug.以下是我现在使用 VSCode flutter 进行调试时遇到的问题。

FAILURE: Build failed with an exception. FAILURE:构建失败并出现异常。

  • What went wrong: Execution failed for task ':app:processDebugResources'.出了什么问题:任务“:app:processDebugResources”执行失败。

    Android resource linking failed /Users/jbyen/code/testing/build/app/intermediates/merged_manifests/debug/AndroidManifest.xml:58: AAPT: error: resource style/Theme.AppCompat.Light.NoActionBar (aka com.example.crystagram:style/Theme.AppCompat.Light.NoActionBar) not found. Android resource linking failed /Users/jbyen/code/testing/build/app/intermediates/merged_manifests/debug/AndroidManifest.xml:58: AAPT: error: resource style/Theme.AppCompat.Light.NoActionBar (aka com.example.crystagram :style/Theme.AppCompat.Light.NoActionBar) 未找到。

  • error: failed processing manifest.错误:处理清单失败。
  • BUILD FAILED in 31s 31 秒内构建失败
  • The built failed likely due to AndroidX incompatibilities in a plugin.构建失败可能是由于插件中的 AndroidX 不兼容。 The tool is about to try using Jetfier to solve the incompatibility.该工具即将尝试使用Jetfier解决不兼容问题。 Building plugin cloud_firestore...构建插件 cloud_firestore...
  • The plugin cloud_firestore could not be built due to the issue above.由于上述问题,无法构建插件 cloud_firestore。

My project build.gradle:我的项目 build.gradle:

buildscript {
    ext.kotlin_version = '1.3.21'
    repositories {
        google()
        jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.4.1'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath 'com.google.gms:google-services:4.3.2'
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

rootProject.buildDir = '../build'
subprojects {
    project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
    project.evaluationDependsOn(':app')
}

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

My project gradle.properties:我的项目 gradle.properties:

org.gradle.jvmargs=-Xmx1536M
android.enableJetifier=true
android.useAndroidX=true
android.enableR8=true

My project app build.gradle:我的项目应用程序 build.gradle:

def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
    localPropertiesFile.withReader('UTF-8') { reader ->
        localProperties.load(reader)
    }
}

def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
    throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
    flutterVersionCode = '1'
}

def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
    flutterVersionName = '1.0'
}

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
    compileSdkVersion 28

    sourceSets {
        main.java.srcDirs += 'src/main/kotlin'
    }

    lintOptions {
        disable 'InvalidPackage'
    }

    defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "com.example.testing"
        minSdkVersion 18
        targetSdkVersion 28
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        multiDexEnabled true
    }

    buildTypes {
        release {
            // TODO: Add your own signing config for the release build.
            // Signing with the debug keys for now, so `flutter run --release` works.
            signingConfig signingConfigs.debug
        }
    }
}

flutter {
    source '../..'
}

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'com.google.firebase:firebase-analytics:17.2.0'
    implementation 'androidx.multidex:multidex:2.0.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.1.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
}

apply plugin: 'com.google.gms.google-services'

I adding this 2 dependencies to solve the failed processing manifest error.我添加了这 2 个依赖项来解决失败的处理清单错误。

dependencies {
    implementation 'com.android.support:support-v4:28.1.0'
    implementation 'com.google.android.material:material:1.0.0'
}

For me, it was because I had an invalid AndroidManfiest.xml file.对我来说,这是因为我有一个无效的 AndroidManfiest.xml 文件。 When implementing Branch.io, I copied and pasted the directly without recognizing I should have merged that in with my existing MainActivity在实现 Branch.io 时,我直接复制并粘贴了它,但没有意识到我应该将它与我现有的MainActivity合并

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM