Skip to content

Conversation

@rib
Copy link
Member

@rib rib commented Jun 4, 2023

Since I was looking at hopefully spinning an android-activity release soon, I wanted to update these examples and also take the opportunity to test them against android-activity main.

For each example, this:

  • Updates to using Android Gradle Plugin 8.0
  • Adds ndkVersion to build.gradle
  • Updates all cargo deps and fixes / updates examples as needed
  • Avoids depending on any git branches for winit/egui now that the required Android support is upstream.
  • Removes all .idea files and adds .idea to .gitignore

This also adds a na-egui example that tests NativeActivity + Egui (same code as agdk-egui, but built against NativeActivity instead of GameActivity)

This also fixes *-mainloop on newer versions of Android by posting dummy frames to unblock input.

Newer versions of Android will stop delivering input to applications that don't appear to be responsive because they aren't rendering anything. This updates na-mainloop and agdk-mainloop so that they at least do a NOOP post of an untouched framebuffer each frame, so that they continue to be delivered touch input.

.github/workflows/ci.yml has been updated to ensure all the examples are built now, and ./gradlew build is run, in addition to cargo ndk build

Newer versions of Android will stop delivering input to applications
that don't appear to be responsive because they aren't rendering
anything.

This updates na-mainloop and agdk-mainloop so that they at least
do a NOOP post of an untouched framebuffer each frame, so that they
continue to be delivered touch input.
@rib rib force-pushed the aa-release-0.4.2 branch 3 times, most recently from 9b7a749 to 9ea89fc Compare June 4, 2023 20:24
For each example, this:
- Updates to using Android Gradle Plugin 8.0
- Adds ndkVersion to build.gradle
- Updates all cargo deps and fixes / updates examples as needed
- Avoids depending on any git branches for winit/egui now that the
  required Android support is upstream.
- Removes all .idea files and adds .idea to .gitignore

Adds a na-egui example that tests NativeActivity + Egui
(same code as agdk-egui, but built against NativeActivity instead of
GameActivity)

This updates .github/workflows/ci.yml so all examples are built
and `./gradlew build` is run - not just `cargo ndk build`
We don't currently build the OpenXR examples on Android because I
haven't found a nice nice way to pull in libopenxr_loader binaries that
we can link against. Normally I would use the binaries as part of the
Oculus SDK

TODO: maybe we can look at using the 'prefab' `.aar`s from Khronos here:

  https://search.maven.org/artifact/org.khronos.openxr/openxr_loader_for_android
@rib rib force-pushed the aa-release-0.4.2 branch from 9ea89fc to 3740ac3 Compare June 25, 2023 09:24
@rib rib merged commit 3ad2b59 into rust-mobile:main Jun 25, 2023
log = "0.4"
android_logger = "0.11.0"
android-activity = { version = "0.4", features = [ "native-activity" ] }
#android-activity = { path = "../../android-activity/android-activity", features = [ "native-activity" ] }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only noticing this now during a rebase, what is it useful for?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A slight convenience for me, for testing at time but it would probably be better to have a commented out [patches] section for something like that.

It's fine if you drop it.

sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
namespace 'co.realfit.namainloop'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For cargo-apk the Cargo.toml has:

[package.metadata.android]
# Specifies the package property of the manifest.
package = "com.foo.bar"

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah yep.

I should probably change the namespace entirely anyway. It's a bit random that I use my realfit.co domain to namespace these examples.

We could probably use something like rust.mobile instead of a registered domain

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants