diff --git a/app/android/app/build.gradle.kts b/app/android/app/build.gradle.kts index d3e4286..e569d09 100644 --- a/app/android/app/build.gradle.kts +++ b/app/android/app/build.gradle.kts @@ -55,6 +55,12 @@ android { } else { signingConfigs.getByName("debug") } + // Keep rules for libraries that R8 cannot trace (ONNX Runtime + // reaches its Java classes from native code by name). + proguardFiles( + getDefaultProguardFile("proguard-android-optimize.txt"), + "proguard-rules.pro", + ) } } } diff --git a/app/android/app/proguard-rules.pro b/app/android/app/proguard-rules.pro new file mode 100644 index 0000000..b7e3051 --- /dev/null +++ b/app/android/app/proguard-rules.pro @@ -0,0 +1,8 @@ +# ONNX Runtime's native library looks up its Java classes by name over JNI +# (ai/onnxruntime/TensorInfo and friends). R8 cannot see those uses, so in +# release builds it removed TensorInfo and renamed others. The first search +# by meaning then aborted the app with "JNI DETECTED ERROR: java_class == +# null" in convertToTensorInfo (Play vitals, 1.0.61+79, 2026-10-21). +# Keep the whole package exactly as shipped. +-keep class ai.onnxruntime.** { *; } +-keepclassmembers class ai.onnxruntime.** { *; }