当我尝试运行我的 flutter 应用程序时出现此错误:
警告:映射新的 nshttp://schemas.android.com/repository/android/common/02 http://schemas.android.com/repository/android/common/02到老nshttp://schemas.android.com/repository/android/common/01 http://schemas.android.com/repository/android/common/01警告:映射新的 nshttp://schemas.android.com/repository/android/generic/02 http://schemas.android.com/repository/android/generic/02到老nshttp://schemas.android.com/repository/android/generic/01 http://schemas.android.com/repository/android/generic/01警告:映射新的 nshttp://schemas.android.com/sdk/android/repo/addon2/02 http://schemas.android.com/sdk/android/repo/addon2/02到老nshttp://schemas.android.com/sdk/android/repo/addon2/01 http://schemas.android.com/sdk/android/repo/addon2/01警告:映射新的 nshttp://schemas.android.com/sdk/android/repo/repository2/02 http://schemas.android.com/sdk/android/repo/repository2/02到老nshttp://schemas.android.com/sdk/android/repo/repository2/01 http://schemas.android.com/sdk/android/repo/repository2/01警告:映射新的 nshttp://schemas.android.com/sdk/android/repo/sys-img2/02 http://schemas.android.com/sdk/android/repo/sys-img2/02到老nshttp://schemas.android.com/sdk/android/repo/sys-img2/01 http://schemas.android.com/sdk/android/repo/sys-img2/01
失败:构建失败并出现异常。
- 什么地方出了错:
任务“:app:checkDebugDuplicateClasses”执行失败。
执行 com.android.build.gradle.internal.tasks.CheckDuplicatesRunnable 时发生故障
在模块 jetified-exoplayer-core-2.17.0-runtime (com.google.android.exoplayer:exoplayer-core:2.17.0) 和 jetified-exoplayer-ui 中发现重复的类 com.google.android.exoplayer2.ui.DownloadNotificationHelper -2.15.0-运行时(com.google.android.exoplayer:exoplayer-ui:2.15.0)
请参阅文档了解如何修复依赖项解析错误。
- 尝试:
使用 --stacktrace 选项运行以获取堆栈跟踪。使用 --info 或 --debug 选项运行以获得更多日志输出。使用 --scan 运行以获得完整的见解。
- 获得更多帮助https://help.gradle.org https://help.gradle.org
1m 47s 内构建失败
异常:Gradle 任务 assembleDebug 失败,退出代码为 1
我该如何修复这个错误?
以下是我的 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 flutter.compileSdkVersion
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.college_club"
minSdkVersion 21
targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
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 '../..'
}
apply plugin: 'com.google.gms.google-services'
android\build.gradle:
buildscript {
ext.kotlin_version = '1.6.10'
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.10'
}
}
allprojects {
repositories {
google()
mavenCentral()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
delete rootProject.buildDir
}
通过添加以下行来修复它/android/app/build.gradle
dependencies {
....
implementation ('com.google.android.exoplayer:exoplayer:2.17.0')
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)