android - 出现错误:Execution failed for task ':app:dexDebug'

标签 android android-studio gradle error-handling

我在build.gradle中使用以下依赖项:

dependencies {
/*compile fileTree(dir: 'libs', include: ['*.jar'])*/
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.android.support:design:23.0.1'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.parse:parse-android:1.11.0'
compile 'com.parse.bolts:bolts-android:1.3.0'
compile 'com.google.android.gms:play-services:7.5.0'
compile 'com.mixpanel.android:mixpanel-android:4.6.4'
compile project(':intercom-sdk-base')
compile project(':intercom-sdk-gcm')
compile 'com.stripe:stripe-android:1.0.3'

}

我已经评论了compile fileTree(dir: 'libs', include: ['*.jar'])这一行

为了避免不匹配,但仍然出现以下错误:

Error:Execution failed for task ':app:dexDebug'> 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 2

最佳答案

您需要添加multiDexEnabled true。礼貌到 multiDexEnabled

The Android plugin for Gradle available in Android SDK Build Tools 21.1 and higher supports multidex as part of your build configuration. Make sure you update the Android SDK Build Tools tools and the Android Support Repository to the latest version using the SDK Manager before attempting to configure your app for multidex.


defaultConfig {
    ...
    minSdkVersion //Your Version
    targetSdkVersion //Your Version
    ...

    // Enabling multidex support.
    multiDexEnabled true
}

在依赖项中调用它
  dependencies {
  compile 'com.android.support:multidex:1.0.1'
}

建议

您可以使用compile 'com.parse:parse-android:1.12.0'
然后 Clean-Rebuild-Restart-Sync 您的项目。希望这可以帮助 。

关于android - 出现错误:Execution failed for task ':app:dexDebug' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34988152/

相关文章:

java - RadioButton 自行取消选中

java - 仪器测试将在 Android Studio 3(空测试套件)上作为本地单元测试运行

java - 如何找到提供注释处理器的依赖项

android - TabLayout 选项卡内的文本未居中

android - 有什么方法可以使用最小 SDK 小于 21 的 Android CameraX API?

Android GPS定位问题

java - 针对不同的依赖项构建相同代码的推荐方法是什么?

android - 如何为 Travis CI 构建模拟 Gradle 的 buildConfigField?

android - Layouting Process什么时候调用onAttachedToWindow

java - 更改布局的组件