android studio 中的 Zxing 库集成 gradle 错误
Zxing library integration gradle error in android studio
gradle文件内容在
下方
apply plugin: 'com.android.library'
ext.artifactId = 'zxing-android-embedded'
dependencies {
compile project.zxingCore
// Optional dependency.
provided 'com.android.support:support-v4:22.0.0'
}
android {
resourcePrefix 'zxing_'
compileSdkVersion project.androidTargetSdk
buildToolsVersion project.androidBuildTools
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src-orig', 'src']
res.srcDirs = ['res-orig', 'res']
assets.srcDirs = ['assets']
}
}
// This is bad practice - we should fix the warnings instead.
lintOptions {
// Android warns about the he and id locale folders. he -> iw is already handled with a
// symlink. TODO: what about id?
disable 'LocaleFolder'
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}
它给出错误找不到 属性 'zxingCore' on project ':zxing-android-embedded'
。对于编译 project.zxingCore
将以下依赖项添加到您的项目中build.gradle
dependencies {
compile 'com.google.zxing:core:3.2.1'
}
在我的项目中它工作正常。
gradle文件内容在
下方apply plugin: 'com.android.library'
ext.artifactId = 'zxing-android-embedded'
dependencies {
compile project.zxingCore
// Optional dependency.
provided 'com.android.support:support-v4:22.0.0'
}
android {
resourcePrefix 'zxing_'
compileSdkVersion project.androidTargetSdk
buildToolsVersion project.androidBuildTools
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src-orig', 'src']
res.srcDirs = ['res-orig', 'res']
assets.srcDirs = ['assets']
}
}
// This is bad practice - we should fix the warnings instead.
lintOptions {
// Android warns about the he and id locale folders. he -> iw is already handled with a
// symlink. TODO: what about id?
disable 'LocaleFolder'
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}
它给出错误找不到 属性 'zxingCore' on project ':zxing-android-embedded'
。对于编译 project.zxingCore
将以下依赖项添加到您的项目中build.gradle
dependencies {
compile 'com.google.zxing:core:3.2.1'
}
在我的项目中它工作正常。