我根据最新的 Google Play Console 要求更新了 API 级别,但该应用程序在某些 Android 设备上崩溃。
我有以下内容
android/app/build.gradle
android {
compileSdkVersion 34
...
defaultConfig {
minSdkVersion 33
targetSdkVersion 34
...
在
pubspec.yaml
min_sdk_android: 33
它适用于许多 Android 设备(例如 Oppo A13 ColorOS、三星 A71 A13、三星 Galaxy Z A14), 但在某些设备上会崩溃(例如 Pixel 8 A14)。 据我所见,它冻结在启动启动器图标上。
最新版本是 Google Play 管理中心管理中唯一活跃的版本。
为什么在某些 Android 设备上仍然崩溃?
更新:
这是堆栈跟踪:
Failed to find provider info for 24:95:2F:97:51:D9
NfcTag::connectionEventHandler: NDEF detection timed out
nativeNfcTag_doCheckNdefResult: unknown status=0xB2
Cannot get requestId: Handwriting was not initialized.
Not starting debugger since process cannot load the jdwp agent.
[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] 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.OpenSSLEvpCipher.doFinalInternal(OpenSSLEvpCipher.java:152)
at com.android.org.conscrypt.OpenSSLCipher.engineDoFinal(OpenSSLCipher.java:374)
at javax.crypto.Cipher.doFinal(Cipher.java:2074)
at b0.h.b(Unknown Source:35)
at a0.a.c(Unknown Source:11)
at a0.a.k(Unknown Source:17)
at a0.e$b.run(Unknown Source:233)
at android.os.Handler.handleCallback(Handler.java:959)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loopOnce(Looper.java:232)
at android.os.Looper.loop(Looper.java:317)
at android.os.HandlerThread.run(HandlerThread.java:85)
, null)
#0 StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:652)
#1 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:310)
<asynchronous suspension>
#2 main (package:myppcmetrics_app/main.dart:22)
<asynchronous suspension>
!!! FAILED BINDER TRANSACTION !!! (parcel size = 556)
Invalid frequency(-1), using 5G as default rssi array
View class com.android.systemui.keyguard.ui.view.UdfpsLottieViewWrapper is an AppCompat widget that can only be used with a Theme.AppCompat theme (or descendant).
View class com.android.systemui.keyguard.ui.view.UdfpsLottieViewWrapper is an AppCompat widget that can only be used with a Theme.AppCompat theme (or descendant).
我为 FlutterSecureStorage().read(key:'client_id') 调用添加了错误处理,如下所示。还有其他我目前没有看到或处理的错误吗?
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
import 'package:flutter_translate/flutter_translate.dart';
import 'package:myppcmetrics_app/config/theme.dart';
import 'package:myppcmetrics_app/screens/components/cockpit_charts.dart';
import 'package:myppcmetrics_app/screens/components/logo_header.dart';
import 'package:myppcmetrics_app/screens/components/menu.dart';
import 'package:myppcmetrics_app/service/translation.dart';
import 'package:myppcmetrics_app/state/client.dart';
import 'package:myppcmetrics_app/state/login.dart';
import 'package:myppcmetrics_app/state/route.dart' as custom_router;
import 'package:provider/provider.dart';
final FlutterSecureStorage storage = const FlutterSecureStorage();
void main() async {
WidgetsFlutterBinding.ensureInitialized();
LocalizationDelegate delegate = await LocalizationDelegate.create(
fallbackLocale: 'de',
supportedLocales: ['de', 'it', 'fr', 'en'],
preferences: TranslatePreferences());
String? clientId;
try {
clientId = await storage.read(key: 'client_id');
} catch (e) {
await clearAllStorage();
}
String? chartOrderJson =
await const FlutterSecureStorage().read(key: 'chart_order');
List<ChartTypes> chartOrder = ChartTypes.values;
if (chartOrderJson != null) {
List<dynamic> chartOrderTmp = jsonDecode(chartOrderJson);
chartOrder = [];
for (int id in chartOrderTmp) {
chartOrder.add(ChartTypes.fromId(id));
}
}
SystemChrome.setPreferredOrientations([
DeviceOrientation.portraitUp,
DeviceOrientation.portraitDown,
]);
runApp(LocalizedApp(
delegate,
MultiProvider(
providers: [
ListenableProvider<ClientState>(
create: (context) => ClientState.create(
clientId != null ? int.parse(clientId) : null),
),
ListenableProvider<LoginState>(create: (context) {
return LoginState(
delegate.currentLocale.languageCode.toUpperCase(), chartOrder);
}),
ListenableProvider<custom_router.RouteState>(
create: (context) => custom_router.RouteState.create(
custom_router.RouteState.login)),
],
child: const MyPPCApp(),
)));
}
Future<void> clearAllStorage() async {
try {
await storage.deleteAll();
print('Secure storage cleared');
} catch (e) {
print('Error clearing secure storage: $e');
}
}
实施这些更改(clearAllStorage())后,我的应用程序也在模拟器上崩溃,并出现以下错误:
App com.google.android.youtube became active but still in NEVER bucket
updateValue is called with a value {0, 0, 0, 0, 0, 0, 0, 0}, which is lower than the previous value {24, 0, 86, 0, 24, 0, 44, 0}
updateValue is called with a value {0, 0, 0, 0, 0, 0, 0, 0}, which is lower than the previous value {6, 0, 24, 0, 185, 0, 24, 0}
updateValue is called with a value {0, 0, 0, 0, 0, 0, 0, 0}, which is lower than the previous value {521, 0, 684, 0, 1102, 0, 615, 0}
Not starting debugger since process cannot load the jdwp agent.
App com.google.android.youtube became active but still in NEVER bucket
App com.google.android.youtube became active but still in NEVER bucket
No package ID 78 found for resource ID 0x780b000f.
No package ID 78 found for resource ID 0x780b000f.
PackageRecordCache: appContext was already set bbex@b1efbc5 -> bbex@4413849
Unable to match the desired swap behavior.
a: 3
File error accessing recents directory (directory doesn't exist?).
Unable to match the desired swap behavior.
device/generic/goldfish-opengl/system/GLESv2_enc/GL2Encoder.cpp:s_glGetUniformLocation:2206 GL error 0x502
我为 FlutterSecureStorage().read(key:'client_id') 调用添加了错误处理,如下所示。
以下代码用于在登录页面上加载,当用户存储了以前版本的旧应用程序数据时,无法处理 FlutterSecureStorage().read(key: 'client_id') 。
String? clientId = await const FlutterSecureStorage().read(key: 'client_id');
如果由于用户未登录而导致 clientId 不可用,我现在首先运行clearAllStorage()。
String? clientId;
try {
clientId = await storage.read(key: 'client_id');
} catch (e) {
await clearAllStorage();
}
现在似乎可以工作了。