java - 如何添加最新的依赖ZXing android嵌入(2017)

标签 java android dependencies zxing

我在 Android Studio 中启动了一个新项目,我想导入 zxing-android-embedded,以便在我的应用程序中创建一个简单的条形码扫描仪。

这是 build.gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 24
    buildToolsVersion "26.0.0"
    defaultConfig {
        applicationId "com.example.android.barcodescanner"
        minSdkVersion 19
        targetSdkVersion 24
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:24.2.1'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    testCompile 'junit:junit:4.12'
    compile 'com.google.zxing:core:3.2.1'
    compile 'com.journeyapps:zxing-android-embedded:3.2.0'
}

它显示错误

Error:(29, 13) Failed to resolve: com.google.zxing:core:3.2.1
<a href="disable.gradle.offline.mode">Disable offline mode and sync project</a><br><a href="openFile:C:/Users/user/Desktop/AndroidStudioProjects/AndroidStudioProjects/BarCodeScanner/app/build.gradle">Show in File</a><br><a href="open.dependency.in.project.structure">Show in Project Structure dialog</a>

Error:(30, 13) Failed to resolve: com.journeyapps:zxing-android-embedded:3.2.0
<a href="disable.gradle.offline.mode">Disable offline mode and sync project</a><br><a href="openFile:C:/Users/user/Desktop/AndroidStudioProjects/AndroidStudioProjects/BarCodeScanner/app/build.gradle">Show in File</a><br><a href="open.dependency.in.project.structure">Show in Project Structure dialog</a>

嗯,我搜索了 Stack Overflow,但找不到最新的依赖 ZXing android 嵌入式。

最佳答案

试试这个:

dependencies {
    compile 'com.journeyapps:zxing-android-embedded:3.5.0'
    compile 'com.android.support:appcompat-v7:23.1.0'   
}

关于java - 如何添加最新的依赖ZXing android嵌入(2017),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44740842/

相关文章:

android - GCM和android异步异常

c++ - 在应用程序启动时松开 DLL 依赖项

Java 8 - 省略了繁琐的收集方法

Android Intent的resolveActivity和Package Manager

android - 从 Fragment 访问 EditTextPreference 的文本

c++ - Visual Studio : how to handle project dependencies right?

build - 具有项目编译依赖项的 Gradle 嵌套多项目

java - 递归打印 ArrayList<ArrayList<String>> 的所有可能组合

java - 使用 Stream 映射 Collection 结果

java - Spring 中的 Autowiring 与实例化