Duplicate class com.google.android.exoplayer2.ui.DownloadNotificationHelper

914

Fixed it by adding below line in /android/app/build.gradle

dependencies {
    ....
    implementation ('com.google.android.exoplayer:exoplayer:2.17.0')
}
Share:
914
Sanket Kumar
Author by

Sanket Kumar

Updated on January 04, 2023

Comments

  • Sanket Kumar
    Sanket Kumar over 1 year

    Having this error while i was trying to run my flutter application:

    Warning: Mapping new ns http://schemas.android.com/repository/android/common/02 to old ns http://schemas.android.com/repository/android/common/01 Warning: Mapping new ns http://schemas.android.com/repository/android/generic/02 to old ns http://schemas.android.com/repository/android/generic/01 Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/addon2/02 to old ns http://schemas.android.com/sdk/android/repo/addon2/01 Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/repository2/02 to old ns http://schemas.android.com/sdk/android/repo/repository2/01 Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/sys-img2/02 to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01

    FAILURE: Build failed with an exception.

    • What went wrong: Execution failed for task ':app:checkDebugDuplicateClasses'.

    A failure occurred while executing com.android.build.gradle.internal.tasks.CheckDuplicatesRunnable Duplicate class com.google.android.exoplayer2.ui.DownloadNotificationHelper found in modules jetified-exoplayer-core-2.17.0-runtime (com.google.android.exoplayer:exoplayer-core:2.17.0) and jetified-exoplayer-ui-2.15.0-runtime (com.google.android.exoplayer:exoplayer-ui:2.15.0)

    Go to the documentation to learn how to Fix dependency resolution errors.

    • Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

    BUILD FAILED in 1m 47s Exception: Gradle task assembleDebug failed with exit code 1

    How can I fix this error.? Below are my build.gradle files:

    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 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
    }
    
    • Blundell
      Blundell about 2 years
    • Sanket Kumar
      Sanket Kumar about 2 years
      @Blundell tried, still same error
    • Blundell
      Blundell about 2 years
      Hmm not sure how you can get a jettifier error if jettifying is turned off? :-) unless you are directly depending on two jettified libraries?
    • esentis
      esentis about 2 years
      Getting exactly the same error after updating to Kotlin '1.6.10'. Have you found any solutions ?
  • Sanket Kumar
    Sanket Kumar about 2 years
    Thanks, but it didn't work, still having the same error
  • shuster
    shuster about 2 years
    It didn't help :/
  • shuster
    shuster about 2 years
    Adding this line solves the problem but in this case I have errors in Flutter with assets_audio_player package.
  • esentis
    esentis about 2 years
    Hey @shuster that's unfortunate. Check this issue github.com/flutter/flutter/issues/100948 it may assist you.
  • shuster
    shuster about 2 years
    It's related my issue, thanks. But still it didn't solve my problem. I will move to another package.