Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 2.5.2

* Fixes a `NoSuchMethodError` at startup in Android release builds by adding consumer R8 rules that keep the Kotlin classes looked up through JNI.

## 2.5.1

* Updates `androidx.datastore:datastore` to 1.2.1.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ android {
defaultConfig {
minSdk = 24
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
// TODO(https://github.com/dart-lang/native/issues/3732): Remove, along with
// consumer-rules.pro, once package:jni ships the Kotlin keep rules.
consumerProguardFiles("consumer-rules.pro")
}

lint {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Kotlin classes that package:jni and the generated Dart code look up by name
# through JNI. Classes generated by Pigeon are annotated with @Keep, but library
# classes can't be annotated, so without these rules R8 renames them in release
# builds and the JNI calls fail with NoSuchMethodError.
#
# TODO(https://github.com/dart-lang/native/issues/3732): Delete this file and
# its consumerProguardFiles entry in build.gradle.kts once package:jni ships
# these rules.
-keep class kotlin.Unit { *; }
-keep class kotlin.Result { *; }
-keep class kotlin.Result$Failure { *; }
-keep class kotlin.coroutines.Continuation { *; }
-keep class kotlin.coroutines.intrinsics.CoroutineSingletons { *; }
-keep class kotlin.coroutines.intrinsics.IntrinsicsKt { *; }
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: shared_preferences_android
description: Android implementation of the shared_preferences plugin
repository: https://github.com/flutter/packages/tree/main/packages/shared_preferences/shared_preferences_android
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+shared_preferences%22
version: 2.5.1
version: 2.5.2

environment:
sdk: ^3.12.0
Expand Down
Loading