Android Studio 3.0.1,Gradle 4.1
我想在我的Android应用中生成QR。 所以我尝试使用: com.google.zxing
项目的build.gradle中的:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath "io.realm:realm-gradle-plugin:$REALM_VERSION"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$KOTLIN_VERSION"
// 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
}
implementation 'com.google.zxing:core:3.2.0'
但我得到错误:
错误:
Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Could not resolve com.google.zxing:core:3.2.0.
Could not resolve com.google.zxing:core:3.2.0.
Required by:
project :app
> No cached version of com.google.zxing:core:3.2.0 available for offline mode.
答案 0 :(得分:0)
或者您可以从here下载Android的ZXing core.jar
文件,将该文件放入项目的libs文件夹中。
确保编译文件('libs / android-core-3.2.0.jar')在build.gradle文件中(或编译fileTree(dir:'libs',include:'* .jar')如果您使用的很多jar文件)