Android 无法解析Zxing依赖项

Android 无法解析Zxing依赖项,android,android-studio,build.gradle,barcode,zxing,Android,Android Studio,Build.gradle,Barcode,Zxing,一周内,我在Android Studio上遇到了一些错误 我想在我的项目中添加Zxing库依赖项。但每次我添加依赖项时。我犯了这个错误 "Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve..." 我确实删除了我正在寻找的每个依赖项上的“编译”和“实现” 仅供参考:我已成功添加截击库。没有出现错误。 这是我最好的身材,格雷德尔 // Top-level build file whe

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

我想在我的项目中添加Zxing库依赖项。但每次我添加依赖项时。我犯了这个错误

"Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve..."
我确实删除了我正在寻找的每个依赖项上的“编译”和“实现”

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

这是我最好的身材,格雷德尔

// 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
}
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')
}
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')
}
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

// 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
}
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')
}
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')
}
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'

}


这是我的基本身材,格雷德尔

// 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
}
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')
}
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')
}
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'

}


这是我的功能构建

// 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
}
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')
}
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')
}
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依赖项。

我所要做的就是在每次扫描时不按任何按钮即可制作条形码扫描仪


谢谢。

As@Arbaz.在评论部分的回答中。我的问题的答案是 取消选中脱机工作选项


文件->其他设置->默认设置->构建、执行、部署->构建工具->渐变->取消选中脱机工作选项

取消选中脱机工作选项文件->其他设置->默认设置->构建、执行、部署->构建工具->渐变->取消选中脱机工作选项哇@阿尔巴兹,你让我惊讶。谢谢。快乐编码:D