Could not get unknown property 'ANDROID_SUPPORT_V4_VERSION' and 'PLAY_SERVICES_VERSION'


#1

cordova information: (run $> cordova plugin list)

cordova-android-play-services-gradle-release 1.3.1 "cordova-android-play-services-gradle-release"
cordova-android-support-gradle-release 1.3.0 "cordova-android-support-gradle-release"
cordova-fabric-plugin 1.1.14-dev "cordova-fabric-plugin"
cordova-plugin-advanced-http 1.11.1 "Advanced HTTP plugin"
cordova-plugin-device 2.0.2 "Device"
cordova-plugin-file 6.0.1 "File"
cordova-plugin-googlemaps 2.2.9 "cordova-plugin-googlemaps"
cordova-plugin-ionic-keyboard 2.0.5 "cordova-plugin-ionic-keyboard"
cordova-plugin-ionic-webview 1.2.1 "cordova-plugin-ionic-webview"
cordova-plugin-network-information 2.0.1 "Network Information"
cordova-plugin-splashscreen 5.0.2 "Splashscreen"
cordova-plugin-whitelist 1.3.3 "Whitelist"

**If you use `@ionic-native/google-maps`, please tell the package.json (only `@ionic-native/core` and `@ionic-native/google-maps` are fine mostly)**

@ionic-native/core: “4.7.0”,
@ionic-native/google-maps: “^4.7.0”



Ionic info command result:

cli packages: (/usr/local/lib/node_modules)

@ionic/cli-utils  : 1.19.2
ionic (Ionic CLI) : 3.20.0

global packages:

cordova (Cordova CLI) : 7.0.1 

local packages:

@ionic/app-scripts : 3.1.9
Cordova Platforms  : android 6.4.0
Ionic Framework    : ionic-angular 3.9.2

System:

Android SDK Tools : 26.1.1
ios-deploy        : 1.9.2 
ios-sim           : 6.1.2 
Node              : v9.9.0
npm               : 5.7.1 
OS                : macOS High Sierra
Xcode             : Xcode 9.3 Build version 9E145 

Environment Variables:

ANDROID_HOME : /Users/juanramos/Library/Android/sdk





When I build with ionic cordova build android [--prod] It reports this error:

`Could not get unknown property 'PLAY_SERVICES_VERSION' for object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.`

If I install the plugin cordova-android-play-services-gradle-release with the variable --variable PLAY_SERVICES_VERSION=11.8.0

It reports only the ANDROID_SUPPORT_V4_VERSION error. I have already tried to install the plugin [cordova-android-support-gradle-release](https://www.npmjs.com/package/cordova-android-support-gradle-release) but this plugin not works


**Expected behavior:**
App compiles without problems



Any idea?

#2

I’m running into this issue now, did you find a solution?


#3

Yes. Cordova Google Maps plugin > 2.1.1 uses environment variables to asign version dependencies like google play services.

Cordova includes support to this variables since 7.1.1 version. In my case I used 7.0.1 and upgrading to cordova 8 solves the problem.


#4

ok thanks, I’m not using that plugin and I’ve tried a number of different versions with no luck


#5
// upgrade cordova itself.
$> npm -g install cordova 

// reinstall the maps plugins
$> ionic cordova plugin rm cordova-plugin-googlemaps
$> ionic cordova plugin add cordova-plugin-googlemaps@2.3.6 \
  --variable API_KEY_FOR_ANDROID="..." \
  --variable API_KEY_FOR_IOS="..." \
  --variable PLAY_SERVICES_VERSION ="15.0.1" \    // you need to specify the same version as other plugins.
  -- variable ANDROID_SUPPORT_V4_VERSION="27.0.1"

$> npm install @ionic-native/core @ionic-native/google-maps

#6

Thanks, but cordova is already at the latest and I’m not using the google maps plugin