我的gradle执行失败,并显示以下错误消息。我在SO上搜索了许多其他答案,建议这样做:
dexOptions {
preDexLibraries = false
}
有人说这可能是内存错误,有人说可能是依赖项可能已经包括我要编译的依赖项之一。我将以下错误消息与build.gradle文件一起包括在内,您可以在其中查看我正在使用的依赖项。任何帮助深表感谢!
buildscript {
repositories {
jcenter()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'com.android.tools.build:gradle:0.13.3'
// The Fabric Gradle plugin uses an open ended version to react
// quickly to Android tooling updates
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
repositories {
jcenter()
maven { url 'https://maven.fabric.io/public' }
}
android {
compileSdkVersion 21
buildToolsVersion '20.0.0'
defaultConfig {
applicationId "com.dreamengine.shout"
minSdkVersion 13
targetSdkVersion 21
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
dexOptions {
preDexLibraries = false
}
}
dependencies {
//compile 'com.android.support:support-v4:+'
compile files('libs/Parse-1.7.1.jar')
compile 'com.squareup.picasso:picasso:2.3.4'
compile 'com.firebase:firebase-client-android:2.0.3'
compile 'com.squareup.okio:okio:1.0.0'
compile 'com.squareup.okhttp:okhttp-urlconnection:2.1.0'
compile 'com.squareup.okhttp:okhttp:2.1.0'
compile 'com.squareup.retrofit:retrofit:1.8.0'
compile 'com.android.support:appcompat-v7:21.+'
compile 'com.google.android.gms:play-services:6.5.+'
compile 'com.google.code.gson:gson:2.2.4'
compile 'com.github.asne.facebook:facebook:3.17.2'
compile 'com.braintreepayments.api:braintree:1.+'
compile "com.mixpanel.android:mixpanel-android:4.4.1@aar"
// Crashlytics Kit
compile('com.crashlytics.sdk.android:crashlytics:2.1.0@aar') {
transitive = true
}
// Twitter Kit
compile('com.twitter.sdk.android:twitter:1.1.0@aar') {
transitive = true
}
// MoPub Kit
compile('com.mopub.sdk.android:mopub:3.2.2@aar') {
transitive = true
}
//Foursquare
compile fileTree(dir: 'libs', include: ['*.jar'])
compile project(':Libraries:easyFoursquare4Android')
}
失败:生成失败,发生异常。
任务':app:dexDebug'的执行失败。
com.android.ide.common.internal.LoggedErrorException: Failed to run command: /Applications/Android Studio.app/sdk/build-tools/android-4.4W/dx --dex --num-threads=4 --output ... Error Code: 137
最佳答案
dx的运行需要产生新的VM。创建失败,请检查是否有足够的内存和/或设置defaultXmx = -Xmx512m(或更低)。请在此处也查看答案Android gradle build script returns error 137 in preDexDebug
关于java - Android gradle执行失败于:myapp:dexDebug,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27464560/