【发布时间】:2016-06-21 18:57:35
【问题描述】:
我在我的 android studio 项目中添加了一个新库,现在运行它时出现此错误:
UNEXPECTED TOP-LEVEL ERROR:
Execution failed for task ':app:preDexDebug'.
>com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command' /Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home/bin/java" finished with non-zero value 3
BUILD FAILED
Total time:17 mins 33.841 secs
1 error
0 warning
我在 app/libs 中添加了库。我使用右键单击并添加为库。 add as library
我读到如果我将库放在外部库而不是 Project/app/libs 中,可能会修复此错误,但我不知道该怎么做。 External libraries
这是我的构建 gradle 文件:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.example.nameht.pruebas"
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.0'
compile files('libs/symja-2016-03-07.jar')
}
【问题讨论】:
标签: android android-studio jar build.gradle