prevent R8 shrinking from removing Tor’s private JNI fields

This commit is contained in:
Fabian Freund
2026-05-26 19:09:13 +02:00
parent 7e3c933bef
commit 99a1839f0e
2 changed files with 12 additions and 0 deletions
@@ -56,6 +56,7 @@ android {
defaultConfig {
minSdk = 24
consumerProguardFiles("consumer-rules.pro")
}
dependencies {
@@ -0,0 +1,11 @@
####################################################################################################
# tor-android JNI
####################################################################################################
# libtor accesses these fields and native methods by their Java names/signatures.
# Release R8 shrinking can otherwise remove private fields that are only used from JNI.
-keep class org.torproject.jni.TorService {
long torConfiguration;
int torControlFd;
native <methods>;
}