eclipse 无法执行 dex:多个 dex 文件定义了 Lcom/google/android/gms/analytics/internal/Command

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/29986206/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 22:35:44  来源:igfitidea点击:

Unable to execute dex: Multiple dex files define Lcom/google/android/gms/analytics/internal/Command

javaandroideclipsegoogle-analytics

提问by dasdasd

I updated my Android SDK last night (31.4) and after that I canot compile my app anymore. I get this error:

我昨晚更新了我的 Android SDK(31.4),之后我无法再编译我的应用程序。我收到此错误:

[2015-05-01 14:36:24 - Dex Loader] Unable to execute dex: Multiple dex files define Lcom/google/android/gms/analytics/internal/Command;
[2015-05-01 14:36:24 - SoFit] Conversion to Dalvik format failed: Unable to execute dex: Multiple dex files define Lcom/google/android/gms/analytics/internal/Command;

I have not changed anything in my jars. Here is my libs structure: enter image description here

我没有改变我的罐子里的任何东西。这是我的库结构: 在此处输入图片说明

I tried to: - Clean project. - Restart eclipse. - Delete the bin folder. - Remove private libraries.

我试图: - 清理项目。- 重启日食。- 删除 bin 文件夹。- 删除私人图书馆。

I also tried to remove the google analysts jar because I though that from the recent google play services update they put the analysts inside the lib. But it wont compile either because of missing classes.

我还尝试删除 google 分析师 jar,因为我认为从最近的 google play 服务更新中,他们将分析师放在了 lib 中。但由于缺少类,它也不会编译。

My guess that something with the google play services is wrong but I canot find what.

我猜谷歌播放服务有问题,但我找不到什么。

回答by WhiteHorse

Try to remove "libGoogleAnalyticsServices.jar" from your directory libs and also update the code As v2 doesnt support anymore. Then Clean it and Run. Everything will be fine.

尝试从您的目录库中删除“libGoogleAnalyticsServices.jar”并更新代码,因为 v2 不再支持。然后清理它并运行。一切都会好起来的。

回答by dasdasd

google analysts v2 is not supported anymore... I have to use v4 which is included in the google services.

不再支持谷歌分析师 v2...我必须使用谷歌服务中包含的 v4。

回答by Vaiden

Remove libGoogleAnalyticsServices.jarfrom your build and add Google Play Services.

libGoogleAnalyticsServices.jar从您的构建中删除并添加 Google Play 服务。

The minimum required configuration:

最低要求配置:

compile 'com.google.android.gms:play-services-base:7.5.0'
compile 'com.google.android.gms:play-services-analytics:7.5.0'

回答by Edo user1419293

Part of the answer is WhiteHorse's: in my case the problem came about because I updated the Google Play Services Lib and it now provides the newest (v4) version of Analytics. However, removing the old jar wasn't enough as the v4 of Analytics it's not quite the same as the previous (v2 in my case). What I had to do is

部分答案是 WhiteHorse 的:就我而言,问题的出现是因为我更新了 Google Play Services Lib,它现在提供了最新的 (v4) 版本的 Analytics。但是,删除旧 jar 还不够,因为 Analytics 的 v4 与之前的(在我的情况下为 v2)不太一样。我必须做的是

  1. Remove the libAnaliticsV2.jar from dependencies and libs/
  2. Create a new EasyTracker class: check it out here
  3. Quickly change the references to EasyTracker in my app
  1. 从依赖项和 libs/ 中删除 libAnaliticsV2.jar
  2. 创建一个新的 EasyTracker 类:在此处查看
  3. 在我的应用程序中快速更改对 EasyTracker 的引用