Skip to content

Commit b8ca2e0

Browse files
committed
Fixed notification issue and app crash
1 parent 1f0947d commit b8ca2e0

File tree

3 files changed

+61
-10
lines changed

3 files changed

+61
-10
lines changed

android/app/build.gradle

+23-10
Original file line numberDiff line numberDiff line change
@@ -51,23 +51,36 @@ android {
5151
versionName flutterVersionName
5252
}
5353

54-
// added
55-
signingConfigs {
56-
release {
57-
keyAlias keystoreProperties['keyAlias']
58-
keyPassword keystoreProperties['keyPassword']
59-
storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
60-
storePassword keystoreProperties['storePassword']
61-
}
62-
}
63-
// added
54+
// added
55+
signingConfigs {
56+
release {
57+
keyAlias keystoreProperties['keyAlias']
58+
keyPassword keystoreProperties['keyPassword']
59+
storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
60+
storePassword keystoreProperties['storePassword']
61+
}
62+
}
63+
// added
6464

6565
buildTypes {
6666
release {
6767
// TODO: Add your own signing config for the release build.
6868
// Signing with the debug keys for now, so `flutter run --release` works.
6969
// signingConfig signingConfigs.debug
7070
signingConfig signingConfigs.release
71+
72+
minifyEnabled true
73+
74+
// Enables resource shrinking, which is performed by the
75+
// Android Gradle plugin.
76+
shrinkResources true
77+
78+
// Includes the default ProGuard rules files that are packaged with
79+
// the Android Gradle plugin. To learn more, go to the section about
80+
// R8 configuration files.
81+
proguardFiles getDefaultProguardFile(
82+
'proguard-android-optimize.txt'),
83+
'proguard-rules.pro'
7184
}
7285
}
7386
}

android/app/proguard-rules.pro

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
## Flutter wrapper
2+
-keep class io.flutter.app.** { *; }
3+
-keep class io.flutter.plugin.** { *; }
4+
-keep class io.flutter.util.** { *; }
5+
-keep class io.flutter.view.** { *; }
6+
-keep class io.flutter.** { *; }
7+
-keep class io.flutter.plugins.** { *; }
8+
-dontwarn io.flutter.embedding.**
9+
10+
## Gson rules
11+
# Gson uses generic type information stored in a class file when working with fields. Proguard
12+
# removes such information by default, so configure it to keep all of it.
13+
-keepattributes Signature
14+
15+
# For using GSON @Expose annotation
16+
-keepattributes *Annotation*
17+
18+
# Gson specific classes
19+
-dontwarn sun.misc.**
20+
#-keep class com.google.gson.stream.** { *; }
21+
22+
# Prevent proguard from stripping interface information from TypeAdapter, TypeAdapterFactory,
23+
# JsonSerializer, JsonDeserializer instances (so they can be used in @JsonAdapter)
24+
-keep class * implements com.google.gson.TypeAdapter
25+
-keep class * implements com.google.gson.TypeAdapterFactory
26+
-keep class * implements com.google.gson.JsonSerializer
27+
-keep class * implements com.google.gson.JsonDeserializer
28+
29+
# Prevent R8 from leaving Data object members always null
30+
-keepclassmembers,allowobfuscation class * {
31+
@com.google.gson.annotations.SerializedName <fields>;
32+
}
33+
34+
## flutter_local_notification plugin rules
35+
-keep class com.dexterous.** { *; }

android/app/src/main/res/raw/keep.xml

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<resources xmlns:tools="http://schemas.android.com/tools"
3+
tools:keep="@drawable/*,@raw/notification_sound" />

0 commit comments

Comments
 (0)