[ 
https://issues.apache.org/jira/browse/CB-14154?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Christopher Scott updated CB-14154:
-----------------------------------
    Description: 
I am a full-time plugin developer.  Like many other plugins, I import Google 
Play Services dependencies in addition to Android Support libraries 
(appcompat-v7).

By far the biggest problem I encounter with my users is [Gradle 
conflicts|https://github.com/transistorsoft/cordova-background-geolocation-lt/issues?utf8=%E2%9C%93&q=android+build+error]
 due to multiple plugins importing different versions of 
{color:#333333}play-services / Firebase / com.android.support{color} libraries.

Many plugin authors do the wrong thing and simply use version ":+", eg: 
[cordova-plugin-firebase|https://github.com/arnesson/cordova-plugin-firebase/blob/master/plugin.xml#L61-L67]].

Quite often, my solution for these users is to [edit 
platforms/android/project.properties|https://github.com/transistorsoft/cordova-background-geolocation-lt/issues/699#issuecomment-396083457]*_,_*
 which is not the best long-term solution, since this file is _volatile_.

What I've been doing since [email protected] is [expose custom config properties in 
my plugins' 
plugin.xml|https://github.com/transistorsoft/cordova-background-geolocation-lt/blob/master/plugin.xml#L98-L101].
  This is nice, but users must align their google-play / Firebase / Support 
dependencies [for each plugin that exposes 
these|https://github.com/transistorsoft/cordova-background-geolocation-lt#configuring-play-services-version]
 helpful properties (and not many plugins do).

 

What would *_really_* help, is if cordova-android could expose variables in the 
app's config.xml in the same manner as:
 * cdvCompileSdkVersion
 * cdvBuildToolsVersion
 * cdvMinSdkVersion

I would like to see the following properties added:
 * cdvGooglePlayServicesVersion
 * cdvSupportLibVersion

(Note:  cdvGooglePlayServicesVersion could be named cdvGoogleApiVersion as a 
more common name, since both Firebase and Google Play Services dependencies 
must be aligned to the same version.)

I would like to be able to access these properties in my plugin's [plugin.xml 
here|https://github.com/transistorsoft/cordova-background-geolocation-lt/blob/master/plugin.xml#L99]]
 instead of using my plugin's custom $GOOGLE_API_VERSION variable.

In a React Native app, which provides direct control over one's top-level 
build.gradle, we do it [like 
this|https://github.com/transistorsoft/rn-background-geolocation-demo/blob/master/android/build.gradle#L33-L38]].
  3rd-party plugins then check for the existence of these Gradle Config 
Properties when importing their Google dependencies, [like 
this|https://github.com/transistorsoft/react-native-background-geolocation/blob/master/android/build.gradle#L33].

This technique is also recommend at android.developer.com in the document 
[Gradle Tips and Tricks|https://developer.android.com/studio/build/gradle-tips] 
(search "project-wide properties")

 

  was:
I am a full-time plugin developer.  Like many other plugins, I import Google 
Play Services dependencies in addition to Android Support libraries 
(appcompat-v7).

By far the biggest problem I encounter with my users is [Gradle 
conflicts|https://github.com/transistorsoft/cordova-background-geolocation-lt/issues?utf8=%E2%9C%93&q=android+build+error]
 due to multiple plugins importing different versions of 
{color:#333333}play-services / Firebase / com.android.support{color} libraries.

Many plugin authors do the wrong thing and simply use version ":+", eg: 
[cordova-plugin-firebase|https://github.com/arnesson/cordova-plugin-firebase/blob/master/plugin.xml#L61-L67]].

Quite often, my solution for these users is to [edit 
platforms/android/project.properties|https://github.com/transistorsoft/cordova-background-geolocation-lt/issues/699#issuecomment-396083457]*_,_*
 which is not the best long-term solution, since this file is _volatile_.

What I've been doing since [email protected] is [expose custom config properties in 
my plugins' 
plugin.xml|https://github.com/transistorsoft/cordova-background-geolocation-lt/blob/master/plugin.xml#L98-L101].
  This is nice, but users must align their google-play / Firebase / Support 
dependencies [for each plugin that exposes 
these|https://github.com/transistorsoft/cordova-background-geolocation-lt#configuring-play-services-version]
 helpful properties (and not many plugins do).

 

What would *_really_* help, is if cordova-android could expose variables in the 
app's config.xml in the same manner as:
 * cdvCompileSdkVersion
 * cdvBuildToolsVersion
 * cdvMinSdkVersion

I would like to see the following properties added:
 * cdvGooglePlayServicesVersion
 * cdvSupportLibVersion

(Note:  cdvGooglePlayServicesVersion could be named cdvGoogleApiVersion as a 
more common name, since both Firebase and Google Play Services dependencies 
must be aligned to the same version.)

I would like to be able to access these properties in my plugin's [plugin.xml 
here|https://github.com/transistorsoft/cordova-background-geolocation-lt/blob/master/plugin.xml#L99]]
 instead of using my plugin's custom $GOOGLE_API_VERSION variable.

In a React Native app, which provides direct control over one's top-level 
build.gradle, we do it [like 
this|https://github.com/transistorsoft/rn-background-geolocation-demo/blob/master/android/build.gradle#L33-L38]].
  3rd-party plugins then check for the existence of these Gradle Config 
Properties when importing their Google dependencies, [like 
this|https://github.com/transistorsoft/react-native-background-geolocation/blob/master/android/build.gradle#L33].

 

 


> Expose gradle configuration properties in config.xml to assist aligning 
> Google Play Services / Firebase
> -------------------------------------------------------------------------------------------------------
>
>                 Key: CB-14154
>                 URL: https://issues.apache.org/jira/browse/CB-14154
>             Project: Apache Cordova
>          Issue Type: Improvement
>          Components: cordova-android
>    Affects Versions: cordova-android-7.0.0
>            Reporter: Christopher Scott
>            Assignee: Joe Bowser
>            Priority: Major
>              Labels: build
>
> I am a full-time plugin developer.  Like many other plugins, I import Google 
> Play Services dependencies in addition to Android Support libraries 
> (appcompat-v7).
> By far the biggest problem I encounter with my users is [Gradle 
> conflicts|https://github.com/transistorsoft/cordova-background-geolocation-lt/issues?utf8=%E2%9C%93&q=android+build+error]
>  due to multiple plugins importing different versions of 
> {color:#333333}play-services / Firebase / com.android.support{color} 
> libraries.
> Many plugin authors do the wrong thing and simply use version ":+", eg: 
> [cordova-plugin-firebase|https://github.com/arnesson/cordova-plugin-firebase/blob/master/plugin.xml#L61-L67]].
> Quite often, my solution for these users is to [edit 
> platforms/android/project.properties|https://github.com/transistorsoft/cordova-background-geolocation-lt/issues/699#issuecomment-396083457]*_,_*
>  which is not the best long-term solution, since this file is _volatile_.
> What I've been doing since [email protected] is [expose custom config properties 
> in my plugins' 
> plugin.xml|https://github.com/transistorsoft/cordova-background-geolocation-lt/blob/master/plugin.xml#L98-L101].
>   This is nice, but users must align their google-play / Firebase / Support 
> dependencies [for each plugin that exposes 
> these|https://github.com/transistorsoft/cordova-background-geolocation-lt#configuring-play-services-version]
>  helpful properties (and not many plugins do).
>  
> What would *_really_* help, is if cordova-android could expose variables in 
> the app's config.xml in the same manner as:
>  * cdvCompileSdkVersion
>  * cdvBuildToolsVersion
>  * cdvMinSdkVersion
> I would like to see the following properties added:
>  * cdvGooglePlayServicesVersion
>  * cdvSupportLibVersion
> (Note:  cdvGooglePlayServicesVersion could be named cdvGoogleApiVersion as a 
> more common name, since both Firebase and Google Play Services dependencies 
> must be aligned to the same version.)
> I would like to be able to access these properties in my plugin's [plugin.xml 
> here|https://github.com/transistorsoft/cordova-background-geolocation-lt/blob/master/plugin.xml#L99]]
>  instead of using my plugin's custom $GOOGLE_API_VERSION variable.
> In a React Native app, which provides direct control over one's top-level 
> build.gradle, we do it [like 
> this|https://github.com/transistorsoft/rn-background-geolocation-demo/blob/master/android/build.gradle#L33-L38]].
>   3rd-party plugins then check for the existence of these Gradle Config 
> Properties when importing their Google dependencies, [like 
> this|https://github.com/transistorsoft/react-native-background-geolocation/blob/master/android/build.gradle#L33].
> This technique is also recommend at android.developer.com in the document 
> [Gradle Tips and 
> Tricks|https://developer.android.com/studio/build/gradle-tips] (search 
> "project-wide properties")
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to