You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: packages/firebase_crashlytics/README.md
+45-26Lines changed: 45 additions & 26 deletions
Original file line number
Diff line number
Diff line change
@@ -12,43 +12,59 @@ For Flutter plugins for other Firebase products, see [README.md](https://github.
12
12
13
13
To use the `firebase_crashlytics` plugin, follow the [plugin installation instructions](https://pub.dartlang.org/packages/firebase_crashlytics#pub-pkg-tab-installing).
14
14
15
+
The following instructions are from [the official installation page](https://firebase.google.com/docs/crashlytics/get-started-new-sdk).
16
+
15
17
### Android integration
16
18
17
19
Enable the Google services by configuring the Gradle scripts as such:
18
20
19
-
1. Add the Fabric repository to the `[project]/android/build.gradle` file.
20
-
```
21
-
repositories {
22
-
google()
23
-
jcenter()
24
-
// Additional repository for fabric resources
25
-
maven {
26
-
url 'https://maven.fabric.io/public'
21
+
1. Check that you have Google's Maven repository in your **project-level**`build.gradle` file (`[project]/android/build.gradle`).
22
+
23
+
```gradle
24
+
buildscript {
25
+
repositories {
26
+
// Add this
27
+
google()
28
+
29
+
// ... you may have other repositories
30
+
}
31
+
}
32
+
allprojects {
33
+
repositories {
34
+
// and this
35
+
google()
36
+
37
+
// ...
27
38
}
28
39
}
29
40
```
30
41
31
-
2. Add the following classpaths to the `[project]/android/build.gradle` file.
42
+
2. Add the following classpaths to your **project-level**`build.gradle` file (`[project]/android/build.gradle`).
43
+
32
44
```gradle
33
-
dependencies {
34
-
// Example existing classpath
35
-
classpath 'com.android.tools.build:gradle:3.2.1'
36
-
// Add the google services classpath
37
-
classpath 'com.google.gms:google-services:4.3.0'
38
-
// Add fabric classpath
39
-
classpath 'io.fabric.tools:gradle:1.26.1'
45
+
buildscript {
46
+
dependencies {
47
+
// Check that you have the Google Services Gradle plugin v4.3.2 or later (if not, add it).
// Set `enableInDevMode` to true to see reports while in debug mode
@@ -91,20 +109,21 @@ void main() {
91
109
}
92
110
```
93
111
94
-
Overriding `FlutterError.onError` with `Crashlytics.instance.recordFlutterError` will automatically catch all
95
-
errors that are thrown from within the Flutter framework.
96
-
If you want to catch errors that occur in `runZoned`,
97
-
you can supply `Crashlytics.instance.recordError` to the `onError` parameter:
112
+
Overriding `FlutterError.onError` with `Crashlytics.instance.recordFlutterError` will automatically catch all errors that are thrown from within the Flutter framework.
113
+
114
+
If you want to catch errors that occur in `runZoned`, you can supply `Crashlytics.instance.recordError` to the `onError` parameter:
115
+
98
116
```dart
99
117
runZoned<Future<void>>(() async {
100
118
// ...
101
119
}, onError: Crashlytics.instance.recordError);
102
-
```
120
+
```
103
121
104
122
## Result
105
123
106
124
If an error is caught, you should see the following messages in your logs:
107
-
```
125
+
126
+
```shell
108
127
flutter: Flutter error caught by Crashlytics plugin:
109
128
// OR if you use recordError for runZoned:
110
129
flutter: Error caught by Crashlytics plugin <recordError>:
0 commit comments