social_share
social_share copied to clipboard
Issue: java.lang.IllegalArgumentException: Couldn't find meta-data for provider with authority com.iot_security.com.shekarmudaliyar.social_share
Hi, this is where the code is pointing the error
`FlatButton(
onPressed: () async {
final tempDir = await getTemporaryDirectory();
final file = await new File( '${tempDir.path}/image.png').create();
file.writeAsBytesSync(inviteQr);
SocialShare.shareOptions("Este convite expira em $expireTime horas",
imagePath: '${tempDir.path}/image.png');
},
child: Text("Compartilhar"))`
The log:
`E/MethodChannel#social_share(26801): Failed to handle method call
E/MethodChannel#social_share(26801): java.lang.IllegalArgumentException: Couldn't find meta-data for provider with authority com.iot_security.com.shekarmudaliyar.social_share
E/MethodChannel#social_share(26801): at androidx.core.content.FileProvider.parsePathStrategy(FileProvider.java:606)
E/MethodChannel#social_share(26801): at androidx.core.content.FileProvider.getPathStrategy(FileProvider.java:579)
E/MethodChannel#social_share(26801): at androidx.core.content.FileProvider.getUriForFile(FileProvider.java:417)
E/MethodChannel#social_share(26801): at com.shekarmudaliyar.social_share.SocialSharePlugin.onMethodCall(SocialSharePlugin.kt:110)
E/MethodChannel#social_share(26801): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:230)
E/MethodChannel#social_share(26801): at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:85)
E/MethodChannel#social_share(26801): at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:692)
E/MethodChannel#social_share(26801): at android.os.MessageQueue.nativePollOnce(Native Method)
E/MethodChannel#social_share(26801): at android.os.MessageQueue.next(MessageQueue.java:323)
E/MethodChannel#social_share(26801): at android.os.Looper.loop(Looper.java:136)
E/MethodChannel#social_share(26801): at android.app.ActivityThread.main(ActivityThread.java:6123)
E/MethodChannel#social_share(26801): at java.lang.reflect.Method.invoke(Native Method)
E/MethodChannel#social_share(26801): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
E/MethodChannel#social_share(26801): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:757)
E/flutter (26801): [ERROR:flutter/lib/ui/ui_dart_state.cc(171)] Unhandled Exception: PlatformException(error, Couldn't find meta-data for provider with authority com.iot_security.com.shekarmudaliyar.social_share, null)
E/flutter (26801): #0 StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:571:7)
E/flutter (26801): #1 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:160:18)
E/flutter (26801): <asynchronous suspension>
E/flutter (26801): #2 MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:333:12)
E/flutter (26801): #3 SocialShare.shareOptions (package:social_share/social_share.dart:217:41)
E/flutter (26801): <asynchronous suspension>
E/flutter (26801): #4 _InviteScreenState.qrCode.<anonymous closure> (package:iot_security/Screens/inviteScreen.dart:126:47)
E/flutter (26801): <asynchronous suspension>
E/flutter (26801): #5 _InviteScreenState.qrCode.<anonymous closure> (package:iot_security/Screens/inviteScreen.dart)
E/flutter (26801): #6 _InkResponseState._handleTap (package:flutter/src/material/ink_well.dart:993:19)
E/flutter (26801): #7 _InkResponseState.build.<anonymous closure> (package:flutter/src/material/ink_well.dart:1111:38)
E/flutter (26801): #8 GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:183:24)
E/flutter (26801): #9 TapGestureRecognizer.handleTapUp (package:flutter/src/gestures/tap.dart:598:11)
E/flutter (26801): #10 BaseTapGestureRecognizer._checkUp (package:flutter/src/gestures/tap.dart:287:5)
E/flutter (26801): #11 BaseTapGestureRecognizer.handlePrimaryPointer (package:flutter/src/gestures/tap.dart:222:7)
E/flutter (26801): #12 PrimaryPointerGestureRecognizer.handleEvent (package:flutter/src/gestures/recognizer.dart:476:9)
E/flutter (26801): #13 PointerRouter._dispatch (package:flutter/src/gestures/pointer_router.dart:77:12)
E/flutter (26801): #14 PointerRouter._dispatchEventToRoutes.<anonymous closure> (package:flutter/src/gestures/pointer_router.dart:122:9)
E/flutter (26801): #15 _LinkedHashMapMixin.forEach (dart:collection-patch/compact_hash.dart:377:8)
E/flutter (26801): #16 PointerRouter._dispatchEventToRoutes (package:flutter/src/gestures/pointer_router.dart:120:18)
E/flutter (26801): #17 PointerRouter.route (package:flutter/src/gestures/pointer_router.dart:106:7)
E/flutter (26801): #18 GestureBinding.handleEvent (package:flutter/src/gestures/binding.dart:219:19)
E/flutter (26801): #19 GestureBinding.dispatchEvent (package:flutter/src/gestures/binding.dart:199:22)
E/flutter (26801): #20 GestureBinding._handlePointerEvent (package:flutter/src/gestures/binding.dart:157:7)
E/flutter (26801): #21 GestureBinding._flushPointerEventQueue (package:flutter/src/gestures/binding.dart:103:7)
E/flutter (26801): #22 GestureBinding._handlePointerDataPacket (package:flutter/src/gestures/binding.dart:87:7)
E/flutter (26801): #23 _rootRunUnary (dart:async/zone.dart:1206:13)
E/flutter (26801): #24 _CustomZone.runUnary (dart:async/zone.dart:1100:19)
E/flutter (26801): #25 _CustomZone.runUnaryGuarded (dart:async/zone.dart:1005:7)
E/flutter (26801): #26 _invoke1 (dart:ui/hooks.dart:267:10)
E/flutter (26801): #27 _dispatchPointerDataPacket (dart:ui/hooks.dart:176:5)`
My android.manifest:
`<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.iot_security">
<!-- io.flutter.app.FlutterApplication is an android.app.Application that
calls FlutterMain.startInitialization(this); in its onCreate method.
In most cases you can leave this as-is, but you if you want to provide
additional functionality it is fine to subclass or reimplement
FlutterApplication and put your custom class here. -->
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:name="io.flutter.app.FlutterApplication"
android:label="iot_security"
android:icon="@mipmap/ic_launcher">
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="com.iot_security.com.shekarmudaliyar.social_share"
android:exported="false"
android:grantUriPermissions="true"
tools:replace="android:authorities">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/filepaths" />
</provider>
<activity
android:name=".MainActivity"
android:launchMode="singleTop"
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize">
<!-- Specifies an Android theme to apply to this Activity as soon as
the Android process has started. This theme is visible to the user
while the Flutter UI initializes. After that, this theme continues
to determine the Window background behind the Flutter UI. -->
<meta-data
android:name="io.flutter.embedding.android.NormalTheme"
android:resource="@style/NormalTheme"
/>
<!-- Displays an Android View that continues showing the launch screen
Drawable until Flutter paints its first frame, then this splash
screen fades out. A splash screen is useful to avoid any visual
gap between the end of Android's launch screen and the painting of
Flutter's first frame. -->
<meta-data
android:name="io.flutter.embedding.android.SplashScreenDrawable"
android:resource="@drawable/launch_background"
/>
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<!-- Don't delete the meta-data below.
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
<meta-data
android:name="flutterEmbedding"
android:value="2" />
</application>
</manifest>
`
I'm using social_share: ^2.0.5 and path_provider: ^1.6.16 between others plugins, this is the first issue I open, hope there is everything that can help, none of the solutions I found worked for me.
- Stop the app
- run in root project directory
flutter clean - run
flutter pub get - run
flutten run
That did the trick for me when I was having the same error.