Could not get unknown property 'GOOGLE_PLAY_SERVICES_VERSION'


#1

hey all ,
my ionic project was working well before setup the cordova background geoloactions it’s give me this error

* Where:
Build file '/Volumes/Partion/App/Projects/Go-Taxi-Driver-Final/platforms/android/build.gradle' line: 255

* What went wrong:
A problem occurred evaluating root project 'android'.
> Could not get unknown property 'GOOGLE_PLAY_SERVICES_VERSION' for object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

my plugin list

cordova-custom-config 4.0.2 "cordova-custom-config"
cordova-plugin-camera 2.4.1 "Camera"
cordova-plugin-compat 1.2.0 "Compat"
cordova-plugin-device 1.1.4 "Device"
cordova-plugin-geolocation 2.4.3 "Geolocation"
cordova-plugin-mauron85-background-geolocation 2.3.3 "CDVBackgroundGeolocation"
cordova-plugin-splashscreen 4.0.3 "Splashscreen"
cordova-plugin-whitelist 1.3.1 "Whitelist"
cordova-sqlite-storage 2.0.4 "Cordova sqlite storage plugin"
ionic-plugin-keyboard 2.2.1 "Keyboard"
mx.ferreyra.callnumber 0.0.2 "Cordova Call Number Plugin"
onesignal-cordova-plugin 2.2.2 "OneSignal Push Notifications"

and my ionic info

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

    @ionic/cli-utils  : 1.19.0
    ionic (Ionic CLI) : 3.19.0

global packages:

    cordova (Cordova CLI) : 7.0.1 

local packages:

    @ionic/app-scripts : 3.0.1
    Cordova Platforms  : android 6.2.3 ios 4.4.0
    Ionic Framework    : ionic-angular 3.7.1

System:

    ios-sim : 6.1.2 
    Node    : v8.4.0
    npm     : 4.2.0 
    OS      : macOS Sierra
    Xcode   : Xcode 8.2.1 Build version 8C1002 

Environment Variables:

    ANDROID_HOME : not set

Misc:

    backend : legacy

this error happen when build android only , by when build ios every thing work fine
any one can help me ?
thanks in advance


#2

no one can help me ?


#3

solved by removing the background-golocation and re-add it again


#4

What platform are you using? I am still getting this error.

I removed the plugin and added it again, but getting this error

* Where:
Build file 'D:\Dokumenter\GitHub\Geme\platforms\android\build.gradle' line: 266

* What went wrong:
A problem occurred evaluating root project 'android'.
> Could not get unknown property 'GOOGLE_PLAY_SERVICES_VERSION' for object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

#5

solution:
goto =>project folder\platforms\android\project.properties
edit and change PLAY_SERVICES_VERSION to 9.2.1.
like bellow:
cordova.system.library.1=com.google.android.gms:play-services-base:9.2.1

cordova.system.library.2=com.google.android.gms:play-services-ads:9.2.1

link for solution: https://stackoverflow.com/questions/39265432/could-not-get-unknown-property-compile-for-object-of-type-org-gradle-api-inter


#6

thanks you this was my solution to :smiley:


#8

In \platforms\android\project.properties, replace PLAY_SERVICES_VERSION by “+” only
com.google.android.gms:play-services-base:+
com.google.android.gms:play-services-ads:+


#9

I also have same problem but when I edit PLAY_SERVICES_VERSION to
cordova.system.library.1=com.google.android.gms:play-services-base:9.2.1

cordova.system.library.2=com.google.android.gms:play-services-ads:9.2.1
it give another error at the time of build application

                                                    ^

symbol: class CameraUpdate
location: class PluginMap
C:\Users\kiran Gajbhiye\demoApp2\platforms\android\src\plugin\google\maps\PluginMap.java:2103: error: cannot find symbol
public boolean onMarkerClick(Marker marker) {
^
symbol: class Marker
location: class PluginMap
C:\Users\kiran Gajbhiye\demoApp2\platforms\android\src\plugin\google\maps\PluginMap.java:2159: error: cannot find symbol
public void onInfoWindowClick(Marker marker) {
^
symbol: class Marker
location: class PluginMap
C:\Users\kiran Gajbhiye\demoApp2\platforms\android\src\plugin\google\maps\PluginMap.java:2171: error: cannot find symbol
public void onMarkerDrag(Marker marker) {
^
symbol: class Marker
location: class PluginMap
C:\Users\kiran Gajbhiye\demoApp2\platforms\android\src\plugin\google\maps\PluginMap.java:2183: error: cannot find symbol
public void onMarkerDragEnd(Marker marker) {
^
symbol: class Marker
location: class PluginMap
C:\Users\kiran Gajbhiye\demoApp2\platforms\android\src\plugin\google\maps\PluginMap.java:2195: error: cannot find symbol
public void onMarkerDragStart(Marker marker) {
^
symbol: class Marker
location: class PluginMap
C:\Users\kiran Gajbhiye\demoApp2\platforms\android\src\plugin\google\maps\PluginMap.java:2207: error: cannot find symbol
public void onInfoWindowLongClick(Marker marker) {
^
symbol: class Marker
location: class PluginMap
C:\Users\kiran Gajbhiye\demoApp2\platforms\android\src\plugin\google\maps\PluginMap.java:2218: error: cannot find symbol
public void onInfoWindowClose(Marker marker) {
^
symbol: class Marker
location: class PluginMap
C:\Users\kiran Gajbhiye\demoApp2\platforms\android\src\plugin\google\maps\PluginMap.java:2252: error: cannot find symbol
public void onMarkerEvent(String eventName, Marker marker) {
^
symbol: class Marker
location: class PluginMap
C:\Users\kiran Gajbhiye\demoApp2\platforms\android\src\plugin\google\maps\PluginMap.java:2266: error: cannot find symbol
public void onClusterEvent(String eventName, Marker marker) {
^
symbol: class Marker
location: class PluginMap
C:\Users\kiran Gajbhiye\demoApp2\platforms\android\src\plugin\google\maps\PluginMap.java:2293: error: cannot find symbol
public void onOverlayEvent(String eventName, String overlayId, LatLng point) {
^
symbol: class LatLng
location: class PluginMap
C:\Users\kiran Gajbhiye\demoApp2\platforms\android\src\plugin\google\maps\PluginMap.java:2298: error: cannot find symbol
public void onPolylineClick(Polyline polyline, LatLng point) {
^
symbol: class Polyline
location: class PluginMap
C:\Users\kiran Gajbhiye\demoApp2\platforms\android\src\plugin\google\maps\PluginMap.java:2298: error: cannot find symbol
public void onPolylineClick(Polyline polyline, LatLng point) {
^
symbol: class LatLng
location: class PluginMap
C:\Users\kiran Gajbhiye\demoApp2\platforms\android\src\plugin\google\maps\PluginMap.java:2302: error: cannot find symbol
public void onPolygonClick(Polygon polygon, LatLng point) {
^
symbol: class Polygon
location: class PluginMap
C:\Users\kiran Gajbhiye\demoApp2\platforms\android\src\plugin\google\maps\PluginMap.java:2302: error: cannot find symbol
public void onPolygonClick(Polygon polygon, LatLng point) {
^
symbol: class LatLng
location: class PluginMap
C:\Users\kiran Gajbhiye\demoApp2\platforms\android\src\plugin\google\maps\PluginMap.java:2306: error: cannot find symbol
public void onCircleClick(Circle circle, LatLng point) {
^
symbol: class Circle
location: class PluginMap
C:\Users\kiran Gajbhiye\demoApp2\platforms\android\src\plugin\google\maps\PluginMap.java:2306: error: cannot find symbol
public void onCircleClick(Circle circle, LatLng point) {
^
symbol: class LatLng
location: class PluginMap
C:\Users\kiran Gajbhiye\demoApp2\platforms\android\src\plugin\google\maps\PluginMap.java:2310: error: cannot find symbol
public void onGroundOverlayClick(GroundOverlay groundOverlay, LatLng point) {
^
symbol: class GroundOverlay
location: class PluginMap
C:\Users\kiran Gajbhiye\demoApp2\platforms\android\src\plugin\google\maps\PluginMap.java:2310: error: cannot find symbol
public void onGroundOverlayClick(GroundOverlay groundOverlay, LatLng point) {
^
symbol: class LatLng
location: class PluginMap
C:\Users\kiran Gajbhiye\demoApp2\platforms\android\src\plugin\google\maps\PluginMap.java:2330: error: cannot find symbol
public void onMapEvent(final String eventName, final LatLng point) {
^
symbol: class LatLng
location: class PluginMap
C:\Users\kiran Gajbhiye\demoApp2\platforms\android\src\plugin\google\maps\PluginMap.java:2337: error: cannot find symbol
public void onMapLongClick(LatLng point) {
^
symbol: class LatLng
location: class PluginMap
C:\Users\kiran Gajbhiye\demoApp2\platforms\android\src\plugin\google\maps\PluginMap.java:2341: error: cannot find symbol
private double calculateDistance(LatLng pt1, LatLng pt2){
^
symbol: class LatLng
location: class PluginMap
C:\Users\kiran Gajbhiye\demoApp2\platforms\android\src\plugin\google\maps\PluginMap.java:2341: error: cannot find symbol
private double calculateDistance(LatLng pt1, LatLng pt2){
^
symbol: class LatLng
location: class PluginMap
C:\Users\kiran Gajbhiye\demoApp2\platforms\android\src\plugin\google\maps\PluginMap.java:2357: error: cannot find symbol
private boolean isPointOnTheLine(List points, LatLng point) {
^
symbol: class LatLng
location: class PluginMap
C:\Users\kiran Gajbhiye\demoApp2\platforms\android\src\plugin\google\maps\PluginMap.java:2357: error: cannot find symbol
private boolean isPointOnTheLine(List points, LatLng point) {
^
symbol: class LatLng
location: class PluginMap
C:\Users\kiran Gajbhiye\demoApp2\platforms\android\src\plugin\google\maps\PluginMap.java:2384: error: cannot find symbol
private boolean isPointOnTheGeodesicLine(List points, LatLng point, double threshold) {
^
symbol: class LatLng
location: class PluginMap
C:\Users\kiran Gajbhiye\demoApp2\platforms\android\src\plugin\google\maps\PluginMap.java:2384: error: cannot find symbol
private boolean isPointOnTheGeodesicLine(List points, LatLng point, double threshold) {
^
symbol: class LatLng
location: class PluginMap
C:\Users\kiran Gajbhiye\demoApp2\platforms\android\src\plugin\google\maps\PluginMap.java:2417: error: cannot find symbol
private boolean isPolygonContains(List path, LatLng point) {
^
symbol: class LatLng
location: class PluginMap
C:\Users\kiran Gajbhiye\demoApp2\platforms\android\src\plugin\google\maps\PluginMap.java:2417: error: cannot find symbol
private boolean isPolygonContains(List path, LatLng point) {
^
symbol: class LatLng
location: class PluginMap
C:\Users\kiran Gajbhiye\demoApp2\platforms\android\src\plugin\google\maps\PluginMap.java:2454: error: cannot find symbol
private boolean isCircleContains(Circle circle, LatLng point) {
^
symbol: class Circle
location: class PluginMap
C:\Users\kiran Gajbhiye\demoApp2\platforms\android\src\plugin\google\maps\PluginMap.java:2454: error: cannot find symbol
private boolean isCircleContains(Circle circle, LatLng point) {
^
symbol: class LatLng
location: class PluginMap
C:\Users\kiran Gajbhiye\demoApp2\platforms\android\src\plugin\google\maps\PluginMap.java:2478: error: cannot find symbol
private boolean isGroundOverlayContains(GroundOverlay groundOverlay, LatLng point) {
^
symbol: class GroundOverlay
location: class PluginMap
C:\Users\kiran Gajbhiye\demoApp2\platforms\android\src\plugin\google\maps\PluginMap.java:2478: error: cannot find symbol
private boolean isGroundOverlayContains(GroundOverlay groundOverlay, LatLng point) {
^
symbol: class LatLng
location: class PluginMap
C:\Users\kiran Gajbhiye\demoApp2\platforms\android\src\plugin\google\maps\PluginMap.java:2632: error: cannot find symbol
public void onIndoorLevelActivated(IndoorBuilding building) {
^
symbol: class IndoorBuilding
location: class PluginMap
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
100 errors

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ‘:compileDebugJavaWithJavac’.

Compilation failed; see the compiler error output for details.

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
    Incremental java compilation is an incubating feature.
    The TaskInputs.source(Object) method has been deprecated and is scheduled to be removed in Gradle 4.0. Please use TaskInputs.file(Object).skipWhenEmpty() instead.
    :preBuild UP-TO-DATE
    :preDebugBuild UP-TO-DATE
    :checkDebugManifest
    :preReleaseBuild UP-TO-DATE
    :CordovaLib:preBuild UP-TO-DATE
    :CordovaLib:preDebugBuild UP-TO-DATE
    :CordovaLib:checkDebugManifest
    :CordovaLib:prepareDebugDependencies
    :CordovaLib:compileDebugAidl UP-TO-DATE
    :CordovaLib:compileDebugNdk UP-TO-DATE
    :CordovaLib:compileLint UP-TO-DATE
    :CordovaLib:copyDebugLint UP-TO-DATE
    :CordovaLib:mergeDebugShaders UP-TO-DATE
    :CordovaLib:compileDebugShaders UP-TO-DATE
    :CordovaLib:generateDebugAssets UP-TO-DATE
    :CordovaLib:mergeDebugAssets UP-TO-DATE
    :CordovaLib:mergeDebugProguardFiles UP-TO-DATE
    :CordovaLib:packageDebugRenderscript UP-TO-DATE
    :CordovaLib:compileDebugRenderscript UP-TO-DATE
    :CordovaLib:generateDebugResValues UP-TO-DATE
    :CordovaLib:generateDebugResources UP-TO-DATE
    :CordovaLib:packageDebugResources UP-TO-DATE
    :CordovaLib:processDebugManifest UP-TO-DATE
    :CordovaLib:generateDebugBuildConfig UP-TO-DATE
    :CordovaLib:processDebugResources UP-TO-DATE
    :CordovaLib:generateDebugSources UP-TO-DATE
    :CordovaLib:incrementalDebugJavaCompilationSafeguard UP-TO-DATE
    :CordovaLib:compileDebugJavaWithJavac UP-TO-DATE
    :CordovaLib:processDebugJavaRes UP-TO-DATE
    :CordovaLib:transformResourcesWithMergeJavaResForDebug UP-TO-DATE
    :CordovaLib:transformClassesAndResourcesWithSyncLibJarsForDebug UP-TO-DATE
    :CordovaLib:mergeDebugJniLibFolders UP-TO-DATE
    :CordovaLib:transformNative_libsWithMergeJniLibsForDebug UP-TO-DATE
    :CordovaLib:transformNative_libsWithSyncJniLibsForDebug UP-TO-DATE
    :CordovaLib:bundleDebug UP-TO-DATE
    :CordovaLib:preReleaseBuild UP-TO-DATE
    :CordovaLib:checkReleaseManifest
    :CordovaLib:prepareReleaseDependencies
    :CordovaLib:compileReleaseAidl UP-TO-DATE
    :CordovaLib:compileReleaseNdk UP-TO-DATE
    :CordovaLib:copyReleaseLint UP-TO-DATE
    :CordovaLib:mergeReleaseShaders UP-TO-DATE
    :CordovaLib:compileReleaseShaders UP-TO-DATE
    :CordovaLib:generateReleaseAssets UP-TO-DATE
    :CordovaLib:mergeReleaseAssets UP-TO-DATE
    :CordovaLib:mergeReleaseProguardFiles UP-TO-DATE
    :CordovaLib:packageReleaseRenderscript UP-TO-DATE
    :CordovaLib:compileReleaseRenderscript UP-TO-DATE
    :CordovaLib:generateReleaseResValues UP-TO-DATE
    :CordovaLib:generateReleaseResources UP-TO-DATE
    :CordovaLib:packageReleaseResources UP-TO-DATE
    :CordovaLib:processReleaseManifest UP-TO-DATE
    :CordovaLib:generateReleaseBuildConfig UP-TO-DATE
    :CordovaLib:processReleaseResources UP-TO-DATE
    :CordovaLib:generateReleaseSources UP-TO-DATE
    :CordovaLib:incrementalReleaseJavaCompilationSafeguard UP-TO-DATE
    :CordovaLib:compileReleaseJavaWithJavac UP-TO-DATE
    :CordovaLib:processReleaseJavaRes UP-TO-DATE
    :CordovaLib:transformResourcesWithMergeJavaResForRelease UP-TO-DATE
    :CordovaLib:transformClassesAndResourcesWithSyncLibJarsForRelease UP-TO-DATE
    :CordovaLib:mergeReleaseJniLibFolders UP-TO-DATE
    :CordovaLib:transformNative_libsWithMergeJniLibsForRelease UP-TO-DATE
    :CordovaLib:transformNative_libsWithSyncJniLibsForRelease UP-TO-DATE
    :CordovaLib:bundleRelease UP-TO-DATE
    :prepareComAndroidSupportSupportCompat2520Library UP-TO-DATE
    :prepareComAndroidSupportSupportCoreUi2520Library UP-TO-DATE
    :prepareComAndroidSupportSupportCoreUtils2520Library UP-TO-DATE
    :prepareComAndroidSupportSupportFragment2520Library UP-TO-DATE
    :prepareComAndroidSupportSupportMediaCompat2520Library UP-TO-DATE
    :prepareComAndroidSupportSupportV42520Library UP-TO-DATE
    :prepareComGoogleAndroidGmsPlayServicesAds1104Library UP-TO-DATE
    :prepareComGoogleAndroidGmsPlayServicesAdsLite1104Library UP-TO-DATE
    :prepareComGoogleAndroidGmsPlayServicesBase1104Library UP-TO-DATE
    :prepareComGoogleAndroidGmsPlayServicesBasement1104Library UP-TO-DATE
    :prepareComGoogleAndroidGmsPlayServicesClearcut1104Library UP-TO-DATE
    :prepareComGoogleAndroidGmsPlayServicesGass1104Library UP-TO-DATE
    :prepareComGoogleAndroidGmsPlayServicesSafetynet1104Library UP-TO-DATE
    :prepareComGoogleAndroidGmsPlayServicesTasks1104Library UP-TO-DATE
    :prepareOrgApacheCordovaCordovaLib623DebugLibrary UP-TO-DATE
    :prepareDebugDependencies
    :compileDebugAidl UP-TO-DATE
    :compileDebugRenderscript UP-TO-DATE
    :generateDebugBuildConfig UP-TO-DATE
    :generateDebugResValues UP-TO-DATE
    :generateDebugResources UP-TO-DATE
    :mergeDebugResources UP-TO-DATE
    :processDebugManifest UP-TO-DATE
    :processDebugResources UP-TO-DATE
    :generateDebugSources UP-TO-DATE
    :incrementalDebugJavaCompilationSafeguard UP-TO-DATE
    :compileDebugJavaWithJavac
    :compileDebugJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.).
    :compileDebugJavaWithJavac FAILED

BUILD FAILED

Total time: 1 mins 9.273 secs
[ERROR] An error occurred while running cordova build android (exit code 1).

please provide solution


#10

9.2.1 is too old for the maps plugin. The maps plugin requires 11.8.0 at least. You need to specifies other libraries also.


#11

Why do we have to specify a particular version of the plugin? How come this isn’t set automatically already?


#12

each version of the plugin require a different version of google play service so , you have two options
1- downgrade to version that match with your google play service
2- using the latest plugin version and update your google play service

when you install the plugin you specify the version of the plugin based on your google play service