g0dkar/qrcode-kotlin

Duplicate class conflicts

Closed this issue ยท 5 comments

Describe the bug
I import QRCode library and build in Android Studio
Gradle detect a lot of duplicate classes on library com.android.tools.external.com-intellij:intellij-core:30.1.2
full-output: https://pastebin.mozilla.org/upNGVtqc

After that I checking dependency tree using ./gradlew app:dependencies
It seems that com.android.tools.external.com-intellij:intellij-core is imported by com.android.tools.lint:lint-gradle

Am I use this library in the wrong way?

To Reproduce
Steps to reproduce the behavior. For example:

  1. import this library using implementation 'io.github.g0dkar:qrcode-kotlin-android:3.1.0'
  2. invoke gradle sync
  3. Make project
  4. error

Expected behavior

build sucessfully

Screenshots or other QRCodes rendered with other tools

Additional context

my app:build.gradle

plugins {
    id 'com.android.application'
    id 'org.jetbrains.kotlin.android'
    id 'org.jetbrains.kotlin.plugin.serialization'
    id 'kotlin-kapt'
    id 'dagger.hilt.android.plugin'
}

android {
    compileSdk 32

    defaultConfig {
        applicationId "at.mikuc.fcuassistant"
        minSdk 26
        targetSdk 32
        versionCode 1
        versionName "0.1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        vectorDrawables {
            useSupportLibrary true
        }
    }

    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
        debug {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    kotlinOptions {
        jvmTarget = '1.8'
    }
    buildFeatures {
        compose true
    }
    composeOptions {
        kotlinCompilerExtensionVersion compose_version
    }
    packagingOptions {
        resources {
            excludes += '/META-INF/{AL2.0,LGPL2.1}'
        }
    }
}

dependencies {

    implementation 'androidx.core:core-ktx:1.8.0'
    implementation "androidx.compose.ui:ui:$compose_version"
    implementation "androidx.compose.material:material:$compose_version"
    implementation "androidx.compose.material:material-icons-extended:$compose_version"
    implementation "androidx.compose.ui:ui-tooling-preview:$compose_version"
    
    implementation "androidx.lifecycle:lifecycle-runtime-ktx:$lifecycle_version"
    implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version"
    implementation 'androidx.activity:activity-compose:1.5.0'

    implementation "androidx.navigation:navigation-compose:$nav_version"
    api "androidx.navigation:navigation-fragment-ktx:$nav_version"

    implementation 'com.google.dagger:hilt-android:2.38.1'
    kapt 'com.google.dagger:hilt-compiler:2.38.1'
    implementation 'androidx.hilt:hilt-navigation-compose:1.0.0'

    implementation 'androidx.datastore:datastore-preferences:1.0.0'

    implementation 'org.burnoutcrew.composereorderable:reorderable:0.9.2'

    implementation 'io.github.g0dkar:qrcode-kotlin-android:3.1.0'

    implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.3")
    implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.3.3")
    implementation("io.ktor:ktor-client-core:$ktor_version")
    implementation("io.ktor:ktor-client-cio:$ktor_version")
    implementation("io.ktor:ktor-client-content-negotiation:$ktor_version")
    implementation("io.ktor:ktor-serialization-kotlinx-json:$ktor_version")

    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test.ext:junit:1.1.3'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
    androidTestImplementation "androidx.compose.ui:ui-test-junit4:$compose_version"
    debugImplementation "androidx.compose.ui:ui-tooling:$compose_version"
    debugImplementation "androidx.compose.ui:ui-test-manifest:$compose_version"
}

Heya! Thanks for getting in touch! I'll take a look and will get back to you as soon as I have something ^^

Possible workaround @mikucat0309
Change your Build.gradle import to the following:

implementation ("io.github.g0dkar:qrcode-kotlin-android:3.1.0") { exclude module: 'lint-gradle' }
The exclude removed the error for me. So no dupolicate classes anymore.

Hey @nexus421, @mikucat0309 and @roinuj39!

I've just released version 3.2.0, it should fix all of those issues! Can you try it out and let me know? ^^

Thanks for the patience, and thanks @nexus421 for the tip on the dependency thing <3

Hey @g0dkar

I updated the version and now I don't see the duplicate class conflict error anymore. Thank you! ๐Ÿš€

I've just released version 3.2.0, it should fix all of those issues! Can you try it out and let me know? ^^

It works, thank you! ๐ŸŒˆ