Error: more than one library with package name 'com.google.android.gms' using cordova plugin admob along with google plus for android

丶灬走出姿态 提交于 2019-11-28 13:12:41

Spending whole day I was able to resolve this error and my build was a success.

I created my cordova project, I first added both the plugins from git url using gitbash. Then I made 3 simple modifications before executing "Cordova platform add android" CLI command.

a) Go to <your-app>\plugins\cordova-admob\plugin.xml replace "<dependency id="cordova-google-play-services" />" with "<framework src="com.google.android.gms:play-services-ads:+" />"

My research: <dependency id="cordova-google-play-services" /> is now deprecated and we need to use <framework> tag.

b) Go to <your-app>\platforms\android\build.gradle add this line to the end of file "configurations { all*.exclude group: 'com.android.support', module: 'support-v4' }"

See below:

****************ADD AFTER THIS*********************

if (hasProperty('postBuildExtras')) {
    postBuildExtras()
}

****************ADD AFTER THIS*********************

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

Gradle docs encourages you not to edit this file with a comment inline > // GENERATED FILE! DO NOT EDIT!

As a standard practice add this to build-extras.gradle, I was not that lucky it failed so I added to build.gradle

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!