No such file or directory on Flutter 2.0.2
See original GitHub issueDescription Huawei Push plugin is not configuring in the project. There is no error in the project but when I run command flutter build apk. The terminal gives the following error.
Logs
../../snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/huawei_push-5.0.2+303/lib/push.dart:25:8: Error: Error when reading '../../snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/huawei_push-5.0.2+303/lib/constants/Channel.dart': No such file or directory
import './constants/Channel.dart' as Channel;
^
../../snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/huawei_push-5.0.2+303/lib/push.dart:26:8: Error: Error when reading '../../snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/huawei_push-5.0.2+303/lib/constants/Method.dart': No such file or directory
import './constants/Method.dart' as Method;
^
../../snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/huawei_push-5.0.2+303/lib/push.dart:27:8: Error: Error when reading '../../snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/huawei_push-5.0.2+303/lib/constants/Code.dart': No such file or directory
import 'constants/Code.dart';
^
../../snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/huawei_push-5.0.2+303/lib/push.dart:32:35: Error: Getter not found: 'METHOD_CHANNEL'.
const MethodChannel(Channel.METHOD_CHANNEL);
^^^^^^^^^^^^^^
../../snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/huawei_push-5.0.2+303/lib/push.dart:34:28: Error: Getter not found: 'TOKEN_CHANNEL'.
EventChannel(Channel.TOKEN_CHANNEL);
^^^^^^^^^^^^^
../../snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/huawei_push-5.0.2+303/lib/push.dart:36:28: Error: Getter not found: 'REMOTE_MESSAGE_RECEIVE_CHANNEL'.
EventChannel(Channel.REMOTE_MESSAGE_RECEIVE_CHANNEL);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
../../snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/huawei_push-5.0.2+303/lib/push.dart:38:28: Error: Getter not found: 'REMOTE_MESSAGE_SEND_STATUS_CHANNEL'.
EventChannel(Channel.REMOTE_MESSAGE_SEND_STATUS_CHANNEL);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
../../snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/huawei_push-5.0.2+303/lib/push.dart:40:28: Error: Getter not found: 'REMOTE_MESSAGE_NOTIFICATION_INTENT_CHANNEL'.
EventChannel(Channel.REMOTE_MESSAGE_NOTIFICATION_INTENT_CHANNEL);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
../../snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/huawei_push-5.0.2+303/lib/push.dart:42:28: Error: Getter not found: 'NOTIFICATION_OPEN_CHANNEL'.
EventChannel(Channel.NOTIFICATION_OPEN_CHANNEL);
^^^^^^^^^^^^^^^^^^^^^^^^^
../../snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/huawei_push-5.0.2+303/lib/push.dart:44:28: Error: Getter not found: 'LOCAL_NOTIFICATION_CLICK_CHANNEL'.
EventChannel(Channel.LOCAL_NOTIFICATION_CLICK_CHANNEL);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
../../snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/huawei_push-5.0.2+303/lib/push.dart:50:67: Error: Getter not found: 'turnOnPush'.
final String result = await methodChannel.invokeMethod(Method.turnOnPush);
^^^^^^^^^^
../../snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/huawei_push-5.0.2+303/lib/push.dart:51:12: Error: Getter not found: 'Code'.
return Code[result];
^^^^
../../snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/huawei_push-5.0.2+303/lib/push.dart:58:67: Error: Getter not found: 'turnOffPush'.
final String result = await methodChannel.invokeMethod(Method.turnOffPush);
^^^^^^^^^^^
../../snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/huawei_push-5.0.2+303/lib/push.dart:59:12: Error: Getter not found: 'Code'.
return Code[result];
^^^^
../../snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/huawei_push-5.0.2+303/lib/push.dart:69:67: Error: Getter not found: 'getId'.
final String result = await methodChannel.invokeMethod(Method.getId);
^^^^^
../../snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/huawei_push-5.0.2+303/lib/push.dart:75:67: Error: Getter not found: 'getAAID'.
final String result = await methodChannel.invokeMethod(Method.getAAID);
^^^^^^^
../../snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/huawei_push-5.0.2+303/lib/push.dart:81:67: Error: Getter not found: 'getAppId'.
final String result = await methodChannel.invokeMethod(Method.getAppId);
^^^^^^^^
../../snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/huawei_push-5.0.2+303/lib/push.dart:87:67: Error: Getter not found: 'getOdid'.
final String result = await methodChannel.invokeMethod(Method.getOdid);
^^^^^^^
../../snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/huawei_push-5.0.2+303/lib/push.dart:103:47: Error: Getter not found: 'getToken'.
methodChannel.invokeMethod<String>(Method.getToken, args);
^^^^^^^^
../../snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/huawei_push-5.0.2+303/lib/push.dart:109:49: Error: Getter not found: 'getCreationTime'.
await methodChannel.invokeMethod(Method.getCreationTime);
^^^^^^^^^^^^^^^
../../snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/huawei_push-5.0.2+303/lib/push.dart:115:67: Error: Getter not found: 'deleteAAID'.
final String result = await methodChannel.invokeMethod(Method.deleteAAID);
^^^^^^^^^^
../../snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/huawei_push-5.0.2+303/lib/push.dart:116:12: Error: Getter not found: 'Code'.
return Code[result];
^^^^
../../snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/huawei_push-5.0.2+303/lib/push.dart:127:39: Error: Getter not found: 'deleteToken'.
methodChannel.invokeMethod(Method.deleteToken, args);
^^^^^^^^^^^
../../snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/huawei_push-5.0.2+303/lib/push.dart:168:49: Error: Getter not found: 'send'.
await methodChannel.invokeMethod(Method.send, remoteMsg.toMap());
^^^^
../../snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/huawei_push-5.0.2+303/lib/push.dart:169:12: Error: Getter not found: 'Code'.
return Code[result];
^^^^
../../snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/huawei_push-5.0.2+303/lib/push.dart:187:49: Error: Getter not found: 'subscribe'.
await methodChannel.invokeMethod(Method.subscribe, args);
^^^^^^^^^
../../snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/huawei_push-5.0.2+303/lib/push.dart:188:12: Error: Getter not found: 'Code'.
return Code[result];
^^^^
../../snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/huawei_push-5.0.2+303/lib/push.dart:200:49: Error: Getter not found: 'unsubscribe'.
await methodChannel.invokeMethod(Method.unsubscribe, args);
^^^^^^^^^^^
../../snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/huawei_push-5.0.2+303/lib/push.dart:201:12: Error: Getter not found: 'Code'.
return Code[result];
^^^^
../../snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/huawei_push-5.0.2+303/lib/push.dart:223:49: Error: Getter not found: 'setAutoInitEnabled'.
await methodChannel.invokeMethod(Method.setAutoInitEnabled, args);
^^^^^^^^^^^^^^^^^^
../../snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/huawei_push-5.0.2+303/lib/push.dart:224:12: Error: Getter not found: 'Code'.
return Code[result];
^^^^
../../snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/huawei_push-5.0.2+303/lib/push.dart:230:49: Error: Getter not found: 'isAutoInitEnabled'.
await methodChannel.invokeMethod(Method.isAutoInitEnabled);
^^^^^^^^^^^^^^^^^
../../snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/huawei_push-5.0.2+303/lib/push.dart:237:57: Error: Getter not found: 'getAgConnectValues'.
await methodChannel.invokeMethod<String>(Method.getAgConnectValues);
^^^^^^^^^^^^^^^^^^
../../snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/huawei_push-5.0.2+303/lib/push.dart:245:45: Error: Getter not found: 'showToast'.
await methodChannel.invokeMethod(Method.showToast, args);
^^^^^^^^^
../../snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/huawei_push-5.0.2+303/lib/push.dart:255:49: Error: Getter not found: 'getInitialIntent'.
await methodChannel.invokeMethod(Method.getInitialIntent);
^^^^^^^^^^^^^^^^
../../snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/huawei_push-5.0.2+303/lib/push.dart:273:49: Error: Getter not found: 'getInitialNotification'.
await methodChannel.invokeMethod(Method.getInitialNotification);
^^^^^^^^^^^^^^^^^^^^^^
../../snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/huawei_push-5.0.2+303/lib/push.dart:304:16: Error: Getter not found: 'localNotification'.
Method.localNotification, localNotification);
^^^^^^^^^^^^^^^^^
../../snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/huawei_push-5.0.2+303/lib/push.dart:313:16: Error: Getter not found: 'localNotificationSchedule'.
Method.localNotificationSchedule, localNotification);
^^^^^^^^^^^^^^^^^^^^^^^^^
../../snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/huawei_push-5.0.2+303/lib/push.dart:321:49: Error: Getter not found: 'getNotifications'.
await methodChannel.invokeMethod(Method.getNotifications);
^^^^^^^^^^^^^^^^
../../snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/huawei_push-5.0.2+303/lib/push.dart:332:49: Error: Getter not found: 'getScheduledNotifications'.
await methodChannel.invokeMethod(Method.getScheduledNotifications);
^^^^^^^^^^^^^^^^^^^^^^^^^
../../snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/huawei_push-5.0.2+303/lib/push.dart:342:65: Error: Getter not found: 'getChannels'.
final List result = await methodChannel.invokeMethod(Method.getChannels);
^^^^^^^^^^^
../../snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/huawei_push-5.0.2+303/lib/push.dart:350:49: Error: Getter not found: 'deleteChannel'.
await methodChannel.invokeMethod(Method.deleteChannel, channelId);
^^^^^^^^^^^^^
../../snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/huawei_push-5.0.2+303/lib/push.dart:351:12: Error: Getter not found: 'Code'.
return Code[result];
^^^^
../../snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/huawei_push-5.0.2+303/lib/push.dart:357:49: Error: Getter not found: 'channelExists'.
await methodChannel.invokeMethod(Method.channelExists, channelId);
^^^^^^^^^^^^^
../../snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/huawei_push-5.0.2+303/lib/push.dart:364:49: Error: Getter not found: 'channelBlocked'.
await methodChannel.invokeMethod(Method.channelBlocked, channelId);
^^^^^^^^^^^^^^
../../snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/huawei_push-5.0.2+303/lib/push.dart:370:39: Error: Getter not found: 'cancelNotifications'.
methodChannel.invokeMethod(Method.cancelNotifications);
^^^^^^^^^^^^^^^^^^^
../../snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/huawei_push-5.0.2+303/lib/push.dart:376:39: Error: Getter not found: 'cancelAllNotifications'.
methodChannel.invokeMethod(Method.cancelAllNotifications);
^^^^^^^^^^^^^^^^^^^^^^
../../snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/huawei_push-5.0.2+303/lib/push.dart:381:39: Error: Getter not found: 'cancelScheduledNotifications'.
methodChannel.invokeMethod(Method.cancelScheduledNotifications);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
../../snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/huawei_push-5.0.2+303/lib/push.dart:386:39: Error: Getter not found: 'cancelNotificationsWithTag'.
methodChannel.invokeMethod(Method.cancelNotificationsWithTag, tag);
^^^^^^^^^^^^^^^^^^^^^^^^^^
../../snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/huawei_push-5.0.2+303/lib/push.dart:391:39: Error: Getter not found: 'cancelNotificationsWithId'.
methodChannel.invokeMethod(Method.cancelNotificationsWithId, ids);
^^^^^^^^^^^^^^^^^^^^^^^^^
../../snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/huawei_push-5.0.2+303/lib/push.dart:400:39: Error: Getter not found: 'cancelNotificationsWithIdTag'.
methodChannel.invokeMethod(Method.cancelNotificationsWithIdTag, idTags);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
../../snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/huawei_push-5.0.2+303/lib/push.dart:405:39: Error: Getter not found: 'enableLogger'.
methodChannel.invokeMethod(Method.enableLogger);
^^^^^^^^^^^^
../../snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/huawei_push-5.0.2+303/lib/push.dart:410:39: Error: Getter not found: 'disableLogger'.
methodChannel.invokeMethod(Method.disableLogger);
^^^^^^^^^^^^^
../../snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/huawei_push-5.0.2+303/lib/push.dart:438:29: Error: Getter not found: 'BACKGROUND_MESSAGE_CHANNEL'.
MethodChannel(Channel.BACKGROUND_MESSAGE_CHANNEL);
^^^^^^^^^^^^^^^^^^^^^^^^^^
**Environment**
[✓] Flutter (Channel stable, 2.0.2, on Linux, locale en_US.UTF-8)
• Flutter version 2.0.2 at /home/zubair/snap/flutter/common/flutter
• Framework revision 8962f6dc68 (6 days ago), 2021-03-11 13:22:20 -0800
• Engine revision 5d8bf811b3
• Dart version 2.12.1
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
• Android SDK at /opt/Android/Sdk
• Platform android-30, build-tools 30.0.3
• ANDROID_HOME = /opt/Android/Sdk
• Java binary at: /opt/android-studio/jre/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
• All Android licenses accepted.
[✓] Chrome - develop for the web
• Chrome at google-chrome
[✓] Android Studio
• Android Studio at /opt/android-studio
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
[✓] Connected device (1 available)
• Chrome (web) • chrome • web-javascript • Google Chrome 89.0.4389.90
• No issues found!
Issue Analytics
- State:
- Created 3 years ago
- Comments:10
Top Results From Across the Web
Error when reading 'migrate': No such file or directory
**. First solution :** dart --version. If the dart sdk version is less than 2.12.0. Then try: Flutter upgrade --force. or dart upgrade....
Read more >Adding assets and images - Flutter documentation
To include all assets under a directory, specify the directory name with the ... Such files are then included in the asset bundle...
Read more >path_provider | Flutter Package - Pub.dev
Flutter plugin for getting commonly used locations on host platform file systems, such as the temp and app data directories.
Read more >env bash no such file or directory flutter - You.com
Try the below and that should fix it: Clean build. flutter clean. Make the gradlew bin runnable in unix (for mac/linux users, fileformat...
Read more >Manas 𓂀 on Twitter: "If you ever get this error with Flutter on ...
Only for Flutter 2.0.2 & dart 2.12.1" / Twitter ... error with Flutter on Mac M1: dart2js failed No such file or directory...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
You are welcome 👍, we now know that this error can be caused by the version mismatch you mentioned. Have a great day!
@atavci Thanks for your help I am following modular architecture in the Flutter project. In one of my modules, there was huawei_push: ^5.0.2+301 and One modules was using huawei_push: ^5.0.2+303. I have changed both modules to huawei_push: ^5.0.2+301 and the project is working fine now. The sad part was Android Studio was not giving any conflict of dependency versions. So it was hard to trace. Again thanks for your help 😃