有没有办法让塞米松加载器在Android中允许多个一类?多个、没有办法、加载、让塞米松

2023-09-04 03:55:04 作者:爱情眠于流年

我得到了地塞米松装载机]无法执行DEX:多DEX文件定义xxx的错误时,我有一个使用库项目的Andr​​oid项目,他们都生成一个类的apt_generated文件夹的名称相同。类是完全一样的名称,并在这两个项目的内容,但由于有多个它尝试部署时,我得到一个错误。是否有一个标志或任何可设置,这将始终使用第一类,并忽略其他具有相同名称的?

I get the "Dex Loader] Unable to execute dex: Multiple dex files define xxx" error when I have an android project that uses a library project and they both generate a class with the same name in the apt_generated folder. The class is exactly the same name and contents in both projects but since there are multiple of it I get an error when trying to deploy. Is there a flag or anything that can be set which will always use the first class and ignore any others with the same name?

推荐答案

一个选项是不从构建库项目中的项目之一。

One options is to exclude the library project from the build in one of the projects.

库项目依赖存储在Eclipse / ADT的 Android的私人图书馆类路径容器。

Library project dependencies are stored in the Android Private Libraries classpath container in Eclipse/ADT.

在最新的ADT(并可能在较旧版本),你可以选择不出口这个类路径容器。

In the latest ADT (and probably in older versions to), you can opt to not export this classpath container.

想象的情景是,你有一个项目,这取决于

Imagine the scenario were you have a project depending on

在谷歌播放服务库。 Android的地图-utils的(谷歌地图扩展库项目,也依赖于谷歌播放服务)

在这种情况下,你会遇到下面的错误,在包/部署时间:

In this case you will run into the following error at package/deploy time :

Unable to execute dex: Multiple dex files define Lcom/google/android/gms/R$attr;
Conversion to Dalvik format failed: Unable to execute dex: Multiple dex files define Lcom/google/android/gms/R$attr;

如果您配置了Android的地图-utils的项目不导出 Android的私人图书馆取消选中在的Java构建路径中的'秩序和EXPORT1查看所选容器中,地塞米松错误就会消失。

If you configure the android-maps-utils project to not export the Android Private Libraries by unchecking the highlighted container in the `Order and Export1 view of the Java Build path, the Dex error will go away.