本文主要是介绍Crashlytics升级v2.0.0+,打包报错,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
一、升级
1.In your app’s root-level (project-level) build.gradle:
- Replace Fabric’s Maven repository with Google’s Maven repository.
- Replace the Fabric Gradle plugin with the Firebase Crashlytics Gradle plugin. If you’re using Android Studio 4.1 Canary, be sure to add the Crashlytics Gradle plugin version 2.0.0 or later.
buildscript {// ...repositories {// ...// Remove Fabric's Maven repository.// maven { url 'https://maven.fabric.io/public' }// Add Google's Maven repository (if it's not there already).google()}dependencies {// ..// Add the Google Services Gradle plugin (if it's not there already).classpath 'com.google.gms:google-services:4.3.4'// Remove the Fabric Gradle plugin.// classpath 'io.fabric.tools:gradle:1.31.2'// Add the Crashlytics Gradle plugin (use v2.0.0+ if you built// your app with Android Studio 4.1).classpath 'com.google.firebase:firebase-crashlytics-gradle:2.4.1'}
}
2.In your app-level build.gradle, replace the Fabric plugin with the Firebase Crashlytics plugin:
apply plugin: 'com.android.application'// Apply the Google Services plugin (if it's not there already).
apply plugin: 'com.google.gms.google-services'// Remove the Fabric plugin.
// apply plugin: 'io.fabric'// Add the Firebase Crashlytics plugin.
apply plugin: 'com.google.firebase.crashlytics'
3.Finally, add the Firebase Crashlytics SDK. In your app-level build.gradle, replace the legacy Fabric Crashlytics SDK with the new Firebase Crashlytics SDK. Make sure you add version 17.0.0 or later (beginning November 15, 2020, this is required for your crash reports to appear in the Firebase console).
Recommended: For an optimal experience with Firebase Crashlytics, we recommend also adding the Firebase SDK for Google Analytics to your app (make sure to add Version 17.2.3 or later in order to get real time crash-free users and breadcrumbs).
dependencies {// Remove the Fabric Crashlytics SDK.// implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1' // Add the Firebase Crashlytics SDK.implementation 'com.google.firebase:firebase-crashlytics:17.3.0'// Recommended: Add the Google Analytics SDK.implementation 'com.google.firebase:firebase-analytics:18.0.0'
}
官网:https://firebase.google.cn/docs/crashlytics/upgrade-sdk?platform=android
二、打包报错
Execution failed for task ‘:app:uploadCrashlyticsMappingFileRelease’.
org.apache.http.conn.HttpHostConnectException: Connect to firebasecrashlyticssymbols.googleapis.com:443 [firebasecrashlyticssymbols.googleapis.com/216.58.200.42] failed: Connection timed out: connect
科学上网后,在gradle.properties中添加:
systemProp.https.proxyHost=127.0.0.1
systemProp.https.proxyPort=xxxx // 端口
这篇关于Crashlytics升级v2.0.0+,打包报错的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!