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

雨燕双飞 提交于 2019-12-23 11:33:13

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/35341260/gradle-plugin-google-services-does-not-work-with-gradle-experimental0-6-0-alpha

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!