Open nidhinkumar06 opened 5 years ago
did you do this? cordova plugin add cordova-plugin-google-analytics --variable GMS_VERSION=11.0.1
even also you can install without it like this: cordova plugin add cordova-plugin-google-analytics
@victorsosa tried both still facing the same error
I tested it with "cordova-android": "6.4.0" and is working fine
@victorsosa I have tried with cordova-android 7.1.1 and 7.0.1
@nidhinkumar06 please post a more complete log
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
check that you plugin.xml have this:
<preference name="GMS_VERSION" default="11.0.1"/>
@victorsosa could u pls tell me what was it nothing is seen in your message?
sorry, check above
@victorsosa I don't have this preference in my plugin.xml
please check you google-analytics-plugin's plugin.xml file to see if it have the correct var definition
in plugins.xml it was like this:
``
``
changing the order and moving the preference above might fix it for me
<preference name="GMS_VERSION" default="11.0.1"/>
<framework src="com.google.android.gms:play-services-analytics:$GMS_VERSION" />
so you mean this?
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
Got the same issue with version 1.8.6. on PhoneGap Build. Full log and plugin.xml in attach.
Same problem here.
Please, anyone have found a solution for this?
Regards,
Same issue here using Ionic. You can get it to build by modifying "../platforms/android/project.properties" and changing
to
Replacing GMS_VERSION with "+" should do the trick. Im still curious on the root cause though. This is just a work around.
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
GMS_VERSION is a OS variable, it need to be added to the env; do not add to the project.properties
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?
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.
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
Added this in an after_platform_add hook
sed -i -e 's/$GMS_VERSION/+/g' platforms/android/project.properties
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"/>
$GMS_VERSION to + in Project.properties fixed error in VS 2017.
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.