显示请确保您在类路径中具有必需的依赖项:com.google.android.gms.vision.barcode.Barcode类

时间:2019-09-05 07:19:39

标签: android gradle admob build.gradle barcode-scanner

一切正常,直到我添加implementation 'com.google.android.gms:play-services-ads:18.2.0'这种在应用内展示广告的依赖项。

构建应用程序时出现以下错误消息。如果删除广告库,则会删除错误。

Supertypes of the following classes cannot be resolved. Please make sure you have the required dependencies in the classpath:
    class com.google.android.gms.vision.barcode.Barcode, unresolved supertypes: com.google.android.gms.internal.zzbck

应用程序级别build.gradle

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'

android {
    compileSdkVersion 29
    defaultConfig {
        applicationId "com.creatorisone.chargingtheftsecurityalarm"
        minSdkVersion 16
        targetSdkVersion 29
        versionCode 1
        versionName "1.04"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        multiDexEnabled true

    }
    buildTypes {
        release {
            shrinkResources true
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), "proguard-rules.pro"
         }
    }
     configurations {
        cleanedAnnotations
        compile.exclude group: 'org.jetbrains', module: 'annotations'
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'androidx.appcompat:appcompat:1.0.2'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation 'com.google.android.material:material:1.0.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.2.0'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
    implementation 'org.jetbrains:annotations-java5:17.0.0'
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.50"
    implementation 'xyz.belvi.mobilevision:barcodescanner:2.0.3'
    implementation 'androidx.fragment:fragment:1.2.0-alpha02'
    implementation 'com.google.zxing:core:3.3.3'
    implementation 'com.journeyapps:zxing-android-embedded:3.2.0@aar'
    implementation 'com.google.android.gms:play-services-ads:18.2.0'

}

repositories {
    mavenCentral()
}

我已经尝试了StackOverflow上提供的多种解决方案,但在我的情况下没有任何作用

  1. "Error: Supertypes of the following classes cannot be resolved. Please make sure you have the required dependencies in the classpath"
  2. error in Location Request class in android with kotlin
  3. error: supertypes of the following classes cannot be resolved. Please make sure you have the required dependencies in the classpath
  4. "Supertypes of the following classes cannot be resolved.” in Task:app:buildInfoGeneratorDebug

1 个答案:

答案 0 :(得分:0)

通过添加

,我也遇到了相同的问题及其解决方案

实现'com.google.android.gms:play-services-vision:15.0.2'