danwilson / google-analytics-plugin

Cordova (PhoneGap) Plugin to connect to the native Google's Universal Analytics SDK 3.0
MIT License
694 stars 500 forks source link

Build Gets failed for Analytics plugin V 1.8.5 @ Android 7.1.1 #525

Open nidhinkumar06 opened 5 years ago

nidhinkumar06 commented 5 years ago

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.

victorsosa commented 5 years ago

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

victorsosa commented 5 years ago

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

nidhinkumar06 commented 5 years ago

@victorsosa tried both still facing the same error

victorsosa commented 5 years ago

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

nidhinkumar06 commented 5 years ago

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

victorsosa commented 5 years ago

@nidhinkumar06 please post a more complete log

nidhinkumar06 commented 5 years ago

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

victorsosa commented 5 years ago

check that you plugin.xml have this:

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

nidhinkumar06 commented 5 years ago

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

victorsosa commented 5 years ago

sorry, check above

nidhinkumar06 commented 5 years ago

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

victorsosa commented 5 years ago

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

ersingencturk commented 5 years ago

in plugins.xml it was like this:

``

``

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

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

so you mean this?

ersingencturk commented 5 years ago

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

RomanVlasov commented 5 years ago

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

gvsrepins commented 5 years ago

Same problem here.

Please, anyone have found a solution for this?

Regards,

ghost commented 5 years ago

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.

Elbtalkessel commented 5 years ago

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

victorsosa commented 5 years ago

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

gnesher commented 5 years ago

Bug still exists.

plugin.xml (for google analytics plugin) contains: `

` 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?

tjg37 commented 5 years ago

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.

meehanman commented 5 years ago

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

robindierckx commented 5 years ago

Added this in an after_platform_add hook

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

SanderPs commented 5 years ago

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"/>

saqinz commented 4 years ago

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