首页 > 解决方案 > 任务“:app:checkReleaseDuplicateClasses”执行失败。扑

问题描述

请找到以下文件

1.app/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 30

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

    defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "com.example.mood_reader_demo"
        minSdkVersion 16
        targetSdkVersion 30
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
        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.android.support:multidex:1.0.3'
    implementation "com.google.firebase:firebase-auth:19.3.0"
    implementation 'com.google.android.gms:play-services-vision:20.0.0'
    implementation 'com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava'
    implementation 'com.google.firebase:firebase-dynamic-links:19.0.0'
    implementation 'androidx.appcompat:appcompat:1.0.2'
    implementation 'com.google.firebase:firebase-bom:25.12.0'
    implementation 'androidx.annotation:annotation:1.1.0'
    implementation "com.android.support:support-v4:27.1.1"
}

2. 安卓/build.gradle

buildscript {
    ext.kotlin_version = '1.3.50'
    repositories {
        maven {
    url "https://maven.google.com"
}
jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:4.1.3'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}

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

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

task clean(type: Delete) {
    delete rootProject.buildDir
}
  1. 发布规范.yaml

    环境:sdk:">=2.7.0 <3.0.0"

    依赖项:flutter:sdk:flutter get:^4.1.4 image_picker:^0.7.4 firebase_core:^1.0.3 firebase_ml_vision:^0.9.10 firebase_auth:^1.1.0

    库比蒂诺图标:^1.0.2

    dev_dependencies:flutter_test:sdk:flutter

    扑:

    使用材料设计:真实

4.错误

标签: androidfirebaseflutterdartfirebase-authentication

解决方案


我在我的 app/build.gradle 中做了以下更改

已移除

    implementation 'com.google.android.gms:play-services-vision:20.0.0
    implementation 'com.google.android.gms:play-services-vision:20.0.0'
    implementation 'com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava'
    implementation 'com.google.firebase:firebase-dynamic-links:19.0.0'
    implementation 'androidx.appcompat:appcompat:1.0.2'
    implementation 'com.google.firebase:firebase-bom:25.12.0'
    implementation 'androidx.annotation:annotation:1.1.0'
    implementation "com.android.support:support-v4:27.1.1"

此外,需要匹配您在 pubspec.yaml 中的依赖项


推荐阅读