无法解决 Zxing 依赖项

Could Not Resolve Zxing Dependencies

一周后,我在 Android Studio 上遇到了一些错误。

我想在我的项目中添加 Zxing 库依赖项。但是每次我添加依赖项。我得到这个错误

"Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve..."

我确实删除了 "compile" 和 "implementation" 我正在寻找的每个依赖项。

仅供参考:我已成功添加 Volley 库。没有错误出现。

这是我的 TOP build.gradle

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

buildscript {

    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.4'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

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


这是我的APPbuild.gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28



    defaultConfig {
        applicationId "id.plevia.projectx.app"
        minSdkVersion 18
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"


    }

    buildTypes {
       release {
           minifyEnabled false
           proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
       }
    }

}

dependencies {
    implementation project(':feature')
    implementation project(':base')
    implementation('com.android.volley:volley:1.1.1')
}



这是我的基地 build.gradle

apply plugin: 'com.android.feature'

android {
    compileSdkVersion 28
    baseFeature true
    defaultConfig {
        minSdkVersion 18
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    api 'com.android.support:appcompat-v7:28.0.0-rc02'
    api 'com.android.support.constraint:constraint-layout:1.1.3'
    application project(':app')
    feature project(':feature')
    implementation('com.android.volley:volley:1.1.1')
}



这是我的特色 build.gradle

apply plugin: 'com.android.feature'

android {
    compileSdkVersion 28
    defaultConfig {
        minSdkVersion 18
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation project(':base')
    implementation('com.android.volley:volley:1.1.1')
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'

}

上面的所有build.gradle脚本没有Zxing依赖。

我只想制作条码扫描器,而无需在每次扫描时按下按钮

谢谢。

如@Arbaz.in在评论区回答。我的问题的答案是 取消选中离线工作选项

文件->其他设置->默认设置->构建、执行、部署->构建工具->Gradle->取消勾选离线工作选项