【发布时间】:2020-10-03 00:23:54
【问题描述】:
我的应用使用 Firebase 和 Flutter(auth、cloud_firestore、google_sign_in...)。
当我使用以下命令将其上传到带有 App Bundle 的 Play 商店时:
flutter build appbundle --target-platform android-arm,android-arm64,android-x64
我的应用无法与 Firebase 一起正常工作,没有日志和崩溃报告。
但是当我使用 APK 时它可以工作。
所以我使用这个命令发布了几个 APK 文件:flutter build apk --target-platform android-arm,android-arm64,android-x64 --split-per-abi,我的问题是可以将这 3 个文件上传到 Play Store 上的同一个应用程序吗?
它也给了我一个警告:
Unoptimized APK
Warning:
This APK results in unused code and resources being sent to users. Your app could be smaller if you used the Android App Bundle. By not optimizing your app for device configurations, your app is larger to download and install on users' devices than it needs to be. Larger apps see lower install success rates and take up storage on users' devices.
Resolution:
Use the Android App Bundle to automatically optimize for device configurations, or manage it yourself with multiple APKs.
我该怎么办? (我更喜欢使用 APK,因为我的应用可以使用 APK)
包:
google_sign_in: 4.5.1
firebase_auth: 0.16.1
firebase_core: ^0.4.0+8
firebase_analytics: ^5.0.14
cloud_firestore: ^0.13.6
app/build.gradle (android->defaultConfig) 我评论了 NDK 部分,因为 APK 不允许使用它。
defaultConfig {
applicationId "XXXXXX"
minSdkVersion 21
targetSdkVersion 28
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
multiDexEnabled true
// ndk {
// abiFilters 'x86', 'x86_64', 'armeabi', 'armeabi-v7a', 'mips', 'mips64', 'arm64-v8a'
// }
}
...
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.release
multiDexEnabled true
}
}
【问题讨论】:
-
好的,部分内容已被理解。您是否知道如何使用 app bundle
flutter run检查我的应用是否与 app bundle 一起正常工作? -
您可以使用 bundletool 生成多个 apk。
标签: android firebase flutter google-play apk