如何将Crashlytics与Android Instant Apps集成? [英] How do I integrate Crashlytics with Android Instant Apps?

查看:52
本文介绍了如何将Crashlytics与Android Instant Apps集成?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Crashlytics 是否可以与 Google Play Instant ,如果是这样,您如何正确设置项目?

解决方案

是的,Crashlytics确实可以与Android Instant Apps一起使用,实际上,这是现阶段推荐的崩溃报告解决方案,因为它已经过测试并且可以正常工作. >

用于设置:

步骤1

在基本功能模块中打开build.gradle文件,并按照公共文档站点上的步骤进行操作正常配置Crashlytics.

步骤2

在基本功能模块build.gradle文件的顶层,添加以下Crashlytics标志:

...
android {
    ...
}
crashlytics { instantAppSupport true }
...

第3步(可选,但建议)

根据文档:

compile 'com.google.android.instantapps:instantapps:1.1.0'

注意:要使用此依赖关系,您需要将新的maven.google.com存储库添加到gradle文件中(如果尚未使用的话)(请参阅

截至2017年8月的更新-打破支持的新问题

使用记录了以下内容的Crashlytics和Instant Apps时,最近的工具更新似乎导致了新问题.错误:

此应用依赖于Crashlytics.请在以下位置注册访问权限 https://fabric.io/sign_up ,安装Android构建工具并询问 团队成员邀请您加入此应用的组织.

在解决此问题之前,请尝试以下解决方法:构建后,找到文件com_crashlytics_build_id.xml,将其打开,然后从其中复制包含您的Fabric密钥的<string>并将其粘贴到普通的功能模块的文件.然后重新构建并运行.

2017年11月15日更新-已修复问题

上述问题已从Fabric gradle插件v1.24.5开始修复.由于gradle文件应该具有:

classpath 'io.fabric.tools:gradle:1.+'

除了同步您的构建以拉下带有修复程序的更新插件之外,您无需执行任何操作.

Does Crashlytics work with Google Play Instant and if so, how do you setup your project correctly?

解决方案

Yes, Crashlytics does work with Android Instant Apps, in fact it is the recommended crash reporting solution at this stage as it has been tested and works fine.

For setup:

Step 1

Open the build.gradle file in your base feature module and follow the steps on the public docs site to configure Crashlytics as normal.

Step 2

At the top level of your base feature module build.gradle file, add the following Crashlytics flag:

...
android {
    ...
}
crashlytics { instantAppSupport true }
...

Step 3 (optional but recommended)

Add the Instant App library dependency in your base library project build.gradle if not already there as per the docs:

compile 'com.google.android.instantapps:instantapps:1.1.0'

Note: to use this dependency you will need to add the newer maven.google.com repository to your gradle files if you haven't already (see here for details).

Then in your code, after setting up Crashlytics, set a boolean value to log if the current run is an Instant App:

Crashlytics.setBool("InstantApp", InstantApps.isInstantApp(context));

Update as of Aug 2017 - New issue that breaks support

A recent tools update seems to have caused a new issue when using Crashlytics and Instant Apps that logs the following error:

This app relies on Crashlytics. Please sign up for access at https://fabric.io/sign_up, install an Android build tool and ask a team member to invite you to this app's organization.

Until the issue is fixed, please try this as a workaround: after building, find the file com_crashlytics_build_id.xml, open it up, copy the <string> from there that contains your Fabric key and paste it into your normal strings.xml file for your feature module. Then re-build and run.

Update as of Nov 15, 2017 - Issue fixed

The issue above is now fixed as of Fabric gradle plugin v1.24.5. As your gradle file should have:

classpath 'io.fabric.tools:gradle:1.+'

You shouldn't need to do anything but sync up your build to pull down the updated plugin with fix.

这篇关于如何将Crashlytics与Android Instant Apps集成?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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