我的项目无法使用这些库进行编译:
我的gradle代码:
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com...."
minSdkVersion 9
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.3'
}
错误:
**错误:任务 ':app:preDexDebug' 执行失败。
com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/usr/lib/jvm/java-7-openjdk-amd64/bin/java'' finished with non-zero exit value 1**
最佳答案
Android SDK 构建工具 21.1 及更高版本中提供的适用于 Gradle 的 Android 插件支持 multidex,因此您必须像这样将 multiDexEnabled true
添加到您的 gradle 文件中:
android {
compileSdkVersion 21
buildToolsVersion "21.1.0"
defaultConfig {
...
minSdkVersion 14
targetSdkVersion 21
...
// Enabling multidex support.
multiDexEnabled true
}
...
}
..
关于java - Gradle 无法使用 libs 进行编译,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29198059/