Cloud firestore 在 APK 发布模式下使应用程序崩溃
Cloud firestore crashes app in APK release mode
Flutter Cloud Firestore 在我的 Flutter 应用程序上创建了一个错误,当我在发布模式下的 APK 上执行它时,它只会使应用程序崩溃并关闭它。我有 AndroidX,当我从 flutter 运行 --release 尝试应用程序时一切正常,我已连接我的设备。这个问题我已经有一个星期了,我还没有找到解决的方法。
起初我认为这是 Google 地图插件的问题,但后来我意识到它也发生在应用程序的其他部分,我不使用它但我使用了 cloud_firestore 图书馆也是。所以我认为这有问题
这是我执行 flutter build apk 时的控制台
Gabriels-MacBook-Pro:Safer jumpbotron$ flutter build apk --release
You are building a fat APK that includes binaries for android-arm, android-arm64.
If you are deploying the app to the Play Store, it's recommended to use app bundles or split the APK to reduce the APK size.
To generate an app bundle, run:
flutter build appbundle --target-platform android-arm,android-arm64
Learn more on: https://developer.android.com/guide/app-bundle
To split the APKs per ABI, run:
flutter build apk --target-platform android-arm,android-arm64 --split-per-abi
Learn more on: https://developer.android.com/studio/build/configure-apk-splits#configure-abi-split
Initializing gradle... 1.3s
Resolving dependencies... 4.0s
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
Note: /Users/jumpbotron/Documents/programming/installations/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.12.9+2/android/src/main/java/io/flutter/plugins/firebase/cloudfirestore/CloudFirestorePlugin.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: /Users/jumpbotron/Documents/programming/installations/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.12.9+2/android/src/main/java/io/flutter/plugins/firebase/cloudfirestore/CloudFirestorePlugin.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: /Users/jumpbotron/Documents/programming/installations/flutter/.pub-cache/hosted/pub.dartlang.org/connectivity-0.4.3+6/android/src/main/java/io/flutter/plugins/connectivity/ConnectivityPlugin.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: /Users/jumpbotron/Documents/programming/installations/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core-0.4.0+6/android/src/main/java/io/flutter/plugins/firebase/core/FirebaseCorePlugin.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
RRemoved unused resources: Binary resource data reduced from 256KB to 233KB: Removed 8%
Running Gradle task 'assembleRelease'...
Running Gradle task 'assembleRelease'... Done 117.5s
Built build/app/outputs/apk/release/app-release.apk (7.2MB).
我认为以下几行指出了问题所在。
Resolving dependencies... 4.0s
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
弃用不是错误,是警告。在这种情况下,它警告您此功能最终将被删除。
这是已知的issue and according to this conversation it is already fixed
您可能还会发现 this answer 非常有用,因为它解释了问题的原因。
Flutter Cloud Firestore 在我的 Flutter 应用程序上创建了一个错误,当我在发布模式下的 APK 上执行它时,它只会使应用程序崩溃并关闭它。我有 AndroidX,当我从 flutter 运行 --release 尝试应用程序时一切正常,我已连接我的设备。这个问题我已经有一个星期了,我还没有找到解决的方法。
起初我认为这是 Google 地图插件的问题,但后来我意识到它也发生在应用程序的其他部分,我不使用它但我使用了 cloud_firestore 图书馆也是。所以我认为这有问题
这是我执行 flutter build apk 时的控制台
Gabriels-MacBook-Pro:Safer jumpbotron$ flutter build apk --release
You are building a fat APK that includes binaries for android-arm, android-arm64.
If you are deploying the app to the Play Store, it's recommended to use app bundles or split the APK to reduce the APK size.
To generate an app bundle, run:
flutter build appbundle --target-platform android-arm,android-arm64
Learn more on: https://developer.android.com/guide/app-bundle
To split the APKs per ABI, run:
flutter build apk --target-platform android-arm,android-arm64 --split-per-abi
Learn more on: https://developer.android.com/studio/build/configure-apk-splits#configure-abi-split
Initializing gradle... 1.3s
Resolving dependencies... 4.0s
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
Note: /Users/jumpbotron/Documents/programming/installations/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.12.9+2/android/src/main/java/io/flutter/plugins/firebase/cloudfirestore/CloudFirestorePlugin.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: /Users/jumpbotron/Documents/programming/installations/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.12.9+2/android/src/main/java/io/flutter/plugins/firebase/cloudfirestore/CloudFirestorePlugin.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: /Users/jumpbotron/Documents/programming/installations/flutter/.pub-cache/hosted/pub.dartlang.org/connectivity-0.4.3+6/android/src/main/java/io/flutter/plugins/connectivity/ConnectivityPlugin.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: /Users/jumpbotron/Documents/programming/installations/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core-0.4.0+6/android/src/main/java/io/flutter/plugins/firebase/core/FirebaseCorePlugin.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
RRemoved unused resources: Binary resource data reduced from 256KB to 233KB: Removed 8%
Running Gradle task 'assembleRelease'...
Running Gradle task 'assembleRelease'... Done 117.5s
Built build/app/outputs/apk/release/app-release.apk (7.2MB).
我认为以下几行指出了问题所在。
Resolving dependencies... 4.0s
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
弃用不是错误,是警告。在这种情况下,它警告您此功能最终将被删除。
这是已知的issue and according to this conversation it is already fixed
您可能还会发现 this answer 非常有用,因为它解释了问题的原因。