我有android studio的问题,当我添加guava-18.jar lib并运行我的Main时出现错误:
Error:Gradle: Execution failed for task ':app:dexDebug'.>
com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_45\bin\java.exe'' finished with non-zero exit value 2
我尝试在build.gradle
中添加它defaultConfig {
multiDexEnabled true
}
但请勿解决。
请帮帮我!!!
my build gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "it.unical.mat.myapp"
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')
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.android.support:support-v4:23.0.1'
compile 'com.google.android.gms:play-services:8.1.0'
compile files('libs/activation.jar')
compile files('libs/gdata-analytics-2.1.jar')
compile files('libs/gdata-core-1.0.jar')
compile files('libs/gdata-spreadsheet-3.0.jar')
compile files('libs/jsr305.jar')
compile files('libs/mail.jar')
compile files('libs/guava-18.0.jar')
}
答案 0 :(得分:0)
在Gradle文件中需要添加“com.android.support:multidex:1.0.0”此Packeage
在Activity中需要更新
MultiDex.install(this);
请参阅此网站 https://developer.android.com/tools/building/multidex.html