【问题标题】:Exception Failed for task任务异常失败
【发布时间】:2016-04-14 19:30:03
【问题描述】:

在我的 android 项目中,每当我导入 Map Activity.. compiles 时都会给我一些错误,例如: 错误:任务 ':app:dexDebug' 执行失败。

com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.7.0_75\bin\java.exe'' 完成非零退出值 2

我该如何解决? 我的模块是:

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.1.1'
    compile 'com.android.support:design:23.1.1'
    compile 'com.google.android.gms:play-services:7.5.0'
}

【问题讨论】:

标签: android android-fragments google-maps-api-3


【解决方案1】:

我也有同样的问题,我只是用 'com.google.android.gms:play-services-maps:8.4.0' 替换了我的 'com.google.android.gms:play-services:8.4.0' bcs 我在我的项目中实现了谷歌地图,您的个人需要检查here,我希望它会工作:)

或者您仍然想一次使用整个库,因此您需要启用 multidex。步骤如下:

1:在Module:app中添加multidex依赖

compile 'com.android.support:multidex:1.0.1'

2:然后像这样在 defaultConfig 部分的 Module:app 文件中启用 mutidex

defaultConfig {
    ...
    multiDexEnabled true
}

3:像这样在应用程序部分的清单中添加以下行

<application
    android:name="android.support.multidex.MultiDexApplication"
    ...
    ...

4:重建项目。

快乐编码:)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-07-02
    • 1970-01-01
    • 2021-05-01
    • 2019-07-14
    • 2019-12-15
    • 2022-01-19
    • 1970-01-01
    相关资源
    最近更新 更多