Add Google Services to Cordova Android app using Gradle -
i'm trying integrate google analytics cordova android app. have used guide https://developers.google.com/analytics/devguides/collection/android/v4/, when want add
apply plugin:'com.google.gms.google-services'
into build.gradle throws error:
a problem occurred evaluating root project 'android'. failed apply plugin [id 'com.google.gms.google-services'] plugin id 'com.google.gms.google-services' not found.
i found solution:
1) had setup plugin.xml use custom ga.gradle file build
<platform name="android"> <framework src="src/android/ga.gradle" custom="true" type="gradlereference" /> <framework src="com.google.android.gms:play-services-analytics:8.1.0"/> <resource-file src="src/android/google-services.json" target="google-services.json" /> ... </platform>
2) create ga.gradle file
buildscript { repositories { jcenter() } dependencies { classpath 'com.google.gms:google-services:1.4.0-beta6' } } // apply plugin: 'com.google.gms.google-services' // class must used instead of id(string) able apply plugin non-root gradle file apply plugin: com.google.gms.googleservices.googleservicesplugin
Comments
Post a Comment