错误:多个DEX文件定义Landroid /支持/注解/ AnimRes与AdMob和Facebook的插件科尔多瓦 [英] Error: Multiple dex files define Landroid/support/annotations/AnimRes with Admob and Facebook Cordova plugins

查看:279
本文介绍了错误:多个DEX文件定义Landroid /支持/注解/ AnimRes与AdMob和Facebook的插件科尔多瓦的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用科尔多瓦和离子框架构建应用程序。

但是现在,当我建立我的项目,我会见了错误:

 意外顶级例外:
com.android.dex.DexException:多DEX文件定义Landroid /支持/注释/ AnimRes;

其他SO解决方案提多 Android的支持 - v4.jar 文件相冲突,但是只有 Android的支持 - v4.jar 文件我能找到的是facebook的插件中。

另一种解决方案提到的冲突版本(即 Android的支持 - v4.jar 发生冲突以 Android的支持 - v13.jar ) - 再次,我看不到我的项目内 Android的支持 - v13.jar 的任何引用

另一种解决方案是相互矛盾的 Android的支持 - annotations.jar Android的支持 - v4.jar :<一个href=\"http://stackoverflow.com/questions/26342444/multiple-dex-files-define-landroid-support-annotation-animres\">multiple DEX文件定义landroid /支持/注释/ AnimRes 。我找不到我的项目中的任何 Android的支持 - annotations.jar 的文件,但在创建内容: myProject的\\平台\\机器人\\建立\\中间体\\ pre-dexed \\调试

不过,我不明白这是如何得到创建。

我该如何解决这个问题?这个问题可以容易地再现:

 &GT;离子开始对myApp标签
&GT; CD对myApp
&GT;科尔多瓦插件添加https://github.com/Wizcorp/phonegap-facebook-plugin.git --variable APP_ID =123456789--variable APP_NAME =所有MyApplication
&GT;科尔多瓦插件添加科尔多瓦 - 插件,admobpro
&GT;离子型Android平台
&GT;离子构建Android

(其中APP_ID和APP_NAME是一个Facebook应用程序的ID和姓名)


解决方案

您需要排除得到了包括Wizcorp Facebook的插件,Android的支持,v4.jar。诀窍很简单,你需要创建集结extras.gradle 内部平台/ Android和添加以下内容:

配置{
   所有* .exclude组:com.android.support',模块:支持-V4
}

就是这样,现在使用Android的支持lib目录将与此FB插件每工作插件。
你也许可以把这个地方在默认的build.gradle但在哪里,这个集结额外文件得到自动包含,所以它的罚款我无法弄清楚到底。

I'm building an app using cordova and the Ionic framework.

However now when I build my project I'm met with the error:

UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexException: Multiple dex files define Landroid/support/annotations/AnimRes;

Other SO solutions mention multiple android-support-v4.jar files conflicting, however the only android-support-v4.jar file I can find is within the facebook plugin.

Another solution mentioned conflicting versions (i.e android-support-v4.jar conflicting with android-support-v13.jar) - again, I cannot see any references to android-support-v13.jar within my project.

Another solution was conflicting android-support-annotations.jar and android-support-v4.jar: multiple dex files define landroid/support/annotation/AnimRes . I cannot find any android-support-annotations.jar files within my project, except something that is created in: myProject\platforms\android\build\intermediates\pre-dexed\debug

However I don't understand how this is getting created.

How can I solve this problem? The problem can be easily reproduced:

>ionic start myApp tabs
>cd myApp
>cordova plugin add https://github.com/Wizcorp/phonegap-facebook-plugin.git --variable APP_ID="123456789" --variable APP_NAME="myApplication"
>cordova plugin add cordova-plugin-admobpro
>ionic platform android
>ionic build android 

(where APP_ID and APP_NAME are the ID and name of a facebook application)

解决方案

You need to exclude android-support-v4.jar that got included by Wizcorp Facebook plugin. Trick is simple you need to create build-extras.gradle inside platforms/android and add following:

configurations { all*.exclude group: 'com.android.support', module: 'support-v4' }

And that's it, now every plugin that uses android support lib will work with this FB plugin. You could probably put this somewhere in default build.gradle but i couldn't figure out exactly where, this build-extras file get auto included so its fine.

这篇关于错误:多个DEX文件定义Landroid /支持/注解/ AnimRes与AdMob和Facebook的插件科尔多瓦的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