我在发布模式下运行应用程序时遇到问题,因为它在调试模式下运行良好。
我得到的错误如下
MissingPluginException(在频道 plugins.flutter.io/firebase_core 上找不到方法 Firebase#initializeCore 的实现
我用过 await Firebase.initializeApp();这在调试中工作正常..
在 build.gradle 中添加了两种模式的配置
signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
storePassword keystoreProperties['storePassword']
}
debug {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
storePassword keystoreProperties['storePassword']
}
}
buildTypes {
release {
signingConfig signingConfigs.release
}
debug {
// 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
}
}