diff --git a/CHANGELOG.md b/CHANGELOG.md index 77f9517d..a2f31655 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,9 @@ for the Linux x64 and Darwin x64 platforms. ## Unreleased Changes +### Fixed +- Include ProGuard/R8 rules in the Android AAR to preserve classes and constructors used by JNI. (#215) + ## [4.5.1] - 2026-10-15 ### Changed - Releases are signed with a new key, and the release process was updated. (#216, #217) diff --git a/build.gradle b/build.gradle index d3bc893a..55b37b24 100644 --- a/build.gradle +++ b/build.gradle @@ -167,7 +167,7 @@ task androidJar(type: Jar) { include 'android-arm64/**' include 'META-INF/**' } - + duplicatesStrategy = DuplicatesStrategy.EXCLUDE manifest { @@ -200,6 +200,10 @@ task androidAar(type: Zip) { archiveBaseName = 'h3-android' archiveVersion = project.version archiveExtension = 'aar' + + from('src/main/proguard/h3-android.pro') { + rename { 'proguard.txt' } + } // Map android-arm to armeabi-v7a (32-bit ARM) from('src/main/resources/android-arm') { diff --git a/src/main/proguard/h3-android.pro b/src/main/proguard/h3-android.pro new file mode 100644 index 00000000..9f302e24 --- /dev/null +++ b/src/main/proguard/h3-android.pro @@ -0,0 +1,7 @@ +# These classes and constructors are looked up by name from the JNI layer. +-keep class com.uber.h3core.util.LatLng { + public (double, double); +} +-keep class com.uber.h3core.exceptions.H3Exception { + public (int); +}