Adjust build.gradle for Android API 31 or higher compatibility and dependency updates - #147
Adjust build.gradle for Android API 31 or higher compatibility and dependency updates#147devappsteam wants to merge 9 commits into
Conversation
Fix/gradle compatibility
|
Issue with R8/ProGuard when using GSON TypeToken on Android (Flutter) Hello @devappsteam and @sultan18kh! First of all, thank you for the great work in updating this package. 👏 I ran into an issue when building in release mode with This happens because R8/ProGuard removes generic type information, which breaks GSON's I was able to fix the issue by adding the following rule to my # Preserve generic signatures required by GSON TypeToken
-keepattributes Signature, InnerClasses, EnclosingMethodIt might be helpful to include this in the package documentation or ProGuard section to prevent others from facing the same problem. For reference, here’s my working # PROGUARD RULES - BACKGROUND_LOCATOR_2
# Background Locator 2 (main plugin)
-keep class yukams.app.background_locator_2.** { *; }
# GSON (for JSON serialization)
-keep class com.google.gson.** { *; }
-keepclassmembers,allowobfuscation class * {
@com.google.gson.annotations.SerializedName <fields>;
}
If you have any suggestions on how to fix this without needing to modify Thanks again for the update on package! |
Updated compileSdkVersion and targetSdkVersion to 31.
Fixed duplicated kotlin-gradle-plugin declaration.
Replaced jcenter() with mavenCentral() due to JCenter shutdown.
Kept support for Kotlin 1.7.20 and Gradle 7.3.0.
Tested versions:
Successfully built release APK using
flutter build apk --release.