I use mobile_number plugin, when try to implement example code I have a error:
ERROR:flutter/lib/ui/ui_dart_state.cc(177)] Unhandled Exception: MissingPluginException(No implementation found for method hasPhonePermission on channel mobile_number)
E/flutter (11696): #0 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:157:7)
E/flutter (11696): <asynchronous suspension>
E/flutter (11696): #1 MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:332:12)
E/flutter (11696): #2 MobileNumber.hasPhonePermission (package:mobile_number/mobile_number.dart:32:24)
The line which generate error is:
if (!await MobileNumber.hasPhonePermission) {
I use Flutter 1.22.6 • channel stable
mobile_number: ^1.0.3
What is the reason and how to avoid such a mistake?
p/s
I installed permissions in Manifest:
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<uses-permission android:name="android.permission.READ_CALL_LOG"/>
<uses-permission android:name="android.permission.ANSWER_PHONE_CALLS"/>
<uses-permission android:name="android.permission.READ_PHONE_NUMBERS" />
This is most likely due to the fact that you added the plugin and didn't rebuild your app again. Given that you followed the documentation on the pluginpage and added the mainactivity java requirements correct as instructed.
1- Close your emulator\debugging session.
2- Run flutter clean.
3- Give it a new try and it should work, update on the results of these steps please.
Related
Flutter hot reload and hot restart stop working after doing the minimum to connect my app to a firebase project.
I have connected three different flutter projects to three different firebase projects and none of them have allowed me to hot reload or hot refresh. After following the instructions on firebase to connect my app the only thing I add is this.
main() async {
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp();
runApp(MyApp());
}
and I always get the same errors:
Unhandled exception:
Null check operator used on a null value
#0 IncrementalCompiler._initializeExperimentalInvalidation (package:front_end/src/fasta/incremental_compiler.dart:1226:53)
<asynchronous suspension>
#1 IncrementalCompiler.computeDelta.<anonymous closure> (package:front_end/src/fasta/incremental_compiler.dart:324:11)
<asynchronous suspension>
#2 IncrementalCompiler.compile (package:vm/incremental_compiler.dart:68:50)
<asynchronous suspension>
#3 FrontendCompiler.compile (package:frontend_server/frontend_server.dart:572:11)
<asynchronous suspension>
#4 listenAndCompile.<anonymous closure> (package:frontend_server/frontend_server.dart:1210:11)
<asynchronous suspension>
This is not Flutter's Hot reload and hot restart issue. This may occur due to the following:
Installed packages (pub).
Nullability
You should check the compatibility of some of your packages with the firebase package. Your log shows frontend_server.dart and incremental_compiler.dart contain null checks on null values.
If you are the creator of those files, you need to update the codebase by handling null this way:
if (value != null) {
// do something
}
Else
flutter pub clean cache
flutter pub get
flutter build
MissingPluginException(No implementation found for method getInstalledApps on channel installed_apps)
E/flutter ( 4648): <asynchronous suspension>
These errors are occured when i try to get the list of installed apps from installed_apps package from flutter.
This is my code:
List<AppInfo> apps = await InstalledApps.getInstalledApps();
[ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: MissingPluginException(No implementation found for method Firebase#initializeCore on channel plugins.flutter.io/firebase_core) #0 MethodChannel._invokeMethod package:flutter/…/services/platform_channel.dart:175 #1 MethodChannel.invokeListMethod package:flutter/…/services/platform_channel.dart:363 #2 MethodChannelFirebase._initializeCore package:firebase_core_platform_interface/…/method_channel/method_channel_firebase.dart:31 #3 MethodChannelFirebase.initializeApp package:firebase_core_platform_interface/…/method_channel/method_channel_firebase.dart:73 #4 Firebase.initializeApp
delete the application on your emulator (or wherever you work)
execute
flutter clean
in your working directory and rebuild the app.
flutter sometimes does not recognize plugins automatically.
I had this error and deleting app on device/simulator and installing it again helped me
I recently added quick_actions plugin works fine in debug mode but shows a blank screen in release mode.
Found these issues in the log.
[ERROR:flutter/lib/ui/ui_dart_state.cc(177)] Unhandled Exception: MissingPluginException(No implementation found for method getLaunchAction on channel plugins.flutter.io/quick_actions)
#0 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:157)
<asynchronous suspension>
#1 QuickActions.initialize (package:quick_actions/quick_actions.dart:68)
[ERROR:flutter/lib/ui/ui_dart_state.cc(177)] Unhandled Exception: MissingPluginException(No implementation found for method setShortcutItems on channel plugins.flutter.io/quick_actions)
#0 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:157)
I found the same issue for google_fonts package. As of now to remove this issue from the release mode I added shrinkResources false in the app level build.grade file of android folder. Let me know if this helps.
Unhandled Exception: MissingPluginException(No implementation found for method pickImage on channel plugins.flutter.io/image_picker)
E/flutter (16028): #0 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:159:7)
E/flutter (16028): <asynchronous suspension>
E/flutter (16028): #1 MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:334:12)
E/flutter (16028): #2 MethodChannelImagePicker.pickImagePath (package:image_picker_platform_interface/src/method_channel/method_channel_image_picker.dart:62:21)
E/flutter (16028): #3 MethodChannelImagePicker.pickImage (package:image_picker_platform_interface/src/method_channel/method_channel_image_picker.dart:30:25)
E/flutter (16028): #4 ImagePicker.getImage (package:image_picker/image_picker.dart:101:21)
STEP 1 : Ensure you have imported the plugin by including this in your pubspec.yaml file
image_picker: ^0.6.7+4
STEP 2 : Make sure you have imported the plugin in the file you need it
import 'package:image_picker/image_picker.dart';
STEP 3 : Make sure you run this command
flutter pub get
Now, many times in Flutter even after doing the above 3 steps perfectly you will get the same error.
Here is my solution that has worked for me.
STEP 1 : Run this command in the terminal
flutter clean
STEP 2 : CLOSE/STOP your emulator and start it again
99% of the time this works for me.
just click stop red icon right side of run icon. and restart app