Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Ciprian_A_
Beginner
262 Views

Intel XDK - more than one library with package name 'com.google.android.gms'

Hi,

I use appodeal plugin that is also dependent of Google play services, but when I build using Intel XDK 3400 I get this error: 

more than one library with package name 'com.google.android.gms'

Can someone have a look at my project and give me a helping hand please?

https://www.dropbox.com/s/e4xr96q0ffiy9nj/WaterConnect_v1.zip?dl=0

Tags (2)
0 Kudos
10 Replies
Ciprian_A_
Beginner
262 Views

bump

no one?

Elroy_A_Intel
Employee
262 Views

In order to resolve this issue, you will need to create a gradle script as mentioned here, but Intel XDK's build doesn't support the use of user created gradle scripts at this time.

Swati_S_Intel1
Employee
262 Views

There is duplicate support-v4 libraries with Appodeal plugin and Google Play Services plugin. There is a version of Appodeal plugin without the support-v4 libraries that you should use. This post has details to resolve this error:  How to fix the build error with Intel XDK and Appodeal?

 

Ciprian_A_
Beginner
262 Views

Thanks guys. My appodeal has already removed support-v4 but I guess I was doing something wrong. I will follow the steps from your links

Thanks

Ciprian_A_
Beginner
262 Views

I tried the steps from the tutorial but it does not work with the latest appodeal version  1.14.14

I need help, please. Any of the xdk developers around here?

PaulF_IntelCorp
Employee
262 Views

The project you provided in your first post included Appodeal plugin version 1.14.9, which references google play game services directly as a maven repo lib (which means that you do not have to explicitly include the gms library, it will be added automatically during the build phase). This is the line in the plugin.xml file that does that:

<framework src="com.google.android.gms:play-services-ads:9.2.0" />

Removing the "appodeal google play services" plugin from your posted project allows the app to build successfully.

I did not test the functionality of the app, but I expect it should work. This will likely work with the 1.14.14 version of the plugin, as well.

Ciprian_A_
Beginner
262 Views

Paul F. (Intel) wrote:

The project you provided in your first post included Appodeal plugin version 1.14.9, which references google play game services directly as a maven repo lib (which means that you do not have to explicitly include the gms library, it will be added automatically during the build phase). This is the line in the plugin.xml file that does that:

<framework src="com.google.android.gms:play-services-ads:9.2.0" />

Removing the "appodeal google play services" plugin from your posted project allows the app to build successfully.

I did not test the functionality of the app, but I expect it should work. This will likely work with the 1.14.14 version of the plugin, as well.

It says version="1.14.9" but the library version is actually libs/appodeal-1.14.14.jar

The project functions as expected if I delete google play services, but if I want to use google game (for leaderboards), that will automatically install google play services as dependency will again be a problem.

Sorry that I don't understand this very well, should I remove the 

<framework src="com.google.android.gms:play-services-ads:9.2.0" /> line or what?

The problem is that after messing around and managed to get rid of the duplicate error, I get a stack overflow something regarding dex file out of range. I really driving me insane.

I need to use both appodeal + google game and its dependency google play services and I can't seem to get it fixed

I hope you can help me, I only need to get rid of that building error with the google play services included

PaulF_IntelCorp
Employee
262 Views

Appodeal uses the correct method (the framework reference which automatically gets the correct library) to add the required library, which is the google play services for ads.

When you say you need the leaderboard, I'm assuming you mean there is another plugin that you want to add that requires the same google play services library? I don't see another such plugin in your project, you'll need to be specific about that plugin (where you got it, what it's name is, which version) in order for me to provide any useful feedback. In general, if a plugin tries to add a common library, like google play services, using the "old" method (adding the library directly, rather than referencing it via the framework tag), there is likely to be a problem due to colliding libraries. It may be that the other plugin needs to be updated?

Sorry, I don't understand what you mean by the statement "I get a stack overflow something regarding dex file out of range."

Ciprian_A_
Beginner
262 Views

Paul F. (Intel) wrote:

Appodeal uses the correct method (the framework reference which automatically gets the correct library) to add the required library, which is the google play services for ads.

When you say you need the leaderboard, I'm assuming you mean there is another plugin that you want to add that requires the same google play services library? I don't see another such plugin in your project, you'll need to be specific about that plugin (where you got it, what it's name is, which version) in order for me to provide any useful feedback. In general, if a plugin tries to add a common library, like google play services, using the "old" method (adding the library directly, rather than referencing it via the framework tag), there is likely to be a problem due to colliding libraries. It may be that the other plugin needs to be updated?

Sorry, I don't understand what you mean by the statement "I get a stack overflow something regarding dex file out of range."

I get this error 

  	com.android.dex.DexIndexOverflowException: method ID not in [0, 0xffff]: 65536

The plugins that I use in my project are:

https://github.com/Cipriux/cordova-plugin-game

and

https://github.com/cranberrygame/cordova-plugin-game

If you make an XDK project from scratch and add those 2 plugins you will get the the error. I know that Google has many many methods in their libraries that might exceed the 65536 index limit for the dex file, but it has to be a fix for this in XDK

Please advice,

Thanks

 

Ciprian_A_
Beginner
262 Views

After speaking with one of Appodeal team members, he helped me remove some libraries in order to have lower method count.

I will post here what they told me, just in case someone else needs help in using Appodeal + Google Play Services in the same project:

-----------------------------------------------------

In order to remove some methods  you need to remove some ad networks and the libraries associated:

In Construct 2:
Use Disable Network action then write down network you want to disable, it can be used multiple times.
Available parameters:  "flurry", "yandex", "inmobi", "unity_ads", "adcolony", "vungle"
Should be used BEFORE SDK initialization

XDK library: 
REMOVE from plugin.xml: 
source = yes
receiver = yes
activity = no


ONLY skippable video + interstitials 
Remove:
flurry-analytics-6.2.0.jar
yandex-metrica-2.41.jar
inmobi-5.3.0.jar (optional, if removal of other libraries will not help)
appodeal_1.14.14.jar/assets/dex/yandex.dex (open with any archivator)

ONLY interstitials only you can also remove:
unity-ads-1.4.7.jar
appodeal_1.14.14.jar/assets/dex/vungle.dex
appodeal_1.14.14.jar/assets/dex/adcolony.dex

 

--------------------------------------------------------------------------

This is what I did in order to fix the problem: 
- removed flurry-analytics-6.2.0.jar 
    + linia din plugin.xml)
- removed yandex-metrica-2.41.jar 
    + appodeal_1.14.14.jar/assets/dex/yandex.de 
    + <service> din plugin.xml
    + <receiver> din plugin.xml
- removed inmobi-5.3.0.jar    
    + <service> din plugin.xml
    + <receiver> din plugin.xml
- removed <framework src="com.google.android.gms:play-services-ads:+" /> from plugins\cordova-plugin-extras-google-play-services\plugin.xml

- changed com.google.android.gms:play-services-ads:9.2.0 -> 8.3.0 in com.appodeal.plugin\plugin.xml
- changed com.google.android.gms:play-services-games:+ -> 8.3.0 in cordova-plugin-extras-google-play-services\plugin.xml
- changed com.google.android.gms:play-services-plus:+ -> 8.3.0 in cordova-plugin-extras-google-play-services\plugin.xml
- commented <framework src="com.google.android.gms:play-services-ads:+" /> in cordova-plugin-extras-google-play-services\plugin.xml

Reply