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

[Merged by Bors] - android - fix issues other than the rendering #5130

Closed

Conversation

mockersf
Copy link
Member

@mockersf mockersf commented Jun 29, 2022

Objective

  • Make Bevy work on android

Solution

  • Update android metadata and add a few more
  • Set the target sdk to 31 as it will soon (in august) be the minimum sdk level for play store
  • Remove the custom code to create an activity and use ndk-glue macro instead
  • Delay window creation event on android
  • Set the example with compatibility settings for wgpu. Those are needed for Bevy to work on my 2019 android tablet
  • Add a few details on how to debug in case of failures
  • Fix running the example on emulator. This was failing because of the name of the example

Bevy still doesn't work on android with this, audio features need to be disabled because of an ndk-glue version mismatch: rodio depends on 0.6.2, winit on 0.5.2. You can test with:

cargo apk run --release --example android_example --no-default-features --features "bevy_winit,render"

@mockersf mockersf added the O-Android Specific to the Android mobile operating system label Jun 29, 2022
@alice-i-cecile alice-i-cecile added the C-Bug An unexpected or incorrect behavior label Jun 29, 2022
@alice-i-cecile alice-i-cecile added this to the Bevy 0.8 milestone Jun 29, 2022
@alice-i-cecile alice-i-cecile added the P-High This is particularly urgent, and deserves immediate attention label Jun 29, 2022
Co-Authored-By: Alice Cecile <alice.i.cecile@gmail.com>
mockersf and others added 2 commits June 29, 2022 03:13
Co-Authored-By: SarthakSingh31 <35749450+SarthakSingh31@users.noreply.github.com>
@mockersf mockersf force-pushed the another-attempt-at-fixing-android branch from d4601b4 to 9fcab5e Compare June 29, 2022 02:10
@mockersf
Copy link
Member Author

mockersf commented Jun 29, 2022

Recorded on device:

device-2022-06-29-134401.mp4

Also works on emulator but it's much slower there

@mockersf
Copy link
Member Author

bors try

bors bot added a commit that referenced this pull request Jun 29, 2022
examples/android/android.rs Outdated Show resolved Hide resolved
@cart
Copy link
Member

cart commented Jun 29, 2022

Tried running this and I'm getting a link error on my new Pixel 6:

06-29 14:51:29.898 13254 13254 E AndroidRuntime: java.lang.UnsatisfiedLinkError: Unable to load native library "/data/app/~~m4g7axUMj33njZDZE6J9Sw==/org.bevyengine.example-czbVgT7PSmsP6pipS0Aong==/lib/arm64/libandroid_example.so": dlopen failed: cannot locate symbol "__cxa_pure_virtual" referenced by "/data/app/~~m4g7axUMj33njZDZE6J9Sw==/org.bevyengine.example-czbVgT7PSmsP6pipS0Aong==/lib/arm64/libandroid_example.so"...

@cart
Copy link
Member

cart commented Jun 29, 2022

Seems like I'm hitting this: katyo/oboe-rs#28 (comment)
Mentioned in #4103

@cart
Copy link
Member

cart commented Jun 29, 2022

Ahh I didn't fully read the pr description. Ill try without audio features. Oops :)

@cart
Copy link
Member

cart commented Jun 29, 2022

Disabling audio did fix the problem. But its pretty inconsistent about whether or not it will work. Sometimes it starts up just fine. Other times I get a black screen.

@mockersf
Copy link
Member Author

But its pretty inconsistent about whether or not it will work. Sometimes it starts up just fine. Other times I get a black screen.

Well... still an improvement 😄

Do you have anything in logs when it's a black screen?

@komadori
Copy link
Contributor

I've tried running the example on my Samsung S21+ and it occasionally works when I start the app, but I more often than not I get a black screen. The following message appears the adb logcat output and I assume is the crux of the problem:

RustStdoutStderr: thread '<unnamed>' panicked at 'Cannot get the native window, it's null and will always be null before Event::Resumed and after Event::Suspended. Make sure you only call this function between those events.', /home/komadori/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.26.1/src/platform_impl/android/mod.rs:598:13

@mockersf mockersf changed the title fix startup on android android - fix issues other than the rendering Jun 30, 2022
@mockersf
Copy link
Member Author

Thanks for testing and reporting the issue!

So it seems this PR doesn't fix that issue, it just happens less often. I would like to keep this PR free of rendering fix so that it doesn't become controversial...

@cart would you agree on moving on with this PR as a first step to fix metadata, naming, and so on? I'll open more controversial PRs for the rest 😄

@alice-i-cecile
Copy link
Member

I'm in favor of merging this ASAP; it clearly improves matters, and Android is already broken so the user impact is 0.

Copy link
Contributor

@komadori komadori left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the context of @alice-i-cecile's comment, I think this PR is good.

@alice-i-cecile alice-i-cecile added the S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it label Jun 30, 2022
@cart
Copy link
Member

