Gradle插件google-services不适用于gradle-experimental:0.6.0-alpha7 [英] Gradle plugin google-services does not work with gradle-experimental:0.6.0-alpha7

查看:99
本文介绍了Gradle插件google-services不适用于gradle-experimental:0.6.0-alpha7的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用gradle-experimental:0.6.0-alpha7在Android Studio 1.5.1中使用NDK构建集成. 但是现在我的google-services.json不再转换为R.xml.global_tracker进行分析了.

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.

我使用

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

在我的全局build.gradle和

in my global build.gradle and

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

位于我的应用gradle文件顶部.

on top of my app gradle file.

当我使用com.android.tools.build:gradle:1.5.0但现在找不到R.xml.global_tracker以及手动设置跟踪器时,com.google.gms:google-services插件可以正常工作ID,它什么也没追踪.

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.

Google服务gradle插件和gradle experimantal是否可以同时使用?

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

推荐答案

尚无实验性插件尚未与google-services gradle插件一起使用.我已经使用最新的0.7.2和0.8.0-alpha4 experimantal插件进行了测试,但是没有运气.

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.

根据 Google Services Gradle插件的文档,这样做主要是读取 google-services.json 并生成两个XML文件.该文档很好地描述了XML和json之间的数据映射,因此完全可以手动或通过简单的脚本来生成这些XML文件.

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.

对于我来说,我只是下载 google-services.json 文件并手动生成XML文件.然后:

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

  1. values.xml 的内容与我现有的 app/src/main/res/values/strings.xml
  2. 合并
  3. global_tracker.xml 文件放在 app/src/main/res/xml/下(如在
  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)

重建apk,并且可以正常工作.

Rebuild the apk and it works.

这篇关于Gradle插件google-services不适用于gradle-experimental:0.6.0-alpha7的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