所以首先,我花了很多时间将Flutter 连接到 firebase 基地,我没有得到之前的错误,但我也不知道它是否连接.首先,错误出现在build.gradle文件中.我想这个问题已经解决了.现在它显示"跳过XX帧:应用程序可能在其主线程上做了太多工作."
我提供了所有必要的代码.我希望它能修好,我已经用了这么多天了.
Main.dart个
import 'package:firebase_core/firebase_core.dart';
import 'package:ableeasefinale/pages/UI/parentPage.dart';
import 'package:flutter/material.dart';
import 'theme/theme.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp();
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
home: const ParentPage(),
theme: lightMode,
darkTheme: darkMode,
themeMode: ThemeMode.dark,
);
}
}
android/build.gradle个
buildscript {
ext.kotlin_version = '1.9.20'
repositories {
google()
mavenCentral()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.4.1'
}
}
android/app/build.gradle个
plugins{
id "com.android.application"
id "kotlin-android"
id "dev.flutter.flutter-gradle-plugin"
id 'com.google.gms.google-services'
}
dependencies {
implementation platform('com.google.firebase:firebase-bom:32.7.2')
}
在最后一次运行中,DEBUG还显示以下消息:"已跳过XX帧:应用程序可能在其主线程上做了太多工作."
如果有人知道一个更好的教程来连接它,请提供,这将是有帮助的