From 752533ea9f811ee735f177969c81659a24817393 Mon Sep 17 00:00:00 2001 From: Litttle_fish <38809254+Litttlefish@users.noreply.github.com> Date: Thu, 30 May 2024 23:27:39 +0800 Subject: [PATCH] Update README.md --- examples/README.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/examples/README.md b/examples/README.md index 5e8f9a2966ed5..38daed9cb1673 100644 --- a/examples/README.md +++ b/examples/README.md @@ -70,6 +70,7 @@ git checkout v0.4.0 - [Build & Run](#build--run) - [About `libc++_shared.so`](#about-libc_sharedso) - [Old phones](#old-phones) + - [About `cargo-apk`](#about-cargo-apk) - [iOS](#ios) - [Setup](#setup-1) - [Build & Run](#build--run-1) @@ -489,6 +490,8 @@ The Android SDK must be installed, and the environment variable `ANDROID_SDK_ROO When using `NDK (Side by side)`, the environment variable `ANDROID_NDK_ROOT` must also be set to one of the NDKs in `sdk\ndk\[NDK number]`. +Alternatively, you can install Android Studio. + ### Build & Run To build an android app, you need to compile it to `so` first with `cargo-ndk`: @@ -513,6 +516,14 @@ cargo ndk -t arm64-v8a -o android_example/app/src/main/jniLibs build Please reference `cargo-ndk` [README](https://crates.io/crates/cargo-ndk) for other options. +Then you can build it with `gradlew`: + +```sh +./gradlew build +``` + +Or build it with Android Studio. + After compiling and linking you can build and test it in your android project. #### About `libc++_shared.so` @@ -553,6 +564,10 @@ bevy = { version = "0.14", default-features = false, features = ["android-native Then build it as the [Build & Run](#build--run) section stated above. +#### About `cargo-apk` + +You can also build apk with `cargo-apk`, a simpler tool that compile rust code to apk directly, but this tool is deprecated, and it doesn't support `GameActivity`. If you want to use this, there is a [folder](./mobile/android_basic) inside mobile example with a instruction to use it. + Example | File | Description --- | --- | --- `android` | [`mobile/src/lib.rs`](./mobile/src/lib.rs) | A 3d Scene with a button and playing sound