请找到以下文件
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. android/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
}
pubspec.yaml
环境: sdk:">=2.7.0 <3.0.0"
依赖: 扑: sdk:颤动 得到:^4.1.4 图像选择器:^0.7.4 firebase_core:^1.0.3 firebase_ml_vision:^0.9.10 firebase_auth:^1.1.0
cupertino_icons:^1.0.2
dev_dependencies: 颤振测试: sdk:颤动
颤动:
使用材料设计:真实
4.错误
出了什么问题:
任务“:app:checkReleaseDuplicateClasses”执行失败。
<块引用>执行 com.android.build.gradle.internal.tasks.CheckDuplicatesRunnable 时发生故障 > 在模块 jetified-play-services-vision-20.0.0-runtime (com.google.android.gms:play-services-vision:20.0.0) 中发现重复类 com.google.android.gms.internal.vision.zze ) 和 jetified-play-services-vision-common-19.1.0-runtime (com.google.android.gms:play-services-vision-common:19.1.0) 在模块 jetified-play-services-vision-20.0.0-runtime (com.google.android.gms:play-services-vision:20.0.0) 中发现重复类 com.google.android.gms.internal.vision.zzf和 jetified-play-services-vision-common-19.1.0-runtime (com.google.android.gms:play-services-vision-common:19.1.0) 在模块 jetified-play-services-vision-20.0.0-runtime (com.google.android.gms:play-services-vision:20.0.0) 中发现重复类 com.google.android.gms.internal.vision.zzg和 jetified-play-services-vision-common-19.1.0-runtime (com.google.android.gms:play-services-vision-common:19.1.0) 在模块 jetified-play-services-vision-20.0.0-runtime (com.google.android.gms:play-services-vision:20.0.0) 中发现重复类 com.google.android.gms.internal.vision.zzh和 jetified-play-services-vision-common-19.1.0-runtime (com.google.android.gms:play-services-vision-common:19.1.0) 在模块 jetified-play-services-vision-20.0.0-runtime (com.google.android.gms:play-services-vision:20.0.0) 中发现重复类 com.google.android.gms.internal.vision.zzi和 jetified-play-services-vision-common-19.1.0-runtime (com.google.android.gms:play-services-vision-common:19.1.0) 在模块 jetified-play-services-vision-20.0.0-runtime (com.google.android.gms:play-services-vision:20.0.0) 中发现重复类 com.google.android.gms.internal.vision.zzv和 jetified-play-services-vision-common-19.1.0-runtime (com.google.android.gms:play-services-vision-common:19.1.0) 在模块 jetified-play-services-vision-20.0.0-runtime (com.google.android.gms:play-services-vision:20.0.0) 中发现重复类 com.google.android.gms.internal.vision.zzw和 jetified-play-services-vision-common-19.1.0-runtime (com.google.android.gms:play-services-vision-common:19.1.0)
Go to the documentation to learn how to <a href="d.android.com/r/tools/classpath-sync-errors">Fix dependency resolution errors</a>.
试试: 使用 --stacktrace 选项运行以获取堆栈跟踪。使用 --info 或 --debug 选项运行以获得更多日志输出。使用 --scan 运行以获得完整的见解。
构建在 23 秒内失败
正在运行 Gradle 任务 'assembleRelease'...
运行 Gradle 任务 'assembleRelease'... 完成
答案 0 :(得分:0)
我在 app/build.gradle 中做了以下更改
已删除
# 'clean' is already a git command, so we'll use another alias :
$ git config --global alias.clean-repo '! git fetch -p origin && git branch -r ...'
# with this alias on, you can invoke it using :
$ git clean-repo
# this will also work from within 'find ... -exec <command>' :
$ find ... -exec git clean-repo
另外,需要在 pubspec.yaml 中匹配您的依赖项