exception using Flutter share module - dart

I have created a flutter app using Android Studio and am adding some code to implement the social media share function using this package [https://pub.dartlang.org/packages/share].
I modified the code so the share function is called each time the floating button is tapped/clicked.
I added share: ^0.5.3 to pub spec.yaml and import the package. I added a line to the increment counter function as follows
`
void _incrementCounter() {
Share.share('check out my website https://example.com');
setState(() {
_counter++;
});
`
Everything runs fine until I press the button and then I get the following exception:
VERBOSE-2:shell.cc(181)] Dart Error: Unhandled exception:
MissingPluginException(No implementation found for method share on channel plugins.flutter.io/share)
Any help appreciated :)

It seems that these problems are caused by the new build system Apple introduced in Xcode 10. There is more info here github.com/flutter/flutter/issues/20685#issuecomment-421511890
I have changed from the beta channel to the master channel and now have the example code provided by the Share package authors running in the simulator and on a device.

Related

Build failing for iOS: Flutter

Build on iOS fails and showing random error like,
Unhandled Exception: MissingPluginException(No implementation found for method getApplicationDocumentsDirectory on channel plugins.flutter.io/path_provider)
Can anyone share the solution? Thanks in advance.
NB: It's working on Android well.

Flutter beacons_plugin - Unhandled Exception: MissingPluginException(No implementation found for method startMonitoring on channel beacons_plugin)

I've run into this situation: the plugin and my code ran perfectly in Android, but in iOS these errors happened:
(Screenshot - my reputation is too low to post images. For easy reading I took the screenshot of VSCode debug console; the errors were the same while run it from Xcode)
https://user-images.githubusercontent.com/10349431/94634472-b2d42e80-0302-11eb-9dc7-fa2956511b82.png
It shows in the debug screenshot above exceptions took place while invoking method startMonitoring, but after I commented related codes it turned into other methods (e.g. stopMonitoring, addRegion, etc).
(BTW, the error messages may be as many as hundreds of lines - in the screenshot above, there were actually 381 lines of total error messages.)
My environment:
MacOS 10.15.7
iOS 12.4.8 (iPad) 13.3 (iPhone)
Android 8.0.0
Xcode 12.0.1 (12A7300)
VSCode 1.49.2
Android Studio 4.0.1 with all SDK after Android 5.1 Lollipop
Thanks for any help!
I got it... In this case, BeaconsPlugin.listenToBeacons should not be placed below addRegion or startMonitoring/stopMonitoring. It should be in the first line of all actions of this plugin in the initPlatformState scope, just like it has been in the example.
Sorry for dumb question.
This error mostly occurs when you try to Hot Reload or Hot Restart after just adding new package to your pubspec.yaml.
Just stop the running project(app) and then freshly run it again. So that the added package(which contains the implementations) also pushed to the device
please check : https://stackoverflow.com/a/60088062/11989529
and this : MissingPluginException while using plugin for flutter
the same problem

IllegalAccessError on Android Things

My app is throwing an IllegalAccessError after updating to the latest Android Things
preview. I have the following code to check for an OTA update:
UpdateManager manager = new UpdateManager();
manager.performUpdateNow(UpdateManager.POLICY_CHECKS_ONLY);
When I run this code I get the following error output:
java.lang.IllegalAccessError: Method 'void com.google.android.things.update.UpdateManager.<init>()' is inaccessible to class 'com.example.android.things.screensettings.MainActivity' (...)
This code was working before, why has this started happening after the update?
Starting in Preview 7, Android Things API services are not constructed as new
instances. They are instead accessed as singletons via getInstance() to be
more in line with Android API paradigms.
Be sure to update your app to use the Preview 7 SDK:
dependencies {
compileOnly 'com.google.android.things:androidthings:0.7-devpreview'
}
Then modify your code to use getInstance() instead:
UpdateManager manager = UpdateManager.getInstance();
manager.performUpdateNow(UpdateManager.POLICY_CHECKS_ONLY);
Review the Android Things API reference
to verify if any of the other APIs you are calling have changed.

Error: Cannot read property 'logPurchase' of undefined when setting up React Native Facebook SDK

I'm trying to setup the React Native FBSDK for our app. I followed the installation instructions for iOS. Then tried to test it with the following snippet found in the documentation here (https://github.com/facebook/react-native-fbsdk#analytics-for-apps) but modified for my app.
import FBSDK from 'react-native-fbsdk';
Then in the componentDidMount..
const {
AppEventsLogger,
} = FBSDK;
console.log('AppEventsLogger.logPurchase', AppEventsLogger.logPurchase);
AppEventsLogger.logPurchase(15, 'USD', {'param': 'value'});
When I do, I see the logPurchase function in the React Native Debugger console (see screenshot), but immediately after when I try to invoke the function, I get the error Cannot read property 'logPurchase' of undefined. Also tested with other methods in that file like logEvent with same results.
Screenshot of logPurchase and error in console:
Anyone know why I might be getting this error, even though the function appears to be there?

Initialization Errors with React Native Tutorials

I just installed React Native, and am attempting to follow tutorials on the React Native website to get accustomed to it. However every tutorial I end up doing just gives me a big red error screen in the iOS Simulator.
As an example, I followed the "Hello World" tutorial on the React Native website
import React, { Component } from 'react';
import { AppRegistry, Text } from 'react-native';
class HelloWorldApp extends Component {
render() {
return (
<Text>Hello world!</Text>
);
}
}
AppRegistry.registerComponent('HelloWorldApp', () => HelloWorldApp);
but am met with this error after compiling and running in the simulator"
"Application TestProject has not been registered. This is either due to a require() error during initialization or failure to call AppRegistry.registerComponent"
I'm confused because I know nothing yet about RN, am following their tutorials to the letter, and am getting errors.
Please advise?
There might be two possibilities as I know of:
When you run react-native run-ios the packager didn't start automatically. If that's the case, Run the Packager Manually. To do so:
In one Tab of your terminal run react-native start and in another run react-native run-ios.
Or while following the document from react native's site, you might have changed the app's name. Like:
You created a project using react-native init AwesomeProject. The Project's name here is AwesomeProject.
And then changed your default index.ios.js and replaced the Component's name with HelloWorldApp.
class HelloWorldApp extends Component
AppRegistry.registerComponent('HelloWorldApp', () => HelloWorldApp);

Resources