Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/388.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 将Google Play服务添加到项目后,错误:转换为Dalvik格式失败_Java_Android_Eclipse - Fatal编程技术网

Java 将Google Play服务添加到项目后,错误:转换为Dalvik格式失败

Java 将Google Play服务添加到项目后,错误:转换为Dalvik格式失败,java,android,eclipse,Java,Android,Eclipse,我有一个Android项目(在EclipseIDE中),它可以很好地编译和运行。然后我添加了GooglePlayServices项目作为参考 我的Java构建路径如下所示: 以及: 现在,当我尝试运行项目时,我看到错误消息: Unable to execute dex: method ID not in [0, 0xffff]: 65536 Conversion to Dalvik format failed: Unable to execute dex: method ID not in

我有一个Android项目(在EclipseIDE中),它可以很好地编译和运行。然后我添加了GooglePlayServices项目作为参考

我的Java构建路径如下所示:

以及:

现在,当我尝试运行项目时,我看到错误消息:

Unable to execute dex: method ID not in [0, 0xffff]: 65536
Conversion to Dalvik format failed: Unable to execute dex: method ID not in [0, 0xffff]: 65536

我缺少什么?

您的应用程序中超过了最大方法数。Multidex应该可以帮助您:

llya>谢谢……我没有使用gradle。如何实现multidexEnabled=true?同样在android清单中,我已经有了android:name=“com.myApp”,那么/shud我如何用这个替换它呢:android:name=“android.support.multidex.MultiDexApplication”?如果你仍然想使用Eclipse,你可以启用proguard。它将删除未使用的方法我已经在使用Proguard了,但我想只有在导出apk时才使用它,而不是在开发模式下编译和运行时。在proguard-project.properties中有什么提示吗?我是不是应该处理一些事情——在那里保存一些包裹?是的,你是对的。apk导出期间使用Proguard规则。还有另一种有趣的方式。现在Google Play服务分为不同的模块()。因此,您只能下载您需要的内容(当然是手动下载)。但它们是aar格式的。对于在eclipse中使用它,请使用本指南——所以在这个eclipse项目中使用Android Studio或引入gradle(这可行吗?)——是我的其他选择。谢谢你给我这些有用的提示,我会尝试的。