我正在尝试使用ZXing库构建项目。我使用this post中的说明将库集成到我的Android项目中,我相信我已经成功完成了。但是,当我尝试构建整个项目时,Gradle构建中存在一个引用依赖项或类似内容的错误。但是,我想我已经解决了依赖关系的所有问题。
Gradle中返回的错误:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:prepareDebugDependencies'.
消息是
依赖关系QRR:项目应用中未指定的android:解析为不支持编译依赖的APK存档。
Here是使用Stacktrace的完整Gradle日志。
编辑:
在这个项目中,我使用了完整的ZXing库,而不是Embedded或Minimal。
下载ZXing here的完整回购后,我已将android
文件夹添加为项目的新模块。我已经添加了对Gradle文件的依赖。然后,我已经下载了Maven仓库的核心,然后我将其作为JAR库导入。我在android:build-gradle中添加了依赖项。
app:build.gradle是:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.example.mehdi.qrr"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'),'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.2.1'
compile project(':android')
compile 'com.google.zxing:core:3.2.1'
}
repositories {
jcenter()
}
Project:build-gradle是:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
repositories {
mavenCentral()
maven {
url "http://dl.bintray.com/journeyapps/maven"
}
}
android:build-gradle(ZXing项目的Gradle文件):
apply plugin: 'com.android.application'
android {
signingConfigs {
}
compileSdkVersion 21
buildToolsVersion "19.1.0"
defaultConfig {
applicationId "com.google.zxing.client.android"
minSdkVersion 15
targetSdkVersion 22
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile 'com.google.zxing:core:3.2.1'
}