GithubHelp home page GithubHelp logo

inferrna / hello_world_android_egui Goto Github PK

View Code? Open in Web Editor NEW
33.0 3.0 2.0 30 KB

Egui + winit + wgpu + android example

License: MIT License

Rust 100.00%
android android-app android-application boilerplate-application egui gui rust wgpu winit

hello_world_android_egui's People

Contributors

inferrna avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

hello_world_android_egui's Issues

Tested on which tooling versions?

Thanks for sharing this code.

It may be a good idea to document what packages should be installed and what are the tools versions you know this example to work.

It is, currently, working for me with the following packages provided by archlinux:
Rust 1.70
Java 8 -- any newer java failed on the final steps
android-ndk r25.c-2 -- lastest version available to Arch
android-platform-25 7.1.1_r03-2 -- 34 is available, but this must match the NDK version
android-sdk 26.1.1-2.1
android-sdk-build-tools-25 r25-1 -- idem
android-sdk-cmdline-tools-latest 9.0-1
android-sdk-platform-tools 34.0.3-1
android-studio 2022.2.1.20-1
android-tools 34.0.1-2
aarch64-linux-android -- through "rustup target add aarch64-linux-android"

black screen on real phone

Hello,

Phone: lineageos ASUS (android 11)

rustup:

$ rustup show
Default host: x86_64-unknown-linux-gnu
rustup home:  /home/user/.rustup

installed targets for active toolchain
--------------------------------------

aarch64-linux-android
x86_64-unknown-linux-gnu

active toolchain
----------------

stable-x86_64-unknown-linux-gnu (default)
rustc 1.65.0 (897e37553 2022-11-02)

Debian packages:

ii  android-sdk                           28.0.2+3                         amd64        Software development kit for Android platform
ii  android-sdk-build-tools               29.0.3+3                         amd64        Tools for building Android applications
ii  android-sdk-build-tools-common        29.0.3+3                         all          Tools for building Android applications - Common files
ii  android-sdk-common                    28.0.2+3                         all          Common files of Android SDK base toolset
ii  android-sdk-platform-tools            28.0.2+3                         amd64        Tools for interacting with an Android platform
ii  android-sdk-platform-tools-common     28.0.2+3                         all          Tools for interacting with an Android platform - Common files
ii  google-android-ndk-installer          21d+r1                           amd64        Google Android Native Development Kit (NDK) Installer
ii  libandroid-23-java                    6.0.1+r72-6                      all          Android framework for API Level 23 (6.0 Marshmallow)
$ cargo apk version
cargo-apk 0.9.6

I built and install default debug apk version.

I have only black screen after installation and i'm not an android expert. How can i debug to help?

Success to compile APK file but failed to execute.

I use following commands in windows 11, powershell:

PS D:\dode\hello_world_android_egui> $env:ANDROID_HOME="C:\Users\22730\AppData\Local\Android\Sdk"; $env:NDK_HOME="C:\Users\22730\AppData\Local\Android\Sdk\ndk\25.2.9519653"; $env:JAVA_HOME="D:\Program Files\Android\Android Studio\jbr"; cargo apk build
Using package `hello_world_android_egui` in `D:\dode\hello_world_android_egui\Cargo.toml`
warning: Found `debug_assertions` in `target.'cfg(...)'.dependencies`. This value is not supported for selecting dependencies and will not work as expected. To learn more visit https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html#platform-specific-dependencies
warning: unused variable: `window_id`
   --> src\lib.rs:120:21
    |
120 |                     window_id,
    |                     ^^^^^^^^^ help: try ignoring the field: `window_id: _`
    |
    = note: `#[warn(unused_variables)]` on by default

warning: unused variable: `rdr`
   --> src\lib.rs:155:33
    |
155 |                 RedrawRequested(rdr) => {}
    |                                 ^^^ help: if this is intentional, prefix it with an underscore: `_rdr`

warning: variable does not need to be mutable
  --> src\lib.rs:83:9
   |
83 |     let mut instance = wgpu::Instance::new(instance_descriptor);
   |         ----^^^^^^^^
   |         |
   |         help: remove this `mut`
   |
   = note: `#[warn(unused_mut)]` on by default

