bevyengine / bevy

A refreshingly simple data-driven game engine built in Rust
https://bevyengine.org
Apache License 2.0
35.04k stars 3.44k forks source link

bevy mobile example crashes on Android #13331

Closed FabianZeuner closed 3 months ago

FabianZeuner commented 3 months ago

Developing on:

Building for device:

I'm trying run the bevy mobile example on my android phone.

What I do:

The first lines of output are:

--------- beginning of crash
05-11 22:18:50.644 15057 15057 F libc    : Fatal signal 6 (SIGABRT), code -1 (SI_QUEUE) in tid 15057 (yengine.example), pid 15057 (yengine.example)
05-11 22:18:50.662 15057 15165 I RustStdoutStderr: thread '<unnamed>' panicked at library/core/src/panicking.rs:156:5:
05-11 22:18:50.663 15057 15165 I RustStdoutStderr: unsafe precondition(s) violated: slice::from_raw_parts requires the pointer to be aligned and non-null, and the total size of the slice not to exceed `isize::MAX`
05-11 22:18:50.663 15057 15165 I RustStdoutStderr: note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
05-11 22:18:50.663 15057 15165 I RustStdoutStderr: thread caused non-unwinding panic. aborting.

I also tried building bevy with xbuild and with other target sdk (32, 33), but with the same result.

mockersf commented 3 months ago

This is due to https://github.com/rust-mobile/android-activity/issues/153

It should be fixed by updating winit.

As a workaround, you can use either rust 1.77 or nightly-2024-02-08

blaind commented 3 months ago

Another workaround: patching android-activity in Cargo.toml and modifying it with the following commit: https://github.com/rust-mobile/android-activity/pull/157/files