The generated project shipped AGP 8.7.0 against the Gradle 8.13 wrapper,
a pair Gradle 9.1.0 does not accept: AGP 8.7 predates Gradle 9 and its
configuration fails outright. Move both to the newest matched pair that
AGP documents (8.13.0 requires Gradle 8.13+), which is also the first
AGP that builds cleanly against compileSdk 36.
Kotlin stays at 2.0.20 deliberately: the template's app build script
still uses the removed `kotlinOptions` block, so a KGP 2.2.x bump needs
that rewritten first.
JNIEnv::find_class resolves against the system classloader on a thread
attached from native code, which cannot see APK classes (#5629). Route
the generated #[manganis::ffi] type lookup through
load_class_from_classloader, and reimplement that helper to ask the
activity's own ClassLoader.loadClass instead of Class.forName.
Ask the activity INSTANCE, not its Class: Context.getClassLoader() is
documented to return a loader for the application package
unconditionally, whereas Class.getClassLoader() returns null for classes
loaded by the bootstrap loader.
Describe and clear the pending Java exception on every error path. jni
0.21 leaves the exception pending when a call returns Err, and the next
JNI call then aborts the process with 'JNI DETECTED ERROR IN
APPLICATION: ... called with pending exception' -- which is what turns a
recoverable ClassNotFoundException into an unreadable ART abort.