glutin: Error compiling to Android with cargo apk

Hi, I have tried to compile a project to android and I get this error. Rust nightly:

error[E0599]: no method named `set_suspend_callback` found for reference `&winit::event_loop::EventLoopWindowTarget<T>` in the current scope
  --> /Users/julia.boeira/.cargo/registry/src/github.com-1ecc6299db9ec823/glutin-0.24.1/src/api/android/mod.rs:86:12
   |
86 |         el.set_suspend_callback(Some(Box::new(move |suspended| {
   |            ^^^^^^^^^^^^^^^^^^^^ method not found in `&winit::event_loop::EventLoopWindowTarget<T>`

error[E0615]: attempted to take value of method `SwapBuffersWithDamageKHR` on type `&api::egl::egl::Egl`
   --> /Users/julia.boeira/.cargo/registry/src/github.com-1ecc6299db9ec823/glutin-0.24.1/src/api/egl/mod.rs:694:17
    |
694 |         if !egl.SwapBuffersWithDamageKHR.is_loaded() {
    |                 ^^^^^^^^^^^^^^^^^^^^^^^^ method, not a field
    |
help: use parentheses to call the method
    |
694 |         if !egl.SwapBuffersWithDamageKHR(_, _, _, _).is_loaded() {
    |                                         ^^^^^^^^^^^^

error[E0615]: attempted to take value of method `SwapBuffersWithDamageKHR` on type `&api::egl::egl::Egl`
   --> /Users/julia.boeira/.cargo/registry/src/github.com-1ecc6299db9ec823/glutin-0.24.1/src/api/egl/mod.rs:740:13
    |
740 |         egl.SwapBuffersWithDamageKHR.is_loaded()
    |             ^^^^^^^^^^^^^^^^^^^^^^^^ method, not a field
    |
help: use parentheses to call the method
    |
740 |         egl.SwapBuffersWithDamageKHR(_, _, _, _).is_loaded()
    |                                     ^^^^^^^^^^^^

error: aborting due to 3 previous errors

Some errors have detailed explanations: E0599, E0615.
For more information about an error, try `rustc --explain E0599`.
error: could not compile `glutin`.

rust stable:

error[E0599]: no associated item named `EPSILON` found for type `f64` in the current scope
   --> /Users/julia.boeira/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.22.2/src/platform_impl/android/mod.rs:101:75
    |
101 |                         if (scale_factor - old_scale_factor).abs() < f64::EPSILON {
    |                                                                           ^^^^^^^ associated item not found in `f64`
    |
help: you are looking for the module in `std`, not the primitive type
    |
101 |                         if (scale_factor - old_scale_factor).abs() < std::f64::EPSILON {
    |                                                                      ^^^^^^^^^^^^^^^^^

error: aborting due to previous error

For more information about this error, try `rustc --explain E0599`.
error: could not compile `winit`.

To learn more, run the command again with --verbose.
Error: Command 'cargo build --target aarch64-linux-android' had a non-zero exit code.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 2
  • Comments: 21 (3 by maintainers)

Commits related to this issue

Most upvoted comments

Finally rebased my custom versions of glutin and winit to newest versions: https://github.com/Kaiser1989/glutin https://github.com/Kaiser1989/winit

Created Pull-Request for winit: https://github.com/rust-windowing/winit/pull/2118

and glutin: https://github.com/rust-windowing/winit/pull/2118

Adjusted my working example to use these new versions: https://github.com/Kaiser1989/rust-android-example https://github.com/Kaiser1989/game-gl

Wow, i got it 🎉

running_android

To be honest, i don’t know what exactly i did. But give me some days to figure out and then i’ll push all information needed.

Just so far:

  • I used the simple app project from @katyo
  • I used the the glutin branch of @katyo plus some minor changes
  • I changed some functions on Winit

Here is my running example:

https://github.com/Kaiser1989/rust-android-example

I forked glutin and winit to get some nice and easy cargo dependencies. It’s completly based on your (@katyo ) glutin_simple project. I just did some hacky changes to winit and changed the ContextBuilder config.

Hello Philipp. Thank you so much for this grate job. This example works perfect. Grate respect. Many thanks to @katyo for support and ideas.

I’m also trying for days to get either winit, glutin or just some hello world app running on android without success. Is there any compiling and running example out there?