Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash on start on Android #622

Closed
And96 opened this issue Sep 14, 2023 · 2 comments
Closed

Crash on start on Android #622

And96 opened this issue Sep 14, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@And96
Copy link

And96 commented Sep 14, 2023

App works correctly on windows but crash on Android both debug and release builds
At this line on start
await EasyLocalization.ensureInitialized();

Error
Launching lib\main.dart on 23049PCD8G in debug mode... √ Built build\app\outputs\flutter-apk\app-debug.apk. Connecting to VM Service at ws://127.0.0.1:54251/p6jyNoKkiZQ=/ws E/flutter (20818): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: 'dart:ui/platform_dispatcher.dart': Failed assertion: line 2106 pos 15: '<optimized out>': is not true. E/flutter (20818): #0 _AssertionError._doThrowNew (dart:core-patch/errors_patch.dart:51:61) E/flutter (20818): #1 _AssertionError._throwNew (dart:core-patch/errors_patch.dart:40:5) E/flutter (20818): #2 new Locale (dart:ui/platform_dispatcher.dart:2106:15) E/flutter (20818): #3 StringToLocaleHelper.toLocale E/flutter (20818): #4 EasyLocalizationController.initEasyLocation E/flutter (20818): <asynchronous suspension> E/flutter (20818): #5 EasyLocalization.ensureInitialized E/flutter (20818): <asynchronous suspension> E/flutter (20818): #6 main E/flutter (20818): <asynchronous suspension> E/flutter (20818): W/FinalizerDaemon(20818): type=1400 audit(0.0:25360): avc: denied { getopt } for path="/dev/socket/usap_pool_primary" scontext=u:r:untrusted_app:s0:c103,c257,c512,c768 tcontext=u:r:zygote:s0 tclass=unix_stream_socket permissive=0 app=com.and96.aggregator_news

In runApp
EasyLocalization( supportedLocales: const [Locale('en'), Locale('it')], useFallbackTranslations: true, useOnlyLangCode: true, path: 'assets/translations', fallbackLocale: const Locale('en'),

Translation file
{ "language": "Italiano", "app_description": "Aggregator è una applicazione per leggere le notizie dei tuoi siti preferiti", "Next":"Avanti", "Help":"Aiuto", "Settings":"Impostazioni", "All":"Tutti" }

pubspec.yaml
easy_localization: ^3.0.3 assets: - assets/ - assets/images/ - assets/translations/

Translation files
assets\translations\en.json
assets\translations\it.json

@And96
Copy link
Author

And96 commented Sep 14, 2023

it seems that if locale variable in sharedpref is missing the app crash, if an user delete app data, he wont be able to run the app anymore.

i forced something like this to solve

` SharedPreferences prefs = await SharedPreferences.getInstance();

await prefs.setString("locale", "en");

await EasyLocalization.ensureInitialized();
`

@aissat aissat added the bug Something isn't working label Sep 22, 2023
@And96 And96 closed this as completed Dec 23, 2023
@And96
Copy link
Author

And96 commented Dec 23, 2023

Cannot replicate anymore, maybe something corrupted. Updating to latest SDK and pub dev works fine

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants