You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
flutterLocalNotificationsPlugin.initialize block app open in release mode, but works fine in debug
To Reproduce
git clone https://github.com/cruvie/demo
flutter build apk
install build/app/outputs/flutter-apk/app-release.apk on any android platform
the app is blocked and cannot enter home page
Expected behavior
after installing can open the app with no blocking
Sample code to reproduce the problem
main.dart
import'package:flutter/material.dart';
import'local_notification.dart';
Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
awaitMgrLocalNotification.init();
runApp(constMyApp());
}
classMyAppextendsStatelessWidget {
constMyApp({super.key});
// This widget is the root of your application.@overrideWidgetbuild(BuildContext context) {
returnMaterialApp(
title:'Flutter Demo',
theme:ThemeData(
// This is the theme of your application.//// TRY THIS: Try running your application with "flutter run". You'll see// the application has a purple toolbar. Then, without quitting the app,// try changing the seedColor in the colorScheme below to Colors.green// and then invoke "hot reload" (save your changes or press the "hot// reload" button in a Flutter-supported IDE, or press "r" if you used// the command line to start the app).//// Notice that the counter didn't reset back to zero; the application// state is not lost during the reload. To reset the state, use hot// restart instead.//// This works for code too, not just values: Most code changes can be// tested with just a hot reload.
colorScheme:ColorScheme.fromSeed(seedColor:Colors.deepPurple),
useMaterial3:true,
),
home:constMyHomePage(title:'Flutter Demo Home Page'),
);
}
}
classMyHomePageextendsStatefulWidget {
constMyHomePage({super.key, requiredthis.title});
// This widget is the home page of your application. It is stateful, meaning// that it has a State object (defined below) that contains fields that affect// how it looks.// This class is the configuration for the state. It holds the values (in this// case the title) provided by the parent (in this case the App widget) and// used by the build method of the State. Fields in a Widget subclass are// always marked "final".finalString title;
@overrideState<MyHomePage> createState() =>_MyHomePageState();
}
class_MyHomePageStateextendsState<MyHomePage> {
int _counter =0;
void_incrementCounter() {
setState(() {
// This call to setState tells the Flutter framework that something has// changed in this State, which causes it to rerun the build method below// so that the display can reflect the updated values. If we changed// _counter without calling setState(), then the build method would not be// called again, and so nothing would appear to happen.
_counter++;
});
}
@overrideWidgetbuild(BuildContext context) {
// This method is rerun every time setState is called, for instance as done// by the _incrementCounter method above.//// The Flutter framework has been optimized to make rerunning build methods// fast, so that you can just rebuild anything that needs updating rather// than having to individually change instances of widgets.returnScaffold(
appBar:AppBar(
// TRY THIS: Try changing the color here to a specific color (to// Colors.amber, perhaps?) and trigger a hot reload to see the AppBar// change color while the other colors stay the same.
backgroundColor:Theme.of(context).colorScheme.inversePrimary,
// Here we take the value from the MyHomePage object that was created by// the App.build method, and use it to set our appbar title.
title:Text(widget.title),
),
body:Center(
// Center is a layout widget. It takes a single child and positions it// in the middle of the parent.
child:Column(
// Column is also a layout widget. It takes a list of children and// arranges them vertically. By default, it sizes itself to fit its// children horizontally, and tries to be as tall as its parent.//// Column has various properties to control how it sizes itself and// how it positions its children. Here we use mainAxisAlignment to// center the children vertically; the main axis here is the vertical// axis because Columns are vertical (the cross axis would be// horizontal).//// TRY THIS: Invoke "debug painting" (choose the "Toggle Debug Paint"// action in the IDE, or press "p" in the console), to see the// wireframe for each widget.
mainAxisAlignment:MainAxisAlignment.center,
children:<Widget>[
constText(
'You have pushed the button this many times:',
),
Text(
'$_counter',
style:Theme.of(context).textTheme.headlineMedium,
),
],
),
),
floatingActionButton:FloatingActionButton(
onPressed: _incrementCounter,
tooltip:'Increment',
child:constIcon(Icons.add),
), // This trailing comma makes auto-formatting nicer for build methods.
);
}
}
[!] Flutter (Channel stable, 3.24.0, on Ubuntu 24.04 LTS 6.8.0-40-generic, locale zh_CN.UTF-8)
• Flutter version 3.24.0 on channel stable at /home/cruvie/cruvie-space/local-env/flutter
! The flutter binary is not on your path. Consider adding /home/cruvie/cruvie-space/local-env/flutter/bin to your path.
! The dart binary is not on your path. Consider adding /home/cruvie/cruvie-space/local-env/flutter/bin to your path.
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 80c2e84975 (3 周前), 2024-07-30 23:06:49 +0700
• Engine revision b8800d88be
• Dart version 3.5.0
• DevTools version 2.37.2
• If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly to perform update checks and upgrades.
[!] Android toolchain - develop for Android devices (Android SDK version 35.0.0)
• Android SDK at /home/cruvie/Android/Sdk
✗ cmdline-tools component is missing
Run `path/to/sdkmanager --install "cmdline-tools;latest"`
See https://developer.android.com/studio/command-line for more details.
✗ Android license status unknown.
Run `flutter doctor --android-licenses` to accept the SDK licenses.
See https://flutter.dev/to/linux-android-setup for more details.
[✗] Chrome - develop for the web (Cannot find Chrome executable at google-chrome)
! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.
[✗] Linux toolchain - develop for Linux desktop
✗ clang++ is required for Linux development.
It is likely available from your distribution (e.g.: apt install clang), or can be downloaded from https://releases.llvm.org/
• cmake version 3.28.3
✗ ninja is required for Linux development.
It is likely available from your distribution (e.g.: apt install ninja-build), or can be downloaded from https://github.com/ninja-build/ninja/releases
• pkg-config version 1.8.1
✗ GTK 3.0 development libraries are required for Linux development.
They are likely available from your distribution (e.g.: apt install libgtk-3-dev)
[✓] Android Studio (version 2024.1)
• Android Studio at /home/cruvie/.local/share/JetBrains/Toolbox/apps/android-studio
• Flutter plugin version 81.0.2
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 17.0.11+0-17.0.11b1207.24-11852314)
[✓] IntelliJ IDEA Ultimate Edition (version 2024.2)
• IntelliJ at /home/cruvie/.local/share/JetBrains/Toolbox/apps/intellij-idea-ultimate
• Flutter plugin version 81.1.3
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
[✓] VS Code (version 1.92.1)
• VS Code at /usr/share/code
• Flutter extension version 3.94.0
[✓] Connected device (2 available)
• sdk gphone16k x86 64 (mobile) • emulator-5554 • android-x64 • Android 15 (API 35) (emulator)
• Linux (desktop) • linux • linux-x64 • Ubuntu 24.04 LTS 6.8.0-40-generic
flutter_local_notifications version
17.2.2
failed on android 14 physical or android 15 emulator
The text was updated successfully, but these errors were encountered:
I came across the same problem. It happens when trying to build the APK in release mode. Debug mode seems fine.
In my case, however, it happend after upgrading Android Studio from Koala to Ladybug. It seems that Koala is bundled with JDK17 and Ladybug JDK21. Making Flutter use JDK17 lets me build the APK the usual way (no blocking when starting the application).
Show Flutter Java version for building
flutter doctor -v
Change Flutter Java version for building
flutter config --jdk-dir "/Applications/Android Studio Koala.app/Contents/jbr/Contents/Home/"
By the way, I am initializing the FlutterLocalNotificationsPlugin in the main method.
EDIT: Building using JDK21 with coreLibraryDesugaringEnabled, and JDK17 without coreLibraryDesugaringEnabled.
Describe the bug
flutterLocalNotificationsPlugin.initialize block app open in release mode, but works fine in debug
To Reproduce
git clone https://github.com/cruvie/demo
flutter build apk
install build/app/outputs/flutter-apk/app-release.apk on any android platform
the app is blocked and cannot enter home page
Expected behavior
after installing can open the app with no blocking
Sample code to reproduce the problem
main.dart
local_notification.dart
flutter docker
flutter_local_notifications version
17.2.2
failed on android 14 physical or android 15 emulator
The text was updated successfully, but these errors were encountered: