【发布时间】:2016-08-21 09:17:36
【问题描述】:
我开始在我的小游戏中使用 Google Play 服务。正如指南所说,我在build.gradle(Module: app) 中添加了compile 'com.google.android.gms:play-services:9.4.0'。
自从那次更改后,我无法构建我的 apk,但我仍然可以在手机上运行它。在构建 apk 时出现以下错误:
错误:任务 ':app:transformClassesWithDexForDebug' 执行失败。 com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.dex.DexIndexOverflowException: 方法 ID 不在 [0, 0xffff] 中: 65536
FAILURE:构建失败并出现异常。
出了什么问题: 任务 ':app:transformClassesWithDexForDebug' 执行失败。 com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.dex.DexIndexOverflowException: 方法 ID 不在 [0, 0xffff] 中: 65536 尝试: 使用 --stacktrace 选项运行以获取堆栈跟踪。使用 --info 或 --debug 选项运行以获得更多日志输出。
谢谢
【问题讨论】:
-
导入完整的库可能会发生这种情况,您应该只从 google play lib 导入所需的类。此处在表 1 中列出了可用的部件:developers.google.com/android/guides/setup
标签: java android android-studio google-play-services