# Duplicate class found error

**URL:** https://discuss.gradle.org/t/duplicate-class-found-error/49880
**Category:** Help/Discuss
**Created:** [November 14, 2024, 3:10am UTC](https://discuss.gradle.org/t/duplicate-class-found-error/49880 "2024-11-14T03:10:36Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Justy36](https://avatars.discourse-cdn.com/v4/letter/j/ee7513/32.png) [@Justy36](https://discuss.gradle.org/u/Justy36)
#### Post date: [November 14, 2024, 3:10am UTC](https://discuss.gradle.org/t/duplicate-class-found-error/49880/1 "2024-11-14T03:10:36Z")

</div>

error appened when I build pdf project use github implementation  
errors below:

```gradle
Duplicate class android.support.v4.os.ResultReceiver$MyResultReceiver found in modules core-1.9.0-runtime (androidx.core:core:1.9.0) and support-compat-25.3.1-runtime (com.android.support:support-compat:25.3.1)
Duplicate class android.support.v4.os.ResultReceiver$MyRunnable found in modules core-1.9.0-runtime (androidx.core:core:1.9.0) and support-compat-25.3.1-runtime (com.android.support:support-compat:25.3.1)

```

settings.gradle.kts below:

```gradle
pluginManagement {
    repositories {
        google()
        mavenCentral()
        gradlePluginPortal()
    }
}
dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        google()
        mavenCentral()
        gradlePluginPortal()//new added
        maven { url=uri("https://jitpack.io") }//new added
        maven { url=uri("https://repository.liferay.com/nexus/content/repositories/public/") }//new added
    }
}

rootProject.name = "DBT2"
include(":app")

```

below module(app) build.gradle.kts:

```gradle
plugins {
    id("com.android.application")
}

android {
    namespace = "aa.app.dbt2"
    compileSdk = 34

    defaultConfig {
        applicationId = "aa.app.dbt2"
        minSdk = 24
        targetSdk = 34
        versionCode = 1
        versionName = "1.0"

        testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            isMinifyEnabled = false
            proguardFiles(
                getDefaultProguardFile("proguard-android-optimize.txt"),
                "proguard-rules.pro"
            )
        }
    }
    compileOptions {
        sourceCompatibility = JavaVersion.VERSION_1_8
        targetCompatibility = JavaVersion.VERSION_1_8
    }
}

dependencies {
    implementation ("com.github.barteksc:android-pdf-viewer:2.8.2")//new added

    implementation("androidx.appcompat:appcompat:1.6.1")
    implementation("com.google.android.material:material:1.9.0")
    implementation("androidx.constraintlayout:constraintlayout:2.1.4")
    testImplementation("junit:junit:4.13.2")
    androidTestImplementation("androidx.test.ext:junit:1.1.5")
    androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1")
}

```

attention: implementation(“androidx.appcompat:appcompat:1.6.1”) ;Dependencies using groupId com.android.support and androidx.\* can not be combined but found com.android.support:support-v4:25.3.1 and androidx.appcompat:appcompat:1.6.1 incompatible dependencies

---

<div class="post-metadata">

### Author: ![Vampire](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/vampire/32/9082_2.png) [@Vampire](https://discuss.gradle.org/u/Vampire)
#### Post date: [November 14, 2024, 2:24pm UTC](https://discuss.gradle.org/t/duplicate-class-found-error/49880/2 "2024-11-14T14:24:13Z")

</div>

Your error sounds pretty clear.  
You depend on `com.github.barteksc:android-pdf-viewer:2.8.2`  
which depends on `com.github.barteksc:pdfium-android:1.7.1`  
which depends on `com.android.support:support-v4:25.3.1`.  
And you have dependencies on `androidx...` dependencies.  
And your error says you cannot combine these.  
Looking at the repository of that pdf viewer dependency shows that it was not touched in many years, so I guess that project might be unmaintained and just not compatible with recent ecosystem.

---

<div class="post-metadata">

### Author: ![Justy36](https://avatars.discourse-cdn.com/v4/letter/j/ee7513/32.png) [@Justy36](https://discuss.gradle.org/u/Justy36)
#### Post date: [November 19, 2024, 2:02pm UTC](https://discuss.gradle.org/t/duplicate-class-found-error/49880/3 "2024-11-19T14:02:54Z")

</div>

Thanks，several days I read your reply but not understand,today I tried again and ask for gpt,it tells me  
solution methods and finally app run very well by adding below two lines:

```gradle
android.useAndroidX=true//default
android.enableJetifier=true//I added

```
