Skip to content

Commit

Permalink
Fixed scheduleNotification crashing the app in release mode.
Browse files Browse the repository at this point in the history
The app wasn't correctly configured for release mode as described in the flutter_local_notifications package readme: https://github.com/MaikuB/flutter_local_notifications/blob/master/flutter_local_notifications/README.md#release-build-configuration

The release mode is now configured according to the steps in this article: https://medium.com/@swav.kulinski/flutter-and-android-obfuscation-8768ac544421
  • Loading branch information
Pedro-Bronsveld committed Jun 11, 2020
1 parent e3fba8d commit c945dc6
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 2 deletions.
4 changes: 4 additions & 0 deletions client/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ android {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug
minifyEnabled true
useProguard true

proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
aaptOptions {
Expand Down
8 changes: 8 additions & 0 deletions client/android/app/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#Flutter Wrapper
-keep class io.flutter.app.** { *; }
-keep class io.flutter.plugin.** { *; }
-keep class io.flutter.util.** { *; }
-keep class io.flutter.view.** { *; }
-keep class io.flutter.** { *; }
-keep class io.flutter.plugins.** { *; }
-keep class com.dexterous.** { *; }
4 changes: 2 additions & 2 deletions client/lib/pages/plant-detail.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class PlantDetail extends StatelessWidget {
assert(plant != null),
assert(getUserPlantImage != null);

CachedNetworkImage userPlantImage;
Future<CachedNetworkImage> userPlantImage;

@override
Widget build(BuildContext context) {
Expand Down Expand Up @@ -90,7 +90,7 @@ class PlantDetail extends StatelessWidget {
alignment: Alignment.topRight,
child: RawMaterialButton(
onPressed: () async {
Navigator.pushReplacementNamed(context, '/add-plant', arguments: { 'plant': userPlant, 'userPlantImage': userPlantImage});
Navigator.pushReplacementNamed(context, '/add-plant', arguments: { 'plant': userPlant, 'userPlantImage': await userPlantImage});
},
elevation: 2.0,
fillColor: theme.accentColor,
Expand Down
2 changes: 2 additions & 0 deletions client/push.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
C:\\Users\\pedro\\AppData\\Local\\Android\\Sdk\\platform-tools\\adb.exe install D:\\Files\\Dev\\GitHub\\ProjectD\\client\\build\\app\\outputs\\apk\\release\\app-release.apk
C:\\Users\\pedro\\AppData\\Local\\Android\\Sdk\\platform-tools\\adb.exe shell am start -n nl.bylivingart.plantexpert/.MainActivity

0 comments on commit c945dc6

Please sign in to comment.