Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gradle plugin google-services does not work with gradle-experimental:0.6.0-alpha7

I want to use gradle-experimental:0.6.0-alpha7 to use the NDK build integration in Android Studio 1.5.1. But now my google-services.json is not converted anymore to for instance a R.xml.global_tracker for analytics.

I use

classpath 'com.android.tools.build:gradle-experimental:0.6.0-alpha7'
classpath 'com.google.gms:google-services:2.0.0-alpha6' 

in my global build.gradle and

apply plugin: 'com.android.model.application'
apply plugin: 'com.google.gms.google-services'

on top of my app gradle file.

The com.google.gms:google-services plugin used to work when I used com.android.tools.build:gradle:1.5.0 but now R.xml.global_tracker cannot be found and when I manually set the tracker ID it doesn't track anything.

Is there a combination of the google services gradle plugin and gradle experimantal that works?

like image 746
Roel Avatar asked Sep 26 '22 10:09

Roel


1 Answers

No the experimantal plugin does not yet work with google-services gradle plugin. I've tested with the latest 0.7.2 and 0.8.0-alpha4 experimantal plugin but with no luck.

However, a workaround does work for me.

According to the document of Google Services Gradle Plugin, what it does is mainly reads google-services.json in and produce two XML files. The document describes the data mapping between the XML and json very well so one can totally produce those XML files manually or by simple scripts.

For my case, I just download the google-services.json file and produce the XML files by hand. Then:

  1. Merge the content of values.xml with my existing app/src/main/res/values/strings.xml
  2. Place the global_tracker.xml file under app/src/main/res/xml/ (as suggested at here)

Rebuild the apk and it works.

like image 184
zevoid Avatar answered Nov 15 '22 10:11

zevoid