Skip to content

Difference of Plugin IDs

Raymond Xie edited this page Nov 1, 2017 · 16 revisions

You may be confused with the admob plugins, which one shall I use?

  • com.google.cordova.admob
  • cordova-plugin-admob
  • cordova-plugin-admobpro
  • cordova-plugin-admobpro-firebase

Okay, actually they are almost the same plugin, but publish with some slight difference. Here is the github repo, the project home of this plugin to maintain the versions and history.

Besides, the plugin is also published as:

com.google.cordova.admob

Cordova plugin registry was a legacy repo maintained by Cordova team. If you use Cordova CLI older than v5.0, it can download the plugin from cordova plugin registry, with id: com.google.cordova.admob.

cordova-plugin-admob

But, unfortunately, not all tools support gradle. So far, some tools still use ant to build android apk, then framework tag refer to default jar cannot be handled correctly.

So I have to split a branch, replace framework tag with following dependency to external plugin contains google-play-services.jar:

<dependency id="cordova-plugin-googleplayservices"/>

And it's published to npm with name "cordova-plugin-admob".

cordova-plugin-admobpro

Since cordova CLI v5.0, cordova team announced npm is also supported and plan to deprecate cordova plugin registry in 6 months, and suggest plugins to be migrated to npm repo, and follow the new name rule, so it's new package id is renamed to: cordova-plugin-admobpro.

And, to simplify dependency, new cordova CLI by default use gradle instead of ant to build android apk, and allow link with default jar in android SDK with framework tag:

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

To ensure the required jar can be found, please make sure the library & repository installed in your Android SDK manager, see: android sdk frameworks

Good news, PhoneGap Build announce to support gradle for android build on Sep 28, 2015. So, if you are using PhoneGap Build, now you can use use:

<gap:plugin name="cordova-plugin-admobpro" source=“npm"/>

But be aware that, if they switch back to ant, you need change to:

<gap:plugin name="cordova-plugin-admob" source=“npm"/>

cordova-plugin-admobpro-firebase

When using cordova-plugin-admobpro, if some other plugins based on firebase is also used, for example, cordova-plugin-fcm, it may cause conflict on library.

Try switching cordova-plugin-admobpro to cordova-plugin-admobpro-firebase, which is compatible on firebase library and cordova-plugin-fcm.

FAQ

1. Build fail when use cordova-plugin-admobpro in PhoneGap Build/Intel SDK ...

Those tools do not support gradle yet, and cannot handle framework tag correctly. Use cordova-pluign-admob instead.

2. Why Cordova CLI fail install the plugin with 404 Not found?

You are using a old version of Cordova CLI.

Cordova team announced npm repo is supported since cordova CLI v5.0

Only Cordova CLI v5.x and later support loading plugin from npm. Please upgrade your cordova CLI:

[sudo] npm install -g cordova

3. Build error with message "Multiple dex files define Lcom/google/..."

Caused by duplicated google-play-services.jar.

This plugin properly referenced to the google-play-services.jar in your android sdk with tag framework , which is recommended by Google team.

While some other plugins contains the jar, or depends on a plugin named com.google.playservices which is already deprecated.

Please list all plugins and check which plugin use it improperly, then report a bug to that plugin.

4. Build error with message "Not found com.google.android.gms:play-services-ads:+"

Google play services library or repository is not installed in your android SDK.

Type android sdk & to launch your Android SDK manager, check and confirm the items are installed.

See: android sdk frameworks