Joseph Sanjaya
Joseph Sanjaya

Reputation: 741

Supertypes of the following classes cannot be resolved. on BaseQuickAdapter from BRVAH

My Project suddenly cannot build APK, with error e: Supertypes of the following classes cannot be resolved. Please make sure you have the required dependencies in the classpath: class com.chad.library.adapter.base.BaseQuickAdapter, unresolved supertypes: androidx.recyclerview.widget.RecyclerView.Adapter class com.chad.library.adapter.base.BaseViewHolder, unresolved supertypes: androidx.recyclerview.widget.RecyclerView.ViewHolder

the project is running fine when running or build on debug, but error occured when building android app bundle or APK.

my app gradle

apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.firebase.crashlytics'
apply plugin: 'kotlin-kapt'
apply plugin: 'com.jakewharton.butterknife'

android {
    compileOptions {
        coreLibraryDesugaringEnabled true
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    dexOptions {
        preDexLibraries = false
    }
    signingConfigs {
        release {
            Properties properties = new Properties()
            properties.load(project.rootProject.file('ci_signing.properties').newDataInputStream())
            storeFile file(properties.getProperty('storeFile'))
            keyAlias properties.getProperty('keyAlias')
            storePassword properties.getProperty('storePassword')
            keyPassword properties.getProperty('keyPassword')
        }
    }
    compileSdkVersion targetSdk
    buildToolsVersion versions.buildTools
    defaultConfig {
        applicationId "com.finansialku.mobile"
        minSdkVersion minSdk
        targetSdkVersion targetSdk
        versionCode versions.appCode
        versionName versions.appName
        multiDexEnabled true
        vectorDrawables.useSupportLibrary = true
        manifestPlaceholders = [
                onesignal_app_id: '9280ca0e-3602-4e11-90be-a064ad7c2ca8',
                onesignal_google_project_number: 'REMOTE'
        ]
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    buildFeatures {
        viewBinding = true
        dataBinding = true
    }
    testOptions {
        unitTests.returnDefaultValues = true
    }
    kotlinOptions {
        jvmTarget = JavaVersion.VERSION_1_8.toString()
    }
    buildTypes {
        release {
            debuggable false
            minifyEnabled true
            proguardFiles getDefaultProguardFile(
                    'proguard-android-optimize.txt'),
                    'proguard-rules.pro'
            signingConfig signingConfigs.release
        }

        debug {
            debuggable true
            minifyEnabled false
            ext.alwaysUpdateBuildId = false
        }
    }

    lintOptions {
        abortOnError false
        textReport true
    }
    packagingOptions {
        exclude 'LICENSE.txt'
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/ASL2.0'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/LICENSE'

        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/services/javax.annotation.processing.Processor'
        exclude 'META-INF/ECLIPSE_.SF'
        exclude 'META-INF/ECLIPSE_.RSA'

        exclude 'META-INF/DEPENDENCIES.txt'
        exclude 'META-INF/notice.txt'
        exclude 'META-INF/license.txt'
        exclude 'META-INF/dependencies.txt'
        exclude 'META-INF/core_release.kotlin_module'
        exclude 'META-INF/LGPL2.1'
        exclude 'META-INF/versions/*'   // exclude the versions folder
    }
}

dependencies {
    implementation project(':core')
    implementation project(':payment')
    implementation project(':feature-upgrade')
    implementation project(':feature-audiobook')
    implementation project(':feature-bundle')
    implementation project(':feature-event')
    implementation project(':feature-shipping')
    coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.0.10'
    configurations {
        all*.exclude group: 'com.android.support', module: 'support-v13'
    }
    implementation group: 'commons-validator', name: 'commons-validator', version: '1.4.0'
    def fragment_version = '1.3.0-beta01'
    implementation "androidx.fragment:fragment:$fragment_version"
    implementation "androidx.fragment:fragment-ktx:$fragment_version"
    debugImplementation "androidx.fragment:fragment-testing:$fragment_version"

    def lifecycle_version = "2.2.0"
    implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version"
    implementation "androidx.lifecycle:lifecycle-extensions:$lifecycle_version"
    implementation "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycle_version"
    implementation "androidx.lifecycle:lifecycle-runtime:$lifecycle_version"
    implementation "androidx.lifecycle:lifecycle-common-java8:$lifecycle_version"

    def emoji_version = "1.1.0"
    implementation "androidx.emoji:emoji:$emoji_version"
    implementation "androidx.emoji:emoji-appcompat:$emoji_version"
    implementation "androidx.emoji:emoji-bundled:$emoji_version"

    def nav_version = "2.3.0"
    implementation "androidx.navigation:navigation-fragment:$nav_version"
    implementation "androidx.navigation:navigation-ui:$nav_version"
    implementation "androidx.navigation:navigation-fragment-ktx:$nav_version"
    implementation "androidx.navigation:navigation-ui-ktx:$nav_version"

    implementation 'com.twilio:chat-android:5.1.1'
    implementation 'com.qiscus.sdk:chat-core:1.3.14'

    implementation core.firebase.core
    implementation core.firebase.crashlytics.ktx
    implementation core.firebase.crashlytics.java
    implementation core.firebase.analytics.ktx
    implementation core.firebase.analytics.java
    implementation 'com.google.firebase:firebase-messaging:20.3.0'
    implementation 'com.google.firebase:firebase-dynamic-links-ktx:19.1.1'

    implementation "androidx.viewpager2:viewpager2:1.1.0-alpha01"
    implementation "androidx.work:work-runtime-ktx:2.4.0"
    implementation 'androidx.multidex:multidex:2.0.1'

    def room_version = "2.2.5"
    implementation "androidx.room:room-ktx:$room_version"
    implementation "androidx.room:room-runtime:$room_version"
    kapt "androidx.room:room-compiler:$room_version"

    def appcompat_version = "1.3.0-alpha02"
    implementation "androidx.appcompat:appcompat:$appcompat_version"
    implementation "androidx.appcompat:appcompat-resources:$appcompat_version"
    implementation 'androidx.legacy:legacy-support-v13:1.0.0'
    implementation 'androidx.recyclerview:recyclerview:1.1.0'
    implementation 'androidx.cardview:cardview:1.0.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.0.2'
    implementation core.coreKtx

    implementation fileTree(include: ['*.jar'], dir: 'libs')
    androidTestImplementation('androidx.test.espresso:espresso-core:3.3.0', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    implementation 'commons-io:commons-io:2.6'
    kapt 'com.android.databinding:compiler:3.1.4'

    def butterknife_version = '10.2.3'
    implementation "com.jakewharton:butterknife:$butterknife_version"
    kapt "com.jakewharton:butterknife-compiler:$butterknife_version"

    implementation 'com.orhanobut:hawk:2.0.1'
    implementation core.utils
    implementation core.adapter
    implementation core.coroutines

    implementation core.koin.core
    implementation core.koin.core_ext
    testImplementation core.koin.test
    implementation core.koin.scope
    implementation core.koin.viewmodel
    implementation core.koin.fragment
    implementation core.koin.ext

    implementation 'com.google.android.gms:play-services-auth:18.1.0'
    implementation 'com.google.android.gms:play-services-places:17.0.0'
    implementation 'com.google.android.gms:play-services-gcm:17.0.0'
    implementation 'com.google.android.gms:play-services-analytics:17.0.0'
    implementation 'com.google.android.play:core:1.8.2'

    implementation 'com.google.android.material:material:1.3.0-alpha03'

    implementation core.retrofit.core
    implementation core.retrofit.gson
    implementation core.retrofit.scalar
    implementation core.retrofit.coroutines
    implementation core.retrofit.networking
    implementation core.retrofit.logging

    def markwon_version = '4.6.0'
    implementation "io.noties.markwon:core:$markwon_version"
    implementation "io.noties.markwon:image-coil:$markwon_version"
    implementation 'org.sufficientlysecure:html-textview:3.9'
    implementation 'com.airbnb.android:lottie:3.4.4'

    def glide_version = "4.11.0"
    implementation 'com.github.corouteam:GlideToVectorYou:v2.0.0'
    implementation "com.github.bumptech.glide:glide:$glide_version"
    kapt "com.github.bumptech.glide:compiler:$glide_version"

    implementation core.coil.core
    implementation core.coil.svg
    implementation core.coil.gif
    implementation 'com.github.chrisbanes:PhotoView:2.3.0'

    implementation 'androidx.biometric:biometric:1.0.1'
    implementation 'com.mixpanel.android:mixpanel-android:5.8.5'
    implementation 'com.facebook.android:facebook-android-sdk:8.0.0'
    implementation 'de.hdodenhof:circleimageview:3.1.0'
    implementation 'com.toptoche.searchablespinner:searchablespinnerlibrary:1.3.1'
    implementation 'net.objecthunter:exp4j:0.4.8'
    implementation "com.github.skydoves:powerspinner:1.1.0"
    implementation 'com.sothree.slidinguppanel:library:3.4.0'

    implementation 'com.github.stfalcon:smsverifycatcher:0.3.1'
    implementation 'org.apache.commons:commons-lang3:3.4'
    implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0'
    implementation 'com.appsflyer:af-android-sdk:5.4.3'
    implementation core.logger

    def chuck_version = "1.1.0"
    debugImplementation "com.readystatesoftware.chuck:library:$chuck_version"
    debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.5'
    releaseImplementation "com.readystatesoftware.chuck:library-no-op:$chuck_version"
    implementation 'com.hbb20:ccp:1.8'
    testImplementation core.junit
    implementation 'net.sourceforge.streamsupport:streamsupport:1.7.2'
    implementation 'id.zelory:compressor:3.0.0'
    implementation 'com.afollestad:vvalidator:0.5.2'

    implementation 'com.qhutch.bottomsheetlayout:bottomsheetlayout:0.1.9'
    implementation "com.github.skydoves:balloon:1.1.5"

    implementation 'com.github.dhaval2404:imagepicker-support:1.3'
    implementation 'com.droidninja:filepicker:2.2.1'

    implementation ('com.onesignal:OneSignal:3.15.3') {
        exclude group: 'com.google.android.gms'
    }

    implementation files('libs/bridge-5.1.2.jar')
    implementation files('libs/ason-1.4.6.jar')

    implementation 'com.artemzin.rxjava:proguard-rules:1.3.3.0'

    implementation 'com.github.nekoloop:Base64Image:0.1.0'

    implementation 'com.thoughtbot:expandablerecyclerview:1.0'

    implementation ('com.github.worker8:tourguide:1.0.13-SNAPSHOT@aar'){
        transitive=true
    }

    implementation 'me.relex:circleindicator:1.2.2@aar'
    implementation 'com.github.rtoshiro.mflibrary:mflibrary:1.0.0'
    implementation 'com.github.badoualy:stepper-indicator:1.0.7'
    implementation 'com.github.gcacace:signature-pad:1.3.1'

    def sdp_ssp_version = "1.0.6"
    implementation "com.intuit.sdp:sdp-android:$sdp_ssp_version"
    implementation "com.intuit.ssp:ssp-android:$sdp_ssp_version"

    implementation core.animator.animation
    implementation core.animator.easing
    implementation core.animator.viewanimator
    implementation 'com.facebook.shimmer:shimmer:0.5.0'

    implementation 'com.troy.movableframelayout:movableframelayout:1.0.0'
    implementation 'com.allattentionhere:fabulousfilter:0.0.5'
    implementation 'com.github.clans:fab:1.6.4'

    implementation 'com.devbrackets.android:exomedia:4.3.0'
    implementation 'com.devbrackets.android:playlistcore:2.0.1'
    implementation 'com.pierfrancescosoffritti.androidyoutubeplayer:core:10.0.5'

    releaseImplementation "com.midtrans:uikit:${versions.midtrans}"  // compiling production
    debugImplementation "com.midtrans:uikit:${versions.midtrans}-SANDBOX"  // compiling debug

    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${versions.kotlin}"
}

apply plugin: 'com.google.gms.google-services'


my top level gradle

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        google()
        jcenter()
        maven { url 'https://plugins.gradle.org/m2/'}
        maven { url "https://dl.bintray.com/pt-midtrans/maven" }
        maven { url "https://jitpack.io" }
        maven { url "https://raw.github.com/laenger/maven-releases/master/releases" }
    }
    ext {
        minSdk = 21
        targetSdk = 30
        versions = [
                appCode: 126,
                appName: '4.0.18',
                buildTools: "30.0.2",
                coreKtx: "1.3.2",
                junit: "4.13.1",
                kotlin: '1.4.10',
                koin: '2.1.6',
                coil: '1.0.0-rc3',
                retrofit: '2.6.0',
                chuck: '1.1.0',
                midtrans: '1.24.0',
                logger: '2.2.0',
                crashlytics: '17.2.2',
                analytics: '17.6.0',
                firebase: '17.5.1',
                coroutines: '1.3.9',
                adapter: '2.9.45',
                twilio: '5.1.1',
                daimajia: '2.4@aar',
                viewanimator: '1.1.0',
                utils: '1.11.1',
                compose: '1.0.0-alpha03'
        ]
        core = [
                coreKtx: "androidx.core:core-ktx:${versions.coreKtx}",
                junit: "junit:junit:${versions.junit}",
                retrofit : [
                        core : "com.squareup.retrofit2:retrofit:${versions.retrofit}",
                        gson : "com.squareup.retrofit2:converter-gson:${versions.retrofit}",
                        scalar : "com.squareup.retrofit2:converter-scalars:${versions.retrofit}",
                        coroutines : "com.jakewharton.retrofit:retrofit2-kotlin-coroutines-adapter:0.9.2",
                        networking : "com.amitshekhar.android:android-networking:1.0.2",
                        logging : "com.squareup.okhttp3:logging-interceptor:3.12.5"
                ],
                chuck : [
                        production: "com.readystatesoftware.chuck:library-no-op:${versions.chuck}",
                        staging: "com.readystatesoftware.chuck:library:${versions.chuck}"
                ],
                coil : [
                        core: "io.coil-kt:coil:${versions.coil}",
                        svg: "io.coil-kt:coil-svg:${versions.coil}",
                        gif: "io.coil-kt:coil-gif:${versions.coil}"
                ],
                animator : [
                        animation: "com.daimajia.androidanimations:library:${versions.daimajia}",
                        easing: "com.daimajia.easing:library:${versions.daimajia}",
                        viewanimator: "com.github.florent37:viewanimator:${versions.viewanimator}"
                ],
                koin : [
                        core : "org.koin:koin-core:${versions.koin}",
                        core_ext : "org.koin:koin-core-ext:${versions.koin}",
                        test : "org.koin:koin-test:${versions.koin}",
                        scope : "org.koin:koin-androidx-scope:${versions.koin}",
                        viewmodel : "org.koin:koin-androidx-viewmodel:${versions.koin}",
                        fragment : "org.koin:koin-androidx-fragment:${versions.koin}",
                        ext : "org.koin:koin-androidx-ext:${versions.koin}"
                ],
                utils : "com.blankj:utilcode:${versions.utils}",
                coroutines: "org.jetbrains.kotlinx:kotlinx-coroutines-core:${versions.coroutines}",
                logger: "com.orhanobut:logger:${versions.logger}",
                adapter: "com.github.CymChad:BaseRecyclerViewAdapterHelper:${versions.adapter}",
                firebase: [
                        core : "com.google.firebase:firebase-core:${versions.firebase}",
                        crashlytics : [
                                ktx : "com.google.firebase:firebase-crashlytics-ktx:${versions.crashlytics}",
                                java : "com.google.firebase:firebase-crashlytics:${versions.crashlytics}"
                        ],
                        analytics : [
                                ktx : "com.google.firebase:firebase-analytics-ktx:${versions.analytics}",
                                java : "com.google.firebase:firebase-analytics:${versions.analytics}"
                        ],
                ]
        ]
        event = [
                twilio : "com.twilio:chat-android:${versions.twilio}",
        ]
        payment = [
                midtrans: [
                        production: "com.midtrans:corekit:${versions.midtrans}",
                        staging: "com.midtrans:corekit:${versions.midtrans}-SANDBOX"
                ]
        ]
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:4.0.2'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${versions.kotlin}"
        classpath 'com.google.gms:google-services:4.3.4'
        classpath "org.koin:koin-gradle-plugin:${versions.koin}"
        classpath 'com.jakewharton:butterknife-gradle-plugin:10.2.1'
        // crashlytics
        classpath 'com.google.firebase:firebase-crashlytics-gradle:2.3.0'
        // onesignal
        classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:0.12.8'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

apply plugin: 'koin'

allprojects {
    repositories {
        google()
        jcenter()
//        mavenCentral()
        // Add the midtrans repository into the list of repositories
        maven { url "http://dl.bintray.com/pt-midtrans/maven" }
        maven { url "https://jitpack.io" }
        maven { url "https://mvnrepository.com/artifact/commons-validator/commons-validator" }
        // App Guide
        maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
        // Crashlytics
        maven { url 'https://s3.amazonaws.com/fabric-artifacts-private/internal-snapshots' }
        maven { url 'https://maven.fabric.io/public' }
        // Qiscus
        maven { url "https://dl.bintray.com/qiscustech/maven" }
        // Google
        maven { url "https://maven.google.com/"}
        mavenCentral()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

Please anyone can help?

Upvotes: 2

Views: 1748

Answers (2)

Ervin Suriandi
Ervin Suriandi

Reputation: 74

Have you add RecyclerView dependency at module that used RecyclerView.Adapter / ViewHolder ?

Because if you inject/initialize YourAdapter, YourViewHolder or any interface inside class that extends RecyclerView.. at somewhere which is different module, you still need to add RecyclerView dependency.

I know it's weird to run normally when installing apk / assembleDebug but build will fail if it's come from assembleRelease. I don't have a proper explanation about that. But with adding RecyclerView dependency at module that creating object that located inside of class that extend RecyclerView will fix it~

Upvotes: 1

Teebeh Eteem
Teebeh Eteem

Reputation: 37

Add this line of code to your build.gradle file where you do have classpath:

maven { url "https://jitpack.io" }

so it'll look like this

`allprojects {

repositories {

google()  

jcenter()

maven { url "https://jitpack.io" }
    
}

}`

This should fix your issue.

Upvotes: 0

Related Questions