Move Android example to its own package (#6759)

# Objective

- Fix CI issue with updated `cargo-app`

## Solution

- Move the Android example to its own package. It's not necessary for the CI fix, but it's cleaner, mimic the iOS example, and easier to reuse for someone wanting to setup android support in their project
- Build the package in CI instead of the example


The Android example is still working on my android device with this change 👍
This commit is contained in:
François 2022-11-25 23:02:56 +00:00 committed by Carter Anderson
parent 4f17cd9754
commit cfbf671267
4 changed files with 31 additions and 24 deletions

View file

@ -54,7 +54,7 @@ jobs:
run: cargo install --force cargo-apk
- name: Build APK
run: ANDROID_NDK_ROOT=$ANDROID_NDK_LATEST_HOME cargo apk build --example android_example
run: ANDROID_NDK_ROOT=$ANDROID_NDK_LATEST_HOME cargo apk build --package bevy-android-example
run-examples-on-windows-dx12:
runs-on: windows-latest

View file

@ -15,6 +15,7 @@ repository = "https://github.com/bevyengine/bevy"
exclude = ["benches", "crates/bevy_ecs_compile_fail_tests"]
members = [
"crates/*",
"examples/android",
"examples/ios",
"tools/ci",
"tools/spancmp",
@ -1587,29 +1588,6 @@ description = "Demonstrates resizing and responding to resizing a window"
category = "Window"
wasm = true
# Android
[[example]]
crate-type = ["cdylib"]
name = "android_example"
path = "examples/android/android.rs"
[package.metadata.example.android_example]
hidden = true
[package.metadata.android]
package = "org.bevyengine.example"
apk_name = "bevyexample"
assets = "assets"
resources = "assets/android-res"
build_targets = ["aarch64-linux-android", "armv7-linux-androideabi"]
[package.metadata.android.sdk]
target_sdk_version = 31
[package.metadata.android.application]
icon = "@mipmap/ic_launcher"
label = "Bevy Example"
[profile.wasm-release]
inherits = "release"
opt-level = "z"

View file

@ -0,0 +1,29 @@
[package]
name = "bevy-android-example"
version = "0.1.0"
edition = "2021"
description = "Example for building an Android app with Bevy"
publish = false
license = "MIT OR Apache-2.0"
[lib]
name = "bevy_android_example"
crate-type = ["cdylib"]
[dependencies]
bevy = { path = "../../" }
[package.metadata.android]
package = "org.bevyengine.example"
apk_name = "bevyexample"
assets = "../../assets"
resources = "../../assets/android-res"
build_targets = ["aarch64-linux-android", "armv7-linux-androideabi"]
[package.metadata.android.sdk]
target_sdk_version = 31
[package.metadata.android.application]
icon = "@mipmap/ic_launcher"
label = "Bevy Example"