按返回此错误来运行应用程序:
错误:任务":myproject:dexDebug"的执行失败。com.android.ide.common.prrocess.ProcessException:org.gradle.prrocess.internal.ExecException:进程"命令"C:\Program Files\Java\jdk1.8.0_51\bin\Java.exe"以非零退出值3 结束
我的项目有libfacebooksdk和wheellib。我意识到Android Studio需要很长时间来处理Gradle,然后显示这个错误,应用程序永远不会启动(运行)
我的等级:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId 'br.com.myproject'
minSdkVersion 19
targetSdkVersion 23
multiDexEnabled = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile project(':facebookSDK')
compile project(':wheellib')
compile files('libs/comscore.jar')
compile files('libs/FlurryAnalytics-5.5.0.jar')
compile 'com.android.support:support-v4:23.1.0'
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.google.code.gson:gson:2.3'
compile 'com.squareup.picasso:picasso:2.3.2'
compile 'joda-time:joda-time:2.4'
compile 'com.google.android.gms:play-services:8.3.0'
compile 'com.squareup.okhttp:okhttp:2.5.0'
compile 'com.squareup.okhttp:okhttp-urlconnection:2.5.0'
compile 'com.squareup.retrofit:retrofit:1.9.0'
compile 'com.android.support:multidex:1.0.1'
compile 'com.google.android.gms:play-services-ads:8.3.0'
compile 'com.google.android.gms:play-services-identity:8.3.0'
compile 'com.google.android.gms:play-services-gcm:8.3.0'
}
您必须在终端上运行以下命令:
your-project-directory:$> gradle build --info --stacktrace
然后你就会看到任务失败的确切时刻。
我认为问题在于您可能面临64k方法的限制。
我今天也遇到了这个问题,它是在SDK中,只需要JDK1_7!我把它添加到等级中
compileOptions {
//noinspection GroovyAssignabilityCheck
sourceCompatibility JavaVersion.VERSION_1_7
//noinspection GroovyAssignabilityCheck
targetCompatibility JavaVersion.VERSION_1_7
}
然后将计算机上的HOME_JAVA更改为JDK版本1_7,并将Android Studios Project结构中的JAVA版本更改为1_7,这就是我所做的全部。你可以只检查兼容性所有JDK的要求,也可能是64+方法的问题。。。
我更改了我的build.gradle和工作!添加dexOptions:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId 'br.com.myproject'
minSdkVersion 19
targetSdkVersion 23
multiDexEnabled = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
compileOptions {
//noinspection GroovyAssignabilityCheck
sourceCompatibility JavaVersion.VERSION_1_7
//noinspection GroovyAssignabilityCheck
targetCompatibility JavaVersion.VERSION_1_7
}
dexOptions {
incremental true
javaMaxHeapSize "4g"
}
}
dependencies {
compile project(':facebookSDK')
compile project(':wheellib')
compile files('libs/comscore.jar')
compile files('libs/FlurryAnalytics-5.5.0.jar')
compile 'com.android.support:support-v4:23.1.0'
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.google.code.gson:gson:2.3'
compile 'com.squareup.picasso:picasso:2.3.2'
compile 'joda-time:joda-time:2.4'
compile 'com.google.android.gms:play-services:8.3.0'
compile 'com.squareup.okhttp:okhttp:2.5.0'
compile 'com.squareup.okhttp:okhttp-urlconnection:2.5.0'
compile 'com.squareup.retrofit:retrofit:1.9.0'
compile 'com.android.support:multidex:1.0.1'
compile 'com.google.android.gms:play-services-ads:8.3.0'
compile 'com.google.android.gms:play-services-identity:8.3.0'
compile 'com.google.android.gms:play-services-gcm:8.3.0'
}