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:
@@ -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));
|
||||
}
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user