fix(app): release builds keep JNI-called plugin code, so settings, sign-in and drafts are saved on the phone

This commit is contained in:
2026-10-24 00:16:21 +01:00
parent 7ec5b52793
commit f28418cc62
3 changed files with 33 additions and 0 deletions
+20
View File
@@ -0,0 +1,20 @@
import 'dart:io';
import 'package:flutter_test/flutter_test.dart';
void main() {
test('release builds keep the plugin code called through JNI', () {
// Without these rules R8 strips shared_preferences' JNI targets and a
// release phone loses every saved setting, sign-in and draft.
final gradle = File('android/app/build.gradle.kts').readAsStringSync();
final rules = File('android/app/proguard-rules.pro').readAsStringSync();
expect(gradle, contains('"proguard-rules.pro"'));
for (final rule in [
'-keep class io.flutter.plugins.** { *; }',
'-keep class com.github.dart_lang.jni.** { *; }',
'-keep class kotlin.** { *; }',
]) {
expect(rules, contains(rule));
}
});
}