Created
December 16, 2022 09:58
-
-
Save arif-pandu/8528b91a0987df6a49d59028ca8bb46a to your computer and use it in GitHub Desktop.
How To Add Firebase Analytics and Crashlytics in Flutter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apply plugin: 'com.google.gms.google-services' | |
apply plugin: 'com.google.firebase.crashlytics' | |
android { | |
compileSdkVersion 31 | |
... | |
defaultConfig { | |
applicationId "com.dicoding.ditonton" | |
minSdkVersion 19 | |
targetSdkVersion 30 | |
versionCode flutterVersionCode.toInteger() | |
versionName flutterVersionName | |
multiDexEnabled true | |
} | |
buildTypes { | |
release { | |
signingConfig signingConfigs.debug | |
} | |
} | |
} | |
... | |
dependencies { | |
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" | |
implementation platform('com.google.firebase:firebase-bom:31.1.1') | |
implementation 'com.google.firebase:firebase-analytics' | |
implementation 'com.google.firebase:firebase-crashlytics' | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
buildscript { | |
... | |
repositories { | |
google() | |
jcenter() | |
mavenCentral() | |
} | |
dependencies { | |
... | |
classpath 'com.google.gms:google-services:4.3.13' | |
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.2' | |
} | |
} | |
allprojects { | |
repositories { | |
google() | |
jcenter() | |
mavenCentral() | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Future<void> main() async { | |
WidgetsFlutterBinding.ensureInitialized(); | |
await Firebase.initializeApp(); | |
FlutterError.onError = FirebaseCrashlytics.instance.recordFlutterFatalError; | |
runApp(MyApp()); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
firebase_core: latest_version | |
firebase_analytics: latest_version | |
firebase_crashlytics: latest_version | |
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment