在某些设备上从 Play 商店下载后,我的应用程序卡在白屏
Posted
技术标签:
【中文标题】在某些设备上从 Play 商店下载后,我的应用程序卡在白屏【英文标题】:Flutter my app stuck at white screen after downloading from play store in some devices 【发布时间】:2021-10-18 11:38:57 【问题描述】:我发布了一个安卓应用。我想进行一些更新,更新后,它开始冻结,从白屏开始。当我调试时,它在从商店下载后冻结的同一设备中完美运行。在模拟器中,我从商店下载了应用程序,它可以工作。可能是什么问题造成的?
我使用命令flutter build appbundle --obfuscate --split-debug-info=somepath
build.gradle:
buildscript
repositories
google()
jcenter()
dependencies
classpath 'com.android.tools.build:gradle:3.5.0'
classpath 'com.google.gms:google-services:4.3.5'
allprojects
repositories
google()
jcenter()
rootProject.buildDir = '../build'
subprojects
project.buildDir = "$rootProject.buildDir/$project.name"
subprojects
project.evaluationDependsOn(':app')
task clean(type: Delete)
delete rootProject.buildDir
pubspec.yaml:
environment:
sdk: ">=2.10.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
http: ^0.13.1
url_launcher: ^6.0.2
flutter_secure_storage: ^3.3.5
shared_preferences: ^2.0.5
provider: ^5.0.0
toast: ^0.1.5
onesignal_flutter: ^2.6.2
fl_chart: ^0.20.1
intl: ^0.17.0
device_info: ^2.0.0
synchronized: ^3.0.0
firebase_core: ^1.0.3
firebase_performance: ^0.6.0+2
flutter_localizations:
sdk: flutter
workmanager: ^0.4.0
get_it: ^7.1.3
image_picker: ^0.8.0+3
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for ios style icons.
cupertino_icons: ^1.0.2
google_fonts: ^2.0.0
dev_dependencies:
flutter_test:
sdk: flutter
# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec
# The following section is specific to Flutter.
flutter:
generate: true
# The following line ensures that the Material Icons font is
# included with your application, so that you can use the icons in
# the material Icons class.
uses-material-design: true
# To add assets to your application, add an assets section, like this:
assets:
- assets/
# - images/a_dot_ham.jpeg
fonts:
- family: Roboto
fonts:
- asset: fonts/Roboto-Medium.ttf
- asset: fonts/Roboto-Regular.ttf
# An image asset can refer to one or more resolution-specific "variants", see
# https://flutter.dev/assets-and-images/#resolution-aware.
# For details regarding adding assets from package dependencies, see
# https://flutter.dev/assets-and-images/#from-packages
# To add custom fonts to your application, add a fonts section here,
# in this "flutter" section. Each entry in this list should have a
# "family" key with the font family name, and a "fonts" key with a
# list giving the asset and other descriptors for the font. For
# example:
# fonts:
# - family: Schyler
# fonts:
# - asset: fonts/Schyler-Regular.ttf
# - asset: fonts/Schyler-Italic.ttf
# style: italic
# - family: Trajan Pro
# fonts:
# - asset: fonts/TrajanPro.ttf
# - asset: fonts/TrajanPro_Bold.ttf
# weight: 700
#
# For details regarding fonts from package dependencies,
# see https://flutter.dev/custom-fonts/#from-packages
我尝试将我的 gradle 版本设为 3.5.1 我也尝试删除我添加的包,但从商店下载时它仍然冻结。
编辑:当应用程序启动时,我在 logcat 中看到该错误:
[ERROR:flutter/lib/ui/ui_dart_state.cc(186)] Unhandled Exception: PlatformException(Exception encountered, read, javax.crypto.BadPaddingException: error:1e000065:Cipher functions:OPENSSL_internal:BAD_DECRYPT
at com.android.org.conscrypt.NativeCrypto.EVP_CipherFinal_ex(Native Method)
at com.android.org.conscrypt.OpenSSLCipher$EVP_CIPHER.doFinalInternal(OpenSSLCipher.java:602)
at com.android.org.conscrypt.OpenSSLCipher.engineDoFinal(OpenSSLCipher.java:365)
at javax.crypto.Cipher.doFinal(Cipher.java:2055)
at c.b.a.b.b.b(Unknown Source:32)
at c.b.a.a.b(Unknown Source:11)
at c.b.a.a.d(Unknown Source:7)
at c.b.a.a.a(Unknown Source:0)
at c.b.a.a$b.run(Unknown Source:134)
at android.os.Handler.handleCallback(Handler.java:883)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loop(Looper.java:237)
at android.os.HandlerThread.run(HandlerThread.java:67)
, null)
编辑 2:当我查找时,这可能是由于 flutter_secure_storage
包引起的。我的主要工作是.read
,正如我所见,很多人都面临这个问题。我现在要做的是,只要找到工作版本,我会尝试更改flutter_secure_storage
版本。
【问题讨论】:
你确定你没有将flutter_secure_storage的任何密钥初始化为空字符串吗? @GuilhermeV。我很确定,但我会仔细检查。此外,如果是这种情况,相同的代码、相同的构建会在某些设备上产生错误,而与其他一些设备完美配合。不是每个设备都会出现这种情况吗? 【参考方案1】:您需要在您的AndroidManifest.xml
中允许 HTTP 流量\网络访问权限。
Check this answer.
【讨论】:
我拥有这些权限,但 android:usesCleartextTraffic="true" 仅在我的调试清单中。我也会将它添加到 main 内的清单中,但如果这是问题所在,不是所有设备的应用程序都冻结了吗? 将其添加到 main,并在发布模式下运行您的应用程序,并进行验证。flutter run --release
它与flutter run --release一起工作,现在我将它放入alpha测试并尝试......
好像不行,我从商店下载的时候还是卡住了。设备的andorid版本是10,api level 29,据说是这个原因?
将其连接到adb logcat
并查看日志中打印的内容。【参考方案2】:
此错误的最常见原因是设备的 android API 版本。
解决此问题的步骤:
将targetSdkVersion
和compileSdkVersion
都升级到最新版本(发布的答案是30 是最后一个版本)。
使用终端显示错误的设备以发布模式运行应用
flutter 运行 --release
.
可以使用firebase Crashlytics!跟踪此类问题/错误。【讨论】:
我的编译版本和targetsdk版本都是30,我的minsdk是22,正在尝试发布。 好的,请提供在真机上运行后出现错误的release运行日志。以上是关于在某些设备上从 Play 商店下载后,我的应用程序卡在白屏的主要内容,如果未能解决你的问题,请参考以下文章
为啥我的应用在某些设备上安装时在 Google Play 商店中抛出错误 - 504?