将zxing添加到build.gradle

时间:2017-09-05 08:01:22

标签: android android-studio android-gradle build.gradle zxing

我想在android studio中使用xzing。为了使用它,我在app / build.gradle中添加了一个依赖项,但不幸的是,当我同步Gradle项目时,它会产生以下错误

enter image description here

2 个答案:

答案 0 :(得分:0)

也许很有帮助,这个同步对我来说很适合我的工作室(它和旧项目使用较旧的lib,但应该更新):

repositories {
    mavenCentral()

    maven {
        url "https://raw.github.com/embarkmobile/zxing-android-minimal/mvn-repo/maven-repository/"
    }
}

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

dependencies {
compile 'com.google.zxing:core:2.2'
compile 'com.embarkmobile:zxing-android-minimal:1.2.1@aar'

答案 1 :(得分:0)

如果我更改了我的project-gradle.build-File:

var titleArr = ['Population', 'Total Number Per Unit']
var arr1 = [5686, 9890];
var arr2 = ['Staff Count', 'Student Count'];

var arrayNeeded = [];

arrayNeeded.push(titleArr);

arr1.map(function(item, index){
  var tempArr = [];
  tempArr.push(arr2[index], arr1[index]);
  arrayNeeded.push(tempArr);
});

console.log(arrayNeeded);

有效:)