warning: `hello_world_android_egui` (lib) generated 3 warnings (run `cargo fix --lib -p hello_world_android_egui` to apply 3 suggestions)
    Finished dev [unoptimized + debuginfo] target(s) in 0.85s
 'lib/arm64-v8a/libhello_world_android_egui.so'...
Verifying alignment of D:\dode\hello_world_android_egui\target\debug\apk\hello_world_android_egui.apk (4)...
      49 AndroidManifest.xml (OK - compressed)
     896 lib/arm64-v8a/libhello_world_android_egui.so (OK)
Verification succesful
Signing `D:\dode\hello_world_android_egui\target\debug\apk\hello_world_android_egui.apk` with keystore `C:\Users\22730\.android\debug.keystore`

and I can find the apk file in ./target/debug/apk, while it cannot be executed. Strange.

immediate crash when executing compiled APK

You can find the relevant logs here. Note that the test device in question is a Pixel 6a running Graphene OS with Android version 14. I ran the application several times in quick succession, and each time it just immediately closed.

Here is the key relevant snippit:

(std::sys::pal::unix::abort_internal::hf3d69b9b37d787e3+8)
(std::panicking::rust_panic_with_hook::hc29e1a472e6ef851+828)
(std::panicking::begin_panic_handler::_$u7b$$u7b$closure$u7d$$u7d$::h2b4f9210102bef7c+88)
(std::sys::backtrace::__rust_end_short_backtrace::hb348b0483fe29366+8)
(rust_begin_unwind+40)
(core::panicking::panic_nounwind_fmt::hc03c55581afbd5c5+44)
(core::panicking::panic_nounwind::h24a49d684808e46f+56)
(core::slice::raw::from_raw_parts::precondition_check::h5cddddaa92262cf8+244)
(core::slice::raw::from_raw_parts::h1183b85ae4e3715a+48)
(android_activity::activity_impl::glue::WaitableNativeActivityState::new::hb7a700687cb34c43+108)
(android_activity::activity_impl::glue::NativeActivityGlue::new::hc1ca47e24e663f60+40)
(android_activity::activity_impl::glue::ANativeActivity_onCreate::_$u7b$$u7b$closure$u7d$$u7d$::h9a122cea80b781a0+132)
(_$LT$core..panic..unwind_safe..AssertUnwindSafe$LT$F$GT$$u20$as$u20$core..ops..function..FnOnce$LT$$LP$$RP$$GT$$GT$::call_once::h9f37977778ac5cb3+32)
(std::panicking::try::do_call::hb848eb6092f1417c+64)
(__rust_try+24)
(std::panicking::try::h82f979c8ee8005bc+68)
(std::panic::catch_unwind::h75603fcd5a7dedbb+4)
(android_activity::util::abort_on_panic::hcfc06e3581ad3467+32)
(ANativeActivity_onCreate+48)

So the Rust .so is panicking, but I'm not sure why.

Provide APK to download

Hello. I have visited your repo, and I would like to try your demo, but I need to build it sonehow. Would be way better if I'd be able to download it and try right away.

Can't build APK

When trying to get the APK compiling on NixOS, I get the following:

> cargo apk build
Using package `hello_world_android_egui` in `/home/ada/Projects/rs/hello_world_android_egui/Cargo.toml`
Warning: Environment variable ANDROID_SDK_ROOT is deprecated (https://developer.android.com/studio/command-line/variables#envar). It will be used until it is unset and replaced by ANDROID_HOME.
thread 'main' panicked at /build/cargo-apk-0.9.6-vendor.tar.gz/ndk-build/src/ndk.rs:89:14:
Failed to read source.properties: Os { code: 2, kind: NotFound, message: "No such file or directory" }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

This is confusing to me, because there was no source.properties in the git repo, yet somehow apparently it worked before?

Out of desparation, I tried xbuild too (as suggested by cargo-apk's README.md) and it gives me:

> x build --arch arm64 --platform android
[1/3] Fetch precompiled artifacts
Error: No such file or directory (os error 2)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.