在Flatter中使用Firebase成功创建新用户后Android应用程序崩溃
每当我尝试使用firebase_auth软件包发送电子邮件并使用密码创建新用户时,我的应用程序就会崩溃。它成功创建了帐户,但随后应用程序崩溃。我在build.gradle文件中将'com.google.gms:googleservices:4.2.0'更改为3.2.1,但这并没有帮助。问题仍然存在,我不知道该怎么改变 错误: 我的代码: 我的颤振医生输出在Flatter中使用Firebase成功创建新用户后Android应用程序崩溃,android,firebase,flutter,firebase-authentication,Android,Firebase,Flutter,Firebase Authentication,每当我尝试使用firebase_auth软件包发送电子邮件并使用密码创建新用户时,我的应用程序就会崩溃。它成功创建了帐户,但随后应用程序崩溃。我在build.gradle文件中将'com.google.gms:googleservices:4.2.0'更改为3.2.1,但这并没有帮助。问题仍然存在,我不知道该怎么改变 错误: 我的代码: 我的颤振医生输出 [√] Flutter (Channel stable, v1.9.1+hotfix.6, on Microsoft Windows [V
[√] Flutter (Channel stable, v1.9.1+hotfix.6, on Microsoft Windows [Version 6.3.9600], locale en-US)
[√] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
[√] Android Studio (version 3.5)
[!] VS Code (version 1.39.2)
X Flutter extension not installed; install from
https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
[!] Connected device
! No devices available
! Doctor found issues in 2 categories.
我的build.gradle文件:
我的应用程序级别build.gradle文件:
我解决了这个问题。我更改了gradle.properties文件,如下所示:
android.useAndroidX=true
android.enableJetifier=true
org.gradle.jvmargs=-Xmx1536M
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}
def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
}
def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android {
compileSdkVersion 28
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
lintOptions {
disable 'InvalidPackage'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.cagriserpin.focus_on"
minSdkVersion 21
targetSdkVersion 28
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug
}
}
}
flutter {
source '../..'
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'androidx.multidex:multidex:2.0.0'
implementation 'com.google.firebase:firebase-analytics:17.2.0'
}
apply plugin: 'com.google.gms.google-services'
还有我的应用程序级渐变文件,如下所示:
android.useAndroidX=true
android.enableJetifier=true
org.gradle.jvmargs=-Xmx1536M
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}
def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
}
def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android {
compileSdkVersion 28
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
lintOptions {
disable 'InvalidPackage'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.cagriserpin.focus_on"
minSdkVersion 21
targetSdkVersion 28
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug
}
}
}
flutter {
source '../..'
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'androidx.multidex:multidex:2.0.0'
implementation 'com.google.firebase:firebase-analytics:17.2.0'
}
apply plugin: 'com.google.gms.google-services'
我希望这能帮助遇到此问题的其他人检查pubspec.yaml中的firebase依赖项是否是最新的。您的android项目似乎仍在使用支持库。您必须迁移到androidx,请参见:当我单击“迁移到android x”时,它会要求我备份代码,在我单击“迁移”后,它会说在项目中找不到任何用法请勿将文本作为图像发布