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

显示请确保在类路径中具有所需的依赖项:class com.google.android.gms.vision.barcode.barcode,android,gradle,admob,build.gradle,barcode-scanner,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

一切都很顺利,直到我添加了
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上提供的多种解决方案,但在我的案例中没有任何效果


  • 我也遇到了同样的问题,通过添加


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

    我也面临同样的问题。这是Kotlin编译器的一个问题。漏洞仍然存在,你可以在这里查看。现在我必须删除构建文件夹并重建项目,然后它才能工作。