plus_plugins
plus_plugins copied to clipboard
[Bug]: callback doesn't get called when android main activity is in a sub package
Platform
Android 13
Plugin
android_alarm_manager_plus
Version
3.0.4
Flutter SDK
3.16.8
Steps to reproduce
- Create a new flutter app
- Rename MainActivity package to a sub package eg. com.example.app.sub
- Move MainActivity to a sub folder matching the new package name
- Change android app gradle namespace and default config applicationId to match new package name
- Run the code sample
Code Sample
https://github.com/Andrew-Bekhiet/sub_package_name_issue
import 'package:android_alarm_manager_plus/android_alarm_manager_plus.dart';
import 'package:flutter/material.dart';
void main(List<String> args, [bool launchedFromAlarm = false]) {
print(args);
runApp(MainApp(launchedFromAlarm: launchedFromAlarm));
}
class MainApp extends StatelessWidget {
final bool launchedFromAlarm;
const MainApp({super.key, required this.launchedFromAlarm});
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(title: const Text('Alarm Manager')),
body: Center(
child: Column(
children: [
ElevatedButton(
onPressed: () {
AndroidAlarmManager.periodic(
const Duration(minutes: 1),
0,
StaticClass.printHello,
startAt: DateTime.now(),
);
},
child: const Text('Schedule for next minute'),
),
if (launchedFromAlarm) const Text('Launched from alarm'),
],
),
),
),
);
}
}
class StaticClass {
@pragma('vm:entry-point')
static void printHello() {
print('Hello, world!');
main([], true);
}
}
Logs
[ +6 ms] executing: uname -m
[ +6 ms] Exit code 0 from: uname -m
[ ] x86_64
[ +33 ms] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
[ ] Artifact Instance of 'LegacyCanvasKitRemover' is not required, skipping update.
[ +1 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[ +1 ms] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[ +27 ms] executing: /home/androidq/Android/Sdk/platform-tools/adb devices -l
[ +29 ms] List of devices attached
emulator-5554 device product:sdk_gphone_x86_64 model:sdk_gphone_x86_64 device:emu64xa transport_id:2
[ +3 ms] /home/androidq/Android/Sdk/platform-tools/adb -s emulator-5554 shell getprop
[ +20 ms] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[ +4 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[ +85 ms] Skipping pub get: version match.
[ +13 ms] Found plugin android_alarm_manager_plus at /home/androidq/.pub-cache/hosted/pub.dev/android_alarm_manager_plus-3.0.4/
[ +34 ms] Found plugin android_alarm_manager_plus at /home/androidq/.pub-cache/hosted/pub.dev/android_alarm_manager_plus-3.0.4/
[ +27 ms] Found plugin android_alarm_manager_plus at /home/androidq/.pub-cache/hosted/pub.dev/android_alarm_manager_plus-3.0.4/
[ +15 ms] Generating /media/androidq/data/Projects/notifications_issue/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java
[ +21 ms] ro.hardware = ranchu
[ +24 ms] Initializing file store
[ +4 ms] Skipping target: gen_localizations
[ +2 ms] gen_dart_plugin_registrant: Starting due to {InvalidatedReasonKind.inputChanged: The following inputs have updated contents: /media/androidq/data/Projects/notifications_issue/.dart_tool/package_config_subset}
[ +3 ms] Found plugin android_alarm_manager_plus at /home/androidq/.pub-cache/hosted/pub.dev/android_alarm_manager_plus-3.0.4/
[ +13 ms] gen_dart_plugin_registrant: Complete
[ ] Skipping target: _composite
[ +1 ms] complete
[ +2 ms] Launching lib/main.dart on sdk gphone x86 64 in debug mode...
[ +1 ms] /media/androidq/data/flutter/bin/cache/dart-sdk/bin/dart --disable-dart-dev /media/androidq/data/flutter/bin/cache/dart-sdk/bin/snapshots/frontend_server.dart.snapshot --sdk-root /media/androidq/data/flutter/bin/cache/artifacts/engine/common/flutter_patched_sdk/ --incremental --target=flutter --experimental-emit-debug-metadata -DFLUTTER_WEB_AUTO_DETECT=true -DFLUTTER_WEB_CANVASKIT_URL=https://www.gstatic.com/flutter-canvaskit/6e2ea58a5ccbefcfadc2d4b7b8045fc6c20ab812/ --output-dill /tmp/flutter_tools.IXXFUE/flutter_tool.LLLHQW/app.dill --packages /media/androidq/data/Projects/notifications_issue/.dart_tool/package_config.json -Ddart.vm.profile=false -Ddart.vm.product=false --enable-asserts --track-widget-creation --filesystem-scheme org-dartlang-root --initialize-from-dill build/b01ca64756e6102cf66a48c2b6c3089e.cache.dill.track.dill --verbosity=error --enable-experiment=alternative-invalidation-strategy
[ +3 ms] executing: /home/androidq/Android/Sdk/build-tools/33.0.0/aapt dump xmltree /media/androidq/data/Projects/notifications_issue/build/app/outputs/flutter-apk/app-debug.apk AndroidManifest.xml
[ +3 ms] Exit code 0 from: /home/androidq/Android/Sdk/build-tools/33.0.0/aapt dump xmltree /media/androidq/data/Projects/notifications_issue/build/app/outputs/flutter-apk/app-debug.apk AndroidManifest.xml
[ ] N: android=http://schemas.android.com/apk/res/android
E: manifest (line=2)
A: android:versionCode(0x0101021b)=(type 0x10)0x1
A: android:versionName(0x0101021c)="0.1.0" (Raw: "0.1.0")
A: android:compileSdkVersion(0x01010572)=(type 0x10)0x21
A: android:compileSdkVersionCodename(0x01010573)="13" (Raw: "13")
A: package="com.AndroidQuartz.notifications_issue.sub" (Raw: "com.AndroidQuartz.notifications_issue.sub")
A: platformBuildVersionCode=(type 0x10)0x21
A: platformBuildVersionName=(type 0x10)0xd
E: uses-sdk (line=7)
A: android:minSdkVersion(0x0101020c)=(type 0x10)0x13
A: android:targetSdkVersion(0x01010270)=(type 0x10)0x21
E: uses-permission (line=15)
A: android:name(0x01010003)="android.permission.INTERNET" (Raw: "android.permission.INTERNET")
E: uses-permission (line=16)
A: android:name(0x01010003)="android.permission.RECEIVE_BOOT_COMPLETED" (Raw: "android.permission.RECEIVE_BOOT_COMPLETED")
E: uses-permission (line=17)
A: android:name(0x01010003)="android.permission.WAKE_LOCK" (Raw: "android.permission.WAKE_LOCK")
E: uses-permission (line=18)
A: android:name(0x01010003)="android.permission.SCHEDULE_EXACT_ALARM" (Raw: "android.permission.SCHEDULE_EXACT_ALARM")
E: permission (line=20)
A: android:name(0x01010003)="com.AndroidQuartz.notifications_issue.sub.DYNAMIC_RECEIVER_NOT_EXPORTED_PERMISSION" (Raw: "com.AndroidQuartz.notifications_issue.sub.DYNAMIC_RECEIVER_NOT_EXPORTED_PERMISSION")
A: android:protectionLevel(0x01010009)=(type 0x11)0x2
E: uses-permission (line=24)
A: android:name(0x01010003)="com.AndroidQuartz.notifications_issue.sub.DYNAMIC_RECEIVER_NOT_EXPORTED_PERMISSION" (Raw: "com.AndroidQuartz.notifications_issue.sub.DYNAMIC_RECEIVER_NOT_EXPORTED_PERMISSION")
E: application (line=26)
A: android:label(0x01010001)="notifications_issue" (Raw: "notifications_issue")
A: android:icon(0x01010002)=@0x7f0c0000
A: android:name(0x01010003)="android.app.Application" (Raw: "android.app.Application")
A: android:debuggable(0x0101000f)=(type 0x12)0xffffffff
A: android:appComponentFactory(0x0101057a)="androidx.core.app.CoreComponentFactory" (Raw: "androidx.core.app.CoreComponentFactory")
E: activity (line=32)
A: android:theme(0x01010000)=@0x7f0e00a1
A: android:name(0x01010003)="com.AndroidQuartz.notifications_issue.sub.MainActivity" (Raw: "com.AndroidQuartz.notifications_issue.sub.MainActivity")
A: android:exported(0x01010010)=(type 0x12)0xffffffff
A: android:launchMode(0x0101001d)=(type 0x10)0x1
A: android:configChanges(0x0101001f)=(type 0x11)0x40003fb4
A: android:windowSoftInputMode(0x0101022b)=(type 0x11)0x10
A: android:hardwareAccelerated(0x010102d3)=(type 0x12)0xffffffff
E: meta-data (line=47)
A: android:name(0x01010003)="io.flutter.embedding.android.NormalTheme" (Raw: "io.flutter.embedding.android.NormalTheme")
A: android:resource(0x01010025)=@0x7f0e00a2
E: intent-filter (line=51)
E: action (line=52)
A: android:name(0x01010003)="android.intent.action.MAIN" (Raw: "android.intent.action.MAIN")
E: category (line=54)
A: android:name(0x01010003)="android.intent.category.LAUNCHER" (Raw: "android.intent.category.LAUNCHER")
E: meta-data (line=61)
A: android:name(0x01010003)="flutterEmbedding" (Raw: "flutterEmbedding")
A: android:value(0x01010024)=(type 0x10)0x2
E: service (line=65)
A: android:name(0x01010003)="dev.fluttercommunity.plus.androidalarmmanager.AlarmService" (Raw: "dev.fluttercommunity.plus.androidalarmmanager.AlarmService")
A: android:permission(0x01010006)="android.permission.BIND_JOB_SERVICE" (Raw: "android.permission.BIND_JOB_SERVICE")
A: android:exported(0x01010010)=(type 0x12)0x0
E: receiver (line=70)
A: android:name(0x01010003)="dev.fluttercommunity.plus.androidalarmmanager.AlarmBroadcastReceiver" (Raw: "dev.fluttercommunity.plus.androidalarmmanager.AlarmBroadcastReceiver")
A: android:exported(0x01010010)=(type 0x12)0x0
E: receiver (line=73)
A: android:name(0x01010003)="dev.fluttercommunity.plus.androidalarmmanager.RebootBroadcastReceiver" (Raw: "dev.fluttercommunity.plus.androidalarmmanager.RebootBroadcastReceiver")
A: android:enabled(0x0101000e)=(type 0x12)0x0
A: android:exported(0x01010010)=(type 0x12)0x0
E: intent-filter (line=77)
E: action (line=78)
A: android:name(0x01010003)="android.intent.action.BOOT_COMPLETED" (Raw: "android.intent.action.BOOT_COMPLETED")
E: uses-library (line=82)
A: android:name(0x01010003)="androidx.window.extensions" (Raw: "androidx.window.extensions")
A: android:required(0x0101028e)=(type 0x12)0x0
E: uses-library (line=85)
A: android:name(0x01010003)="androidx.window.sidecar" (Raw: "androidx.window.sidecar")
A: android:required(0x0101028e)=(type 0x12)0x0
E: provider (line=89)
A: android:name(0x01010003)="androidx.startup.InitializationProvider" (Raw: "androidx.startup.InitializationProvider")
A: android:exported(0x01010010)=(type 0x12)0x0
A: android:authorities(0x01010018)="com.AndroidQuartz.notifications_issue.sub.androidx-startup" (Raw: "com.AndroidQuartz.notifications_issue.sub.androidx-startup")
E: meta-data (line=93)
...
[ +14 ms] Connected to _flutterView/0x767b5c116360.
[ +1 ms] Flutter run key commands.
[ ] r Hot reload. 🔥🔥🔥
[ ] R Hot restart.
[ ] h List all available interactive commands.
[ ] d Detach (terminate "flutter run" but leave application running).
[ ] c Clear the screen
[ ] q Quit (terminate the application on the device).
[ ] A Dart VM Service on sdk gphone x86 64 is available at: http://127.0.0.1:43053/EXYc-S9I9K0=/
[ +135 ms] The Flutter DevTools debugger and profiler on sdk gphone x86 64 is available at: http://127.0.0.1:9101?uri=http://127.0.0.1:43053/EXYc-S9I9K0=/
[ +24 ms] I/tions_issue.sub( 4683): Compiler allocated 4533KB to compile void android.view.ViewRootImpl.performTraversals()
[ +31 ms] W/Parcel ( 4683): Expecting binder but got null!
[+1526 ms] D/EGL_emulation( 4683): app_time_stats: avg=782.88ms min=5.00ms max=1560.76ms count=2
[ +125 ms] D/CompatibilityChangeReporter( 4683): Compat change id reported: 160794467; UID 10173; state: ENABLED
[+50006 ms] D/CompatibilityChangeReporter( 4683): Compat change id reported: 194532703; UID 10173; state: ENABLED
[ +2 ms] I/FlutterBackgroundExecutor( 4683): Starting AlarmService...
[ +2 ms] D/EGL_emulation( 4683): eglCreateContext: 0x767abc0e7ad0: maj 3 min 1 rcv 4
[ ] D/EGL_emulation( 4683): eglCreateContext: 0x767abc0f4f10: maj 3 min 1 rcv 4
[ +5 ms] D/HostConnection( 4683): HostComposition ext ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_native_sync_v2 ANDROID_EMU_native_sync_v3 ANDROID_EMU_native_sync_v4 ANDROID_EMU_dma_v1 ANDROID_EMU_direct_mem ANDROID_EMU_host_composition_v1 ANDROID_EMU_host_composition_v2 ANDROID_EMU_vulkan ANDROID_EMU_deferred_vulkan_commands ANDROID_EMU_vulkan_null_optional_strings ANDROID_EMU_vulkan_create_resources_with_requirements ANDROID_EMU_YUV_Cache ANDROID_EMU_vulkan_ignored_handles ANDROID_EMU_has_shared_slots_host_memory_allocator ANDROID_EMU_vulkan_free_memory_sync ANDROID_EMU_vulkan_shader_float16_int8 ANDROID_EMU_vulkan_async_queue_submit ANDROID_EMU_vulkan_queue_submit_with_commands ANDROID_EMU_sync_buffer_data ANDROID_EMU_vulkan_async_qsri ANDROID_EMU_read_color_buffer_dma ANDROID_EMU_hwc_multi_configs GL_OES_EGL_image_external_essl3 GL_OES_vertex_array_object GL_KHR_texture_compression_astc_ldr ANDROID_EMU_host_side_tracing ANDROID_EMU_gles_max_version_3_1
[ ] D/EGL_emulation( 4683): eglMakeCurrent: 0x767abc0f4f10: ver 3 1 (tinfo 0x767ce0929280) (first time)
[ +1 ms] I/AndroidAlarmManagerPlugin( 4683): onAttachedToEngine
[ ] E/FlutterBackgroundExecutor( 4683): Fatal: failed to find callback
[ +1 ms] I/AlarmService( 4683): AlarmService has not yet started.
[+8450 ms] Application finished.
[ +1 ms] Running 1 shutdown hook
[ ] DevFS: Deleting filesystem on the device (file:///data/user/0/com.AndroidQuartz.notifications_issue.sub/code_cache/notifications_issueUQEYDW/notifications_issue/)
[ ] Shutdown hooks complete
[ ] exiting with code 0
Flutter Doctor
[✓] Flutter (Channel stable, 3.16.8, on Ubuntu 23.10 6.5.0-17-generic, locale en_US.UTF-8)
• Flutter version 3.16.8 on channel stable at /media/androidq/data/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 67457e669f (5 weeks ago), 2024-01-16 16:22:29 -0800
• Engine revision 6e2ea58a5c
• Dart version 3.2.5
• DevTools version 2.28.5
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
• Android SDK at /home/androidq/Android/Sdk
• Platform android-33, build-tools 33.0.0
• Java binary at: /home/androidq/android-studio/jbr/bin/java
• Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)
• All Android licenses accepted.
[✓] Chrome - develop for the web
• Chrome at google-chrome
[✓] Linux toolchain - develop for Linux desktop
• Ubuntu clang version 16.0.6 (15)
• cmake version 3.27.4
• ninja version 1.11.1
• pkg-config version 1.8.1
[✓] Android Studio (version 2022.3)
• Android Studio at /home/androidq/android-studio
• Flutter plugin version 76.2.2
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)
[✓] VS Code (version 1.86.2)
• VS Code at /usr/share/code
• Flutter extension version 3.83.20240201
[✓] Connected device (2 available)
• Linux (desktop) • linux • linux-x64 • Ubuntu 23.10 6.5.0-17-generic
• Chrome (web) • chrome • web-javascript • Google Chrome 121.0.6167.139
[✓] Network resources
• All expected network resources are available.
Checklist before submitting a bug
- [X] I searched issues in this repository and couldn't find such bug/problem
- [X] I Google'd a solution and I couldn't find it
- [X] I searched on StackOverflow for a solution and I couldn't find it
- [X] I read the README.md file of the plugin
- [X] I'm using the latest version of the plugin
- [X] All dependencies are up to date with
flutter pub upgrade - [X] I did a
flutter clean - [X] I tried running the example project