Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Litttlefish authored May 30, 2024
1 parent ea13556 commit 752533e
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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`:
Expand All @@ -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`
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 752533e

Please sign in to comment.