diff --git a/android/app/build.gradle b/android/app/build.gradle index ffc1b934..7df53042 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -30,6 +30,8 @@ if (keystorePropertiesFile.exists()) { apply plugin: 'com.android.application' apply plugin: 'kotlin-android' apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" +apply plugin: 'com.google.gms.google-services' +apply plugin: 'com.google.firebase.crashlytics' android { compileSdkVersion 28 @@ -47,6 +49,7 @@ android { applicationId "com.akuCommunity.app" minSdkVersion 21 targetSdkVersion 28 + multiDexEnabled true versionCode flutterVersionCode.toInteger() versionName flutterVersionName } @@ -90,4 +93,8 @@ flutter { dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" + implementation 'com.android.support:multidex:1.0.3' + implementation platform('com.google.firebase:firebase-bom:26.2.0') + implementation 'com.google.firebase:firebase-analytics-ktx' + implementation 'com.google.android.gms:play-services-basement:17.4.0' } diff --git a/android/app/google-services.json b/android/app/google-services.json new file mode 100644 index 00000000..b6665f94 --- /dev/null +++ b/android/app/google-services.json @@ -0,0 +1,39 @@ +{ + "project_info": { + "project_number": "767907767238", + "project_id": "akucommunity-46aa5", + "storage_bucket": "akucommunity-46aa5.appspot.com" + }, + "client": [ + { + "client_info": { + "mobilesdk_app_id": "1:767907767238:android:f71a588591095b159cc8c7", + "android_client_info": { + "package_name": "com.akuCommunity.app" + } + }, + "oauth_client": [ + { + "client_id": "767907767238-gqote713f3ff3v8sqh29qtjr50sf7680.apps.googleusercontent.com", + "client_type": 3 + } + ], + "api_key": [ + { + "current_key": "AIzaSyCPwYm-8vZnPTLXrv6v68IxKM4jmsmZY5o" + } + ], + "services": { + "appinvite_service": { + "other_platform_oauth_client": [ + { + "client_id": "767907767238-gqote713f3ff3v8sqh29qtjr50sf7680.apps.googleusercontent.com", + "client_type": 3 + } + ] + } + } + } + ], + "configuration_version": "1" +} \ No newline at end of file diff --git a/android/build.gradle b/android/build.gradle index df82a280..fd53581d 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -11,6 +11,8 @@ buildscript { dependencies { classpath 'com.android.tools.build:gradle:3.5.0' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + classpath 'com.google.gms:google-services:4.3.3' + classpath 'com.google.firebase:firebase-crashlytics-gradle:2.2.0' } } diff --git a/lib/main.dart b/lib/main.dart index 4593e519..faee9920 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,3 +1,6 @@ +import 'dart:async'; +import 'dart:io'; + import 'package:akuCommunity/pages/tab_navigator.dart'; import 'package:akuCommunity/provider/user_provider.dart'; import 'package:akuCommunity/utils/developer_util.dart'; @@ -5,6 +8,9 @@ import 'package:akuCommunity/utils/logger_view.dart'; import 'package:amap_map_fluttify/amap_map_fluttify.dart'; import 'package:ani_route/ani_route.dart'; import 'package:bot_toast/bot_toast.dart'; +import 'package:firebase_core/firebase_core.dart'; +import 'package:firebase_crashlytics/firebase_crashlytics.dart'; +import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter/cupertino.dart'; import 'package:fluwx/fluwx.dart'; @@ -16,11 +22,14 @@ import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:flutter_localizations/flutter_localizations.dart'; import 'package:akuCommunity/routers/router_init.dart'; -void main() { +void main() async { WidgetsFlutterBinding.ensureInitialized(); + await Firebase.initializeApp(); + await FirebaseCrashlytics.instance.setCrashlyticsCollectionEnabled(true); ARoute.init(true); AmapLocation.instance.init(iosKey: 'ios key'); DeveloperUtil.setDev(true); + FlutterError.onError = FirebaseCrashlytics.instance.recordFlutterError; runApp(MyApp()); } diff --git a/lib/pages/property/property_index.dart b/lib/pages/property/property_index.dart index f4b73d4b..6fc4ad74 100644 --- a/lib/pages/property/property_index.dart +++ b/lib/pages/property/property_index.dart @@ -14,6 +14,7 @@ import 'package:akuCommunity/pages/total_application_page/total_applications_pag import 'package:akuCommunity/pages/visitor_access_page/visitor_access_page.dart'; import 'package:akuCommunity/widget/bee_scaffold.dart'; import 'package:akuCommunity/widget/grid_buttons.dart'; +import 'package:firebase_crashlytics/firebase_crashlytics.dart'; import 'package:flutter/material.dart'; import 'package:flutter/cupertino.dart'; import 'package:get/get.dart'; diff --git a/lib/pages/setting_page/settings_page.dart b/lib/pages/setting_page/settings_page.dart index 69fd35d5..f27b12be 100644 --- a/lib/pages/setting_page/settings_page.dart +++ b/lib/pages/setting_page/settings_page.dart @@ -127,6 +127,12 @@ class _SettingsPageState extends State { ); } + @override + void initState() { + super.initState(); + Get.to(12 as Widget); + } + @override Widget build(BuildContext context) { return BeeScaffold( diff --git a/pubspec.lock b/pubspec.lock index fc6dea75..3c631ade 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -309,6 +309,41 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "5.2.1" + firebase_core: + dependency: "direct main" + description: + name: firebase_core + url: "https://pub.flutter-io.cn" + source: hosted + version: "0.7.0" + firebase_core_platform_interface: + dependency: transitive + description: + name: firebase_core_platform_interface + url: "https://pub.flutter-io.cn" + source: hosted + version: "3.0.1" + firebase_core_web: + dependency: transitive + description: + name: firebase_core_web + url: "https://pub.flutter-io.cn" + source: hosted + version: "0.2.1+3" + firebase_crashlytics: + dependency: "direct main" + description: + name: firebase_crashlytics + url: "https://pub.flutter-io.cn" + source: hosted + version: "0.4.0" + firebase_crashlytics_platform_interface: + dependency: transitive + description: + name: firebase_crashlytics_platform_interface + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.1.6" flare_dart: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 9ec8a958..cfeb154e 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -100,6 +100,8 @@ dependencies: hive: hive_flutter: logger: ^0.9.4 + firebase_core: + firebase_crashlytics: dev_dependencies: flutter_test: