• This repository has been archived on 17/Sep/2020
  • Stars
    star
    230
  • Rank 170,428 (Top 4 %)
  • Language
    JavaScript
  • Created about 7 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Cordova/Phonegap plugin to align various versions of the Android Support libraries specified by other plugins to a specific version

DEPRECATION NOTICE

This plugin is deprecated and no longer maintained since the Android Support Library it itself deprecated and has been superseded by the AndroidX (Jetifier) library.

cordova-android-support-gradle-release Latest Stable Version Total Downloads

This Cordova/Phonegap plugin for Android aligns various versions of the Android Support libraries specified by other plugins to a specific version.

Table of Contents

Purpose

TL;DR: To prevent build failures caused by including different versions of the support libraries.

Some Cordova plugins include Android Support Libraries to faciliate them. Most commonly, these are now included into the Cordova project by specifying them as Gradle dependencies (see the Cordova plugin spec documentation).

Example plugins:

The problem arises when these plugins specify different versions of the support libraries. This can cause build failures to occur, which are not easy to resolve without changes by the plugin authors to align the specified versions. See these issues:

To resolve these version collisions, this plugin injects a Gradle configuration file into the native Android platform project, which overrides any versions specified by other plugins, and forces them to the version specified in its Gradle file.

If you're encountering similar problems with the Play Services and/or Firebase libraries, checkout the sister plugins:

Installation

$ cordova plugin add cordova-android-support-gradle-release
$ cordova plugin add cordova-android-support-gradle-release  --variable ANDROID_SUPPORT_VERSION={required version}

The plugin needs to be installed with the cordova-fetch mechanism in order to satisfy its package dependencies by installing it via npm.

If you're installing with cordova@6, you'll need to explicitly specify the --fetch option, and --save option if you want to specify a non-default version:

$ cordova plugin add cordova-android-support-gradle-release --fetch
$ cordova plugin add cordova-android-support-gradle-release --fetch --save --variable ANDROID_SUPPORT_VERSION={required version}

Library versions

Default version

By default, this plugin will use the major version of the most recent release of the support libraries - see here for a list recent versions. "Most recent release" means the highest major version that will not result in an Alpha or Beta version being included.

$ cordova plugin add cordova-android-support-gradle-release

For example, if the most recent versions are:

  • 26.0.0 Beta 2
  • 25.4.0

Then this plugin will default to 25.+ because 26 is still in Beta.

Other versions

In some cases, you may want to specify a different version of the support libraries. For example, Telerik ImagePicker plugin v2.1.7 specifies v23 because it contains code that is incompatible with v24+.

In this case, including the default version of this plugin will still result in a build error. So this plugin enables you to specify other versions of the support library using the ANDROID_SUPPORT_VERSION plugin variable.

In the above case, you'd want to install v23 of the support library. To so, you'd specify the version via the variable:

cordova plugin add cordova-android-support-gradle-release --variable ANDROID_SUPPORT_VERSION=23.+

Example cases

Example 1

Uses v25 of the support libraries to fix the build issue.

  1. cordova create test1 && cd test1/
  2. cordova platform add android@latest
  3. cordova plugin add [email protected] --save --variable APP_ID="123456789" --variable APP_NAME="myApplication"
  4. cordova compile

Observe the build succeeds and in the console output is v25.3.1 of Android Support Library:

:prepareComAndroidSupportSupportV42531Library
  1. cordova plugin add [email protected]
  2. cordova compile

Observe the build failed and in the console output is higher than v25.3.1 (e.g v26.0.0-alpha1) of Android Support Library:

:prepareComAndroidSupportSupportV42600Alpha1Library
  1. cordova plugin add cordova-android-support-gradle-release --variable ANDROID_SUPPORT_VERSION=25.+
  2. cordova prepare && cordova compile

Observe the build succeeds and in the console output is v25 of Android Support Library.

Example 2

Uses v23 of the support libraries to fix the build issue, because v2.1.7 of the ImagePicker only works with v23.

  1. cordova create test2 && cd test2/
  2. cordova platform add android@latest
  3. cordova plugin add https://github.com/Telerik-Verified-Plugins/ImagePicker.git#2.1.7
  4. cordova compile

Observe the build succeeds and in the console output is v23.4.0 of Android Support Library:

:prepareComAndroidSupportSupportV42340Library
  1. cordova plugin add [email protected]

Observe the build failed and in the console output is higher than v23.4.0 (e.g v26.0.0-alpha1) of Android Support Library:

:prepareComAndroidSupportSupportV42600Alpha1Library
  1. cordova plugin add cordova-android-support-gradle-release
  2. cordova compile

Observe the build still failed and in the console output is still higher than v23.4.0 (e.g v25.3.1) of Android Support Library:

:prepareComAndroidSupportSupportV42531Library
  1. cordova plugin rm cordova-android-support-gradle-release
  2. cordova plugin add cordova-android-support-gradle-release --variable ANDROID_SUPPORT_VERSION=23.+
  3. cordova prepare && cordova compile

Observe the build succeeds and in the console output is v23 of Android Support Library.

Credits

Thanks to Chris Scott, Transistor Software for his idea of extending the initial implementation to support dynamic specification of the library version via a plugin variable in cordova-google-api-version

License

The MIT License

Copyright (c) 2017 Dave Alden / Working Edge Ltd.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

More Repositories

1

phonegap-launch-navigator

Phonegap/Cordova plugin which launches native route navigation apps for Android, iOS and Windows
Objective-C
368
star
2

cordova-custom-config

Cordova/Phonegap plugin to update platform configuration files based on preferences and config-file data defined in config.xml
JavaScript
317
star
3

cordova-check-plugins

A CLI tool to check for / manage plugin updates in Cordova/Phonegap projects.
JavaScript
216
star
4

react-native-launch-navigator

A React Native module for launching today's most popular navigation/ride apps to navigate to a destination.
Java
120
star
5

cordova-plugin-androidx-adapter

Cordova/Phonegap plugin to migrate any code which references the legacy Android Support Library to the new AndroidX mappings in a Cordova Android platform project.
JavaScript
110
star
6

cordova-android-play-services-gradle-release

Cordova/Phonegap plugin for Android to align versions of the Play Services library components specified by other plugins to a specific version.
JavaScript
110
star
7

cordova-plugin-request-location-accuracy

Cordova/Phonegap plugin for Android and iOS to request enabling/changing of Location Services by triggering a native dialog
Java
95
star
8

cordova-launch-review

Cordova/Phonegap plugin for iOS and Android to assist in leaving user reviews/ratings in the App Stores
Objective-C
70
star
9

cordova-sqlite-porter

Cordova/Phonegap plugin to import/export a SQLite database using either SQL or JSON.
JavaScript
66
star
10

cordova-plugin-androidx

Cordova/Phonegap plugin to enable AndroidX
JavaScript
43
star
11

cordova-plugin-firebasex-test

A Cordova app project to test cordova-plugin-firebasex
JavaScript
34
star
12

phonegap-launch-navigator-example

Example project illustrating how to use the Cordova Launch Navigator plugin for Android/iOS/Windows
JavaScript
31
star
13

cordova-android-firebase-gradle-release

Cordova/Phonegap plugin for Android to align versions of the Firebase library components specified by other plugins to a specific version.
JavaScript
28
star
14

phonegap-istablet

Cordova/Phonegap plugin to determine if current device is a tablet
Objective-C
27
star
15

cordova-custom-config-example

An example Cordova/Phonegap project that demonstrates use of the cordova-custom-config plugin
JavaScript
24
star
16

cordova-plugin-crosswalk-data-migration

Cordova/Phonegap plugin for Android to preserve persistent webview data after removing Crosswalk from your app.
Java
23
star
17

cordova-plugin-inappbrowser-popup-bridge

A fork of cordova-plugin-inappbrowser which adds Braintree's PopupBridge functionality to support PayPal payments
Objective-C
22
star
18

cordova-diagnostic-plugin-example

Demonstrates use of Diagnostic plugin
JavaScript
19
star
19

cordova-plugin-inappbrowser-wkwebview

[DEPRECATED] A fork of cordova-plugin-inappbrowser which is powered by WKWebView
Objective-C
15
star
20

cordova-plugin-hello-kotlin

A simple example of a Cordova plugin that uses Kotlin on Android
JavaScript
13
star
21

cordova-plugin-request-location-accuracy-example

An example app that demonstrates use of cordova-plugin-request-location-accuracy
JavaScript
10
star
22

cordova-plugin-inappbrowser-test

JavaScript
7
star
23

cordova-plugin-firebasex-ionic3-test

CSS
6
star
24

cordova-plugin-hello-c-test

Test project for cordova-plugin-hello-c
JavaScript
5
star
25

cordova-plugin-inappbrowser-popup-bridge-test

Demonstrates usage of Braintree's PopupBridge via the Cordova InappBrowser to add support for emulated popups for PayPal payments
JavaScript
5
star
26

cordova-launch-review-example

Example project illustrating how to use the cordova-launch-review Cordova/Phonegap plugin for Android/iOS
HTML
4
star
27

cordova-sqlite-porter-example-native-plugin

JavaScript
3
star
28

cordova-plugin-config-command

Cordova/Phonegap plugin to run CLI commands defined in config.xml
JavaScript
3
star
29

cordova-sqlite-porter-example

JavaScript
2
star
30

stereoscopic-slideshow

Example slideshow to render stereoscopic side-by-side images in 3D using a VR headset
JavaScript
2
star
31

cordova-diagnostic-plugin-ionic-example

Demonstrates use of Diagnostic plugin with Ionic framework
TypeScript
2
star
32

cordova-plugin-cloud-settings-test

An example project that illustrates usage of the cordova-plugin-cloud-settings plugin.
JavaScript
1
star
33

cordova-plugin-inappbrowser-wkwebview-test

Test app project for cordova-plugin-inappbrowser-wkwebview
HTML
1
star