cargo-mobile2
cargo-mobile2 copied to clipboard
Android app crashes every 2nd time
Hello,
I have this issue and reported it on upstream by accident - https://github.com/BrainiumLLC/cargo-mobile/issues/111 with the following additional output on the console:
Starting: Intent { cmp=io.usagi.hello2/.MainActivity }
--------- beginning of system
--------- beginning of kernel
--------- beginning of crash
--------- beginning of main
logcat: Unexpected EOF!
This means that either the device shut down, logd crashed, or this instance of logcat was unable to read log
messages as quickly as they were being produced.
If you have enabled significant logging, look into using the -G option to increase log buffer sizes.
error: Failed to log output
Command "/home/shiro/Android/Sdk/platform-tools/adb -s 3ce6526f logcat -v color -s hello2:W" didn't complete successfully, exiting with code 1.
There's a logcat on the linked issue.
I opened the issue in upstream by accident, even though I'm using the wry
template from this repo (sorry for the confusion). My colleague also ran into the same crash on a completely different android device and PC and we're completely blocked.
Thanks for the awesome work on the project!
After forking tao
and it's dependency ndk-context
and commenting out the assert that was crashing the app, it now doesn't crash anymore, but produces the following debug message:
android_logger: android_logger: log::set_logger failed: attempted to set a logger after the logging system was already initialized
Which implies that the context is not being removed when swiping away the app, resulting in the setup being called on an already initialized app...
Might also be related with android-version specific behaviour on app swipe vs. kill and MainActivity.destroy
not being called.
Edit:
Tested it on an Android 13 phone and it doesn't happen, just crashes on Android 11 (and potentially other API versions and/or specific phone models)