google-analytics-plugin icon indicating copy to clipboard operation
google-analytics-plugin copied to clipboard

Build Gets failed for Analytics plugin V 1.8.5 @ Android 7.1.1

Open nidhinkumar06 opened this issue 7 years ago • 26 comments

Installed the plugin and while building getting this error:

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

nidhinkumar06 avatar Jul 25 '18 15:07 nidhinkumar06

did you do this? cordova plugin add cordova-plugin-google-analytics --variable GMS_VERSION=11.0.1

victorsosa avatar Jul 25 '18 16:07 victorsosa

even also you can install without it like this: cordova plugin add cordova-plugin-google-analytics

victorsosa avatar Jul 25 '18 16:07 victorsosa

@victorsosa tried both still facing the same error

nidhinkumar06 avatar Jul 25 '18 16:07 nidhinkumar06

I tested it with "cordova-android": "6.4.0" and is working fine

victorsosa avatar Jul 25 '18 16:07 victorsosa

@victorsosa I have tried with cordova-android 7.1.1 and 7.0.1

nidhinkumar06 avatar Jul 25 '18 16:07 nidhinkumar06

@nidhinkumar06 please post a more complete log

victorsosa avatar Jul 25 '18 16:07 victorsosa

When try to build the following log i have got

` * Where: Build file '/home/nidhin/Documents/Nidhinbackup/F/Sivanganga/sivagangamobile/smart-sivaganga- mobile/platforms/android/app/build.gradle' line: 263

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

`

My gradle version is 4.0.2 Cordova version is 8.0.0

nidhinkumar06 avatar Jul 25 '18 16:07 nidhinkumar06

check that you plugin.xml have this:

<preference name="GMS_VERSION" default="11.0.1"/>

victorsosa avatar Jul 25 '18 16:07 victorsosa

@victorsosa could u pls tell me what was it nothing is seen in your message?

nidhinkumar06 avatar Jul 25 '18 16:07 nidhinkumar06

sorry, check above

victorsosa avatar Jul 25 '18 17:07 victorsosa

@victorsosa I don't have this preference in my plugin.xml

nidhinkumar06 avatar Jul 26 '18 04:07 nidhinkumar06

please check you google-analytics-plugin's plugin.xml file to see if it have the correct var definition

victorsosa avatar Jul 26 '18 14:07 victorsosa

in plugins.xml it was like this:

<framework src="com.google.android.gms:play-services-analytics:$GMS_VERSION" /> <preference name="GMS_VERSION" default="11.0.1"/>

changing the order and moving the preference above might fix it for me

ersingencturk avatar Aug 01 '18 21:08 ersingencturk

<preference name="GMS_VERSION" default="11.0.1"/>
<framework src="com.google.android.gms:play-services-analytics:$GMS_VERSION" />

so you mean this?

victorsosa avatar Aug 01 '18 21:08 victorsosa

sorry victorsosa please ignore my comment, it turns out that wasn't the reason for it, I've changed a lot and that one was one of the things.Turns out that it didn't have any effect. I had to remove the plugin temporarly

ersingencturk avatar Aug 03 '18 11:08 ersingencturk

Got the same issue with version 1.8.6. on PhoneGap Build. Full log and plugin.xml in attach.

plugin.xml.txt build_log.txt

RomanVlasov avatar Aug 07 '18 22:08 RomanVlasov

Same problem here.

Please, anyone have found a solution for this?

Regards,

gvsrepins avatar Aug 10 '18 17:08 gvsrepins

Same issue here using Ionic. You can get it to build by modifying "../platforms/android/project.properties" and changing

image

to

image

Replacing GMS_VERSION with "+" should do the trick. Im still curious on the root cause though. This is just a work around.

ghost avatar Aug 18 '18 03:08 ghost

I had to define the variable in package.json "cordova-plugin-google-analytics": { "GMS_VERSION": "11.0.1" } plus in gradle.properties <resource-file src="misc/android/gradle.properties" target="gradle.properties" /> to fix this

Elbtalkessel avatar Aug 19 '18 15:08 Elbtalkessel

GMS_VERSION is a OS variable, it need to be added to the env; do not add to the project.properties

victorsosa avatar Aug 25 '18 15:08 victorsosa

Bug still exists.

plugin.xml (for google analytics plugin) contains: <framework src="com.google.android.gms:play-services-analytics:$GMS_VERSION" /> <preference name="GMS_VERSION" default="11.0.1"/> I've tried changing the order of the lines - did not work

I've also verified that my package.json is defined correctly: "cordova-plugin-google-analytics": { "GMS_VERSION": "11.0.1" } Changing the project.properties to use + does solve the problem, but this means I can't deploy using Jenkins without manual intervention + I'm not sure what this change actually means regargint the GMS version.

Is there a plan to fix this?

gnesher avatar Aug 28 '18 07:08 gnesher

I am also getting the same error:

A problem occurred evaluating root project 'android'.
> Could not get unknown property 'GMS_VERSION' for object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

I have the following configuration:

Cordova 6.5
Android 6.2.3
Gradle 4.10.1

I also tried the solution by @hanischa and it fixed the build for now, but a fix would be great.

Happy to provide further information.

tjg37 avatar Sep 20 '18 10:09 tjg37

Quick sed script to fix this when removing the var from the project.properties

sed -i -e "s/$GSM_VERSION/+/g" platforms/android/project.properties

meehanman avatar Sep 21 '18 14:09 meehanman

Added this in an after_platform_add hook

sed -i -e 's/$GMS_VERSION/+/g' platforms/android/project.properties

robindierckx avatar Sep 24 '18 16:09 robindierckx

I can confirm the problem.

On a working Cordova project (we are using Cordova for Visual Studio) I added this plugin by opening config.xml in Visual Studio then going to Plugins -> Custom -> Git, using https://github.com/danwilson/google-analytics-plugin.git and GMS_VERSION = 11.0.1

When I deploy to Device I get:

Could not find property 'GMS_VERSION' on org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler_Decorated@4c438c28. A problem occurred evaluating root project 'android'. ...\platforms\android\build.gradle line: 252

Then when I change '$GMS_VERSION' into '+' in '\platforms\android\project.properties', it builds normally again.

I checked plugin.xml and it has <preference name="GMS_VERSION" default="11.0.1"/>

SanderPs avatar Mar 07 '19 10:03 SanderPs

$GMS_VERSION to + in Project.properties fixed error in VS 2017.

saqinz avatar Sep 25 '19 07:09 saqinz