File tree Expand file tree Collapse file tree 2 files changed +19
-2
lines changed
bin/templates/project/app Expand file tree Collapse file tree 2 files changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -32,9 +32,22 @@ buildscript {
3232 classpath ' com.android.tools.build:gradle:3.3.0'
3333
3434 if (cdvHelpers. getConfigPreference(' EnableGoogleServicesPlugin' , ' false' ). toBoolean()) {
35- println ' Adding classpath "com.google.gms:google-services:4.1.0"'
35+ String defaultGoogleServiceVersion = ' 4.2.0'
36+
37+ /**
38+ * Fetches the user's defined Google Services Plugin Version from config.xml.
39+ * If the version is not set or invalid, it will default to the ${defaultGoogleServiceVersion}
40+ */
41+ String googleServicesVersion = cdvHelpers. getConfigPreference(' GoogleServicesPluginVersion' , defaultGoogleServiceVersion)
42+ if (! cdvHelpers. isVersionValid(googleServicesVersion)) {
43+ println (" The defined Google Services plugin version (${ googleServicesVersion} ) does not appear to be a valid version. Falling back to version: ${ defaultGoogleServiceVersion} ." )
44+ googleServicesVersion = defaultGoogleServiceVersion
45+ }
3646
37- classpath ' com.google.gms:google-services:4.1.0'
47+ // Create the Google Services classpath and set it.
48+ String googleServicesClassPath = " com.google.gms:google-services:${ googleServicesVersion} "
49+ println " Adding classpath: ${ googleServicesClassPath} "
50+ classpath googleServicesClassPath
3851 }
3952 }
4053}
Original file line number Diff line number Diff line change @@ -48,6 +48,10 @@ Version[] getAvailableBuildTools() {
4848 .sort { a , b -> a. isHigherThan(b) ? -1 : 1 }
4949}
5050
51+ Boolean isVersionValid (version ) {
52+ return ! (new Version (version)). isEqual(' 0.0.0' )
53+ }
54+
5155String doFindLatestInstalledBuildTools (String minBuildToolsVersionString ) {
5256 def availableBuildToolsVersions
5357 try {
You can’t perform that action at this time.
0 commit comments