cart commented Jun 30, 2022

Yeah happy to iterate on this and these changes are good!

@cart
Copy link
Member

cart commented Jun 30, 2022

bors r+

bors bot pushed a commit that referenced this pull request Jun 30, 2022
# Objective

- Make Bevy work on android

## Solution

- Update android metadata and add a few more
- Set the target sdk to 31 as it will soon (in august) be the minimum sdk level for play store
- Remove the custom code to create an activity and use ndk-glue macro instead
- Delay window creation event on android
- Set the example with compatibility settings for wgpu. Those are needed for Bevy to work on my 2019 android tablet
- Add a few details on how to debug in case of failures
- Fix running the example on emulator. This was failing because of the name of the example

Bevy still doesn't work on android with this, audio features need to be disabled because of an ndk-glue version mismatch: rodio depends on 0.6.2, winit on 0.5.2. You can test with:
```
cargo apk run --release --example android_example --no-default-features --features "bevy_winit,render"
```
@bors
Copy link
Contributor

bors bot commented Jun 30, 2022

Build failed:

@cart
Copy link
Member

cart commented Jun 30, 2022

bors r+

bors bot pushed a commit that referenced this pull request Jun 30, 2022
# Objective

- Make Bevy work on android

## Solution

- Update android metadata and add a few more
- Set the target sdk to 31 as it will soon (in august) be the minimum sdk level for play store
- Remove the custom code to create an activity and use ndk-glue macro instead
- Delay window creation event on android
- Set the example with compatibility settings for wgpu. Those are needed for Bevy to work on my 2019 android tablet
- Add a few details on how to debug in case of failures
- Fix running the example on emulator. This was failing because of the name of the example

Bevy still doesn't work on android with this, audio features need to be disabled because of an ndk-glue version mismatch: rodio depends on 0.6.2, winit on 0.5.2. You can test with:
```
cargo apk run --release --example android_example --no-default-features --features "bevy_winit,render"
```
@bors bors bot changed the title android - fix issues other than the rendering [Merged by Bors] - android - fix issues other than the rendering Jun 30, 2022
@bors bors bot closed this Jun 30, 2022
@cart cart mentioned this pull request Jul 8, 2022
inodentry pushed a commit to IyesGames/bevy that referenced this pull request Aug 8, 2022
# Objective

- Make Bevy work on android

## Solution

- Update android metadata and add a few more
- Set the target sdk to 31 as it will soon (in august) be the minimum sdk level for play store
- Remove the custom code to create an activity and use ndk-glue macro instead
- Delay window creation event on android
- Set the example with compatibility settings for wgpu. Those are needed for Bevy to work on my 2019 android tablet
- Add a few details on how to debug in case of failures
- Fix running the example on emulator. This was failing because of the name of the example

Bevy still doesn't work on android with this, audio features need to be disabled because of an ndk-glue version mismatch: rodio depends on 0.6.2, winit on 0.5.2. You can test with:
```
cargo apk run --release --example android_example --no-default-features --features "bevy_winit,render"
```
james7132 pushed a commit to james7132/bevy that referenced this pull request Oct 28, 2022
# Objective

- Make Bevy work on android

## Solution

- Update android metadata and add a few more
- Set the target sdk to 31 as it will soon (in august) be the minimum sdk level for play store
- Remove the custom code to create an activity and use ndk-glue macro instead
- Delay window creation event on android
- Set the example with compatibility settings for wgpu. Those are needed for Bevy to work on my 2019 android tablet
- Add a few details on how to debug in case of failures
- Fix running the example on emulator. This was failing because of the name of the example

Bevy still doesn't work on android with this, audio features need to be disabled because of an ndk-glue version mismatch: rodio depends on 0.6.2, winit on 0.5.2. You can test with:
```
cargo apk run --release --example android_example --no-default-features --features "bevy_winit,render"
```
ItsDoot pushed a commit to ItsDoot/bevy that referenced this pull request Feb 1, 2023
# Objective

- Make Bevy work on android

## Solution

- Update android metadata and add a few more
- Set the target sdk to 31 as it will soon (in august) be the minimum sdk level for play store
- Remove the custom code to create an activity and use ndk-glue macro instead
- Delay window creation event on android
- Set the example with compatibility settings for wgpu. Those are needed for Bevy to work on my 2019 android tablet
- Add a few details on how to debug in case of failures
- Fix running the example on emulator. This was failing because of the name of the example

Bevy still doesn't work on android with this, audio features need to be disabled because of an ndk-glue version mismatch: rodio depends on 0.6.2, winit on 0.5.2. You can test with:
```
cargo apk run --release --example android_example --no-default-features --features "bevy_winit,render"
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-Bug An unexpected or incorrect behavior O-Android Specific to the Android mobile operating system P-High This is particularly urgent, and deserves immediate attention S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants