重复类 com.google.android.exoplayer2.ui.DownloadNotificationHelper

San*_*mar 8 java android gradle android-studio flutter

当我尝试运行我的 flutter 应用程序时出现此错误:

警告:将新的 ns http://schemas.android.com/repository/android/common/02映射到旧的 ns http://schemas.android.com/repository/android/common/01 警告:映射新的 ns http:// /schemas.android.com/repository/android/generic/02到旧 ns http://schemas.android.com/repository/android/generic/01 警告:映射新 ns http://schemas.android.com/sdk /android/repo/addon2/02到旧 ns http://schemas.android.com/sdk/android/repo/addon2/01 警告:映射新 ns http://schemas.android.com/sdk/android/repo /repository2/02到旧的 ns http://schemas.android.com/sdk/android/repo/repository2/01 警告:映射新的 ns http://schemas.android.com/sdk/android/repo/sys-img2 /02到旧 NS 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-2.15.0-runtime (com.google.android.exoplayer:exoplayer-ui:2.15.0)

请参阅文档了解如何修复依赖项解析错误。

  • 尝试:使用 --stacktrace 选项运行以获取堆栈跟踪。使用 --info 或 --debug 选项运行以获得更多日志输出。使用 --scan 运行以获得完整的见解。

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'
Run Code Online (Sandbox Code Playgroud)

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
}
Run Code Online (Sandbox Code Playgroud)

ese*_*tis 21

通过添加以下行来修复它/android/app/build.gradle

dependencies {
    ....
    implementation ('com.google.android.exoplayer:exoplayer:2.17.0')
}
Run Code Online (Sandbox Code Playgroud)

  • 嘿@shuster,这很不幸。检查这个问题https://github.com/flutter/flutter/issues/100948它可能会帮助你。 (2认同)