How to save assets images in phones gallery? Using gallery_saver plugin - flutter

Hey I am using https://pub.dev/packages/gallery_saver plugin and I have assets images in my app using I am trying to save in phones gallery. I am doing something like this but failed. Anyone pls help me
void _saveNetworkImage() async {
Directory tempDir = await getTemporaryDirectory();
String tempPath = tempDir.path;
String path = tempPath + '/' + widget.imagePath; // widget.imgPath = "assets/images/my image.jpg";
print('ddd' + path);
GallerySaver.saveImage(path).then((bool success) {
setState(() {
print('Image is saved');
});
});
}
}
I am calling ablove function as :
floatingActionButton: FloatingActionButton.extended(
onPressed: _saveNetworkImage,
icon: Icon(Icons.save),
label: Text('Gallery'),
backgroundColor: Colors.white54,
foregroundColor: Colors.black,
)
Here my function is running but giving error
D/ViewRootImpl#cbdf65[MainActivity]( 3518): ViewPostIme pointer 1
I/flutter ( 3518): path/data/user/0/com.thesachin.template/cache
I/flutter ( 3518): ddd/data/user/0/com.thesachin.template/cache/assets/images/aaj nhi kal karenge.jpg
E/AndroidRuntime( 3518): FATAL EXCEPTION: DefaultDispatcher-worker-1
E/AndroidRuntime( 3518): Process: com.thesachin.template, PID: 3518
E/AndroidRuntime( 3518): java.io.FileNotFoundException: /data/user/0/com.thesachin.template/cache/assets/images/aaj nhi kal karenge.jpg (No such file or directory)
E/AndroidRuntime( 3518): at java.io.FileInputStream.open0(Native Method)
E/AndroidRuntime( 3518): at java.io.FileInputStream.open(FileInputStream.java:231)
E/AndroidRuntime( 3518): at java.io.FileInputStream.<init>(FileInputStream.java:165)
E/AndroidRuntime( 3518): at carnegietechnologies.gallery_saver.FileUtils.getBytesFromFile(FileUtils.kt:216)
E/AndroidRuntime( 3518): at carnegietechnologies.gallery_saver.FileUtils.insertImage(FileUtils.kt:47)
E/AndroidRuntime( 3518): at carnegietechnologies.gallery_saver.GallerySaver$saveMediaFile$1$success$1.invokeSuspend(GallerySaver.kt:69)
E/AndroidRuntime( 3518): at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
E/AndroidRuntime( 3518): at kotlinx.coroutines.DispatchedTask.run(Dispatched.kt:238)
E/AndroidRuntime( 3518): at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:594)
E/AndroidRuntime( 3518): at kotlinx.coroutines.scheduling.CoroutineScheduler.access$runSafely(CoroutineScheduler.kt:60)
E/AndroidRuntime( 3518): at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:742)
D/ViewRootImpl#cbdf65[MainActivity]( 3518): MSG_WINDOW_FOCUS_CHANGED 0 1
D/InputMethodManager( 3518): prepareNavigationBarInfo() DecorView#460d1a9[MainActivity]
D/InputMethodManager( 3518): getNavigationBarColor() -855310
I/Process ( 3518): Sending signal. PID: 3518 SIG: 9
Lost connection to device.

Finally got it with https://pub.dev/packages/image_gallery_saver. Here is my working code:
void _saveNetworkImage() async {
final bytes = await rootBundle.load(widget.imagePath); // imagePath like "assets/images/my_image.jpg"
Uint8List clockBytes = bytes.buffer.asUint8List();
final result = ImageGallerySaver.saveImage(clockBytes);
print(result);
}
}

Related

my app crash because OkHttpChannelBuilder?

I have some users who have my production app who crash when he interact with. I have no idea where the problem come from.
Fatal Exception: java.lang.RuntimeException: Internal error in Cloud Firestore (24.2.2).
at com.google.firebase.firestore.util.AsyncQueue.lambda$panic$3(AsyncQueue.java:1)
at com.google.firebase.firestore.util.-$$Lambda$AsyncQueue$jx84dqgUsF4ojecSMurRqFLFD1Y.run(-.java:1)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:236)
at android.app.ActivityThread.main(ActivityThread.java:8051)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:620)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1011)
Caused by g.c.a.b.h.j: java.lang.RuntimeException: java.lang.ExceptionInInitializerError
at com.google.android.gms.tasks.zzw.getResult(zzw.java:3)
at com.google.firebase.firestore.remote.FirestoreChannel.lambda$runBidiStreamingRpc$0(FirestoreChannel.java:1)
at com.google.firebase.firestore.remote.-$$Lambda$FirestoreChannel$ThFui-hvcsrVGYxlBtcTH5vVbvE.onComplete(-.java:6)
at com.google.android.gms.tasks.zzi.run(zzi.java:21)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:462)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:301)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at com.google.firebase.firestore.util.AsyncQueue$SynchronizedShutdownAwareExecutor$DelayedStartFactory.run(AsyncQueue.java:15)
at java.lang.Thread.run(Thread.java:923)
Caused by java.lang.ExceptionInInitializerError:
at io.grpc.okhttp.OkHttpChannelBuilder.forTarget(OkHttpChannelBuilder.java)
at io.grpc.okhttp.OkHttpChannelProvider.builderForTarget(OkHttpChannelProvider.java:1)
at io.grpc.ManagedChannelBuilder.forTarget(ManagedChannelBuilder.java:2)
at com.google.firebase.firestore.remote.GrpcCallProvider.initChannel(GrpcCallProvider.java:2)
at com.google.firebase.firestore.remote.-$$Lambda$GrpcCallProvider$SCD5iiibQ8l4haiO8ofSfE0wIJg.call(-.java:2)
at com.google.android.gms.tasks.zzz.run(zzz.java:4)
at com.google.firebase.firestore.util.ThrottledForwardingExecutor.lambda$execute$0(ThrottledForwardingExecutor.java:1)
at com.google.firebase.firestore.util.-$$Lambda$ThrottledForwardingExecutor$MfIJbVuxZtLwosAgPzPA-cU66Ko.run(-.java:4)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:923)
Caused by java.lang.RuntimeException: java.lang.NoSuchMethodException: j.b.I1.values []
at java.lang.Enum.enumValues(Enum.java:270)
at java.lang.Enum.access$000(Enum.java:61)
at java.lang.Enum$1.create(Enum.java:277)
at java.lang.Enum$1.create(Enum.java:275)
at libcore.util.BasicLruCache.get(BasicLruCache.java:63)
at java.lang.Enum.getSharedConstants(Enum.java:289)
at java.lang.Class.getEnumConstantsShared(Class.java:2428)
at java.util.EnumSet.getUniverse(EnumSet.java:407)
at java.util.EnumSet.noneOf(EnumSet.java:109)
at java.util.EnumSet.of(EnumSet.java:235)
at io.grpc.okhttp.OkHttpChannelBuilder.<clinit>(OkHttpChannelBuilder.java:91)
at io.grpc.okhttp.OkHttpChannelBuilder.forTarget(OkHttpChannelBuilder.java)
at io.grpc.okhttp.OkHttpChannelProvider.builderForTarget(OkHttpChannelProvider.java:1)
at io.grpc.ManagedChannelBuilder.forTarget(ManagedChannelBuilder.java:2)
at com.google.firebase.firestore.remote.GrpcCallProvider.initChannel(GrpcCallProvider.java:2)
at com.google.firebase.firestore.remote.-$$Lambda$GrpcCallProvider$SCD5iiibQ8l4haiO8ofSfE0wIJg.call(-.java:2)
at com.google.android.gms.tasks.zzz.run(zzz.java:4)
at com.google.firebase.firestore.util.ThrottledForwardingExecutor.lambda$execute$0(ThrottledForwardingExecutor.java:1)
at com.google.firebase.firestore.util.-$$Lambda$ThrottledForwardingExecutor$MfIJbVuxZtLwosAgPzPA-cU66Ko.run(-.java:4)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:923)
Caused by java.lang.NoSuchMethodException: j.b.I1.values []
at java.lang.Class.getMethod(Class.java:2072)
at java.lang.Class.getDeclaredMethod(Class.java:2050)
at java.lang.Enum.enumValues(Enum.java:267)
at java.lang.Enum.access$000(Enum.java:61)
at java.lang.Enum$1.create(Enum.java:277)
at java.lang.Enum$1.create(Enum.java:275)
at libcore.util.BasicLruCache.get(BasicLruCache.java:63)
at java.lang.Enum.getSharedConstants(Enum.java:289)
at java.lang.Class.getEnumConstantsShared(Class.java:2428)
at java.util.EnumSet.getUniverse(EnumSet.java:407)
at java.util.EnumSet.noneOf(EnumSet.java:109)
at java.util.EnumSet.of(EnumSet.java:235)
at io.grpc.okhttp.OkHttpChannelBuilder.<clinit>(OkHttpChannelBuilder.java:91)
at io.grpc.okhttp.OkHttpChannelBuilder.forTarget(OkHttpChannelBuilder.java)
at io.grpc.okhttp.OkHttpChannelProvider.builderForTarget(OkHttpChannelProvider.java:1)
at io.grpc.ManagedChannelBuilder.forTarget(ManagedChannelBuilder.java:2)
at com.google.firebase.firestore.remote.GrpcCallProvider.initChannel(GrpcCallProvider.java:2)
at com.google.firebase.firestore.remote.-$$Lambda$GrpcCallProvider$SCD5iiibQ8l4haiO8ofSfE0wIJg.call(-.java:2)
at com.google.android.gms.tasks.zzz.run(zzz.java:4)
at com.google.firebase.firestore.util.ThrottledForwardingExecutor.lambda$execute$0(ThrottledForwardingExecutor.java:1)
at com.google.firebase.firestore.util.-$$Lambda$ThrottledForwardingExecutor$MfIJbVuxZtLwosAgPzPA-cU66Ko.run(-.java:4)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:923)

FlutterNaverLogin Error when press the button

2022-11-23 16:22:26.428 688-688/? W/keymaster_tee: [WRN]begin req PARAMS: A32 B32 P1
2022-11-23 16:22:26.431 687-29628/? I/keystore2: keystore2::security_level: In create_operation. Success to create IKeystoreOperation. 10565, None
2022-11-23 16:22:26.433 688-688/? W/keymaster_tee: [WRN]Cmd 10, err -30
2022-11-23 16:22:26.433 687-29628/? E/keystore2: keystore2::error: In KeystoreOperation::finish
Caused by:
0: In finish: KeyMint::finish failed.
1: Error::Km(ErrorCode(-30))
2022-11-23 16:22:26.434 7907-7907/? W/b: encountered a potentially transient KeyStore error, will wait and retry
javax.crypto.AEADBadTagException
at android.security.keystore2.AndroidKeyStoreCipherSpiBase.engineDoFinal(AndroidKeyStoreCipherSpiBase.java:617)
at javax.crypto.Cipher.doFinal(Cipher.java:2114)
at f.d.c.a.v.a.b.c(Unknown Source:32)
at f.d.c.a.v.a.b.b(Unknown Source:0)
at f.d.c.a.i.c(Unknown Source:11)
at f.d.c.a.i.j(Unknown Source:9)
at f.d.c.a.v.a.a$b.e(Unknown Source:6)
at f.d.c.a.v.a.a$b.f(Unknown Source:0)
at f.d.c.a.v.a.a$b.d(Unknown Source:11)
at e.m.a.a.b(Unknown Source:47)
at e.m.a.a.a(Unknown Source:4)
at com.navercorp.nid.oauth.a.h(Unknown Source:14)
at com.navercorp.nid.oauth.a.b(Unknown Source:0)
at com.navercorp.nid.oauth.a$a.a(Unknown Source:2)
at com.navercorp.nid.oauth.a$a.invoke(Unknown Source:0)
at kotlin.t.getValue(Unknown Source:22)
at com.navercorp.nid.oauth.a.f(Unknown Source:2)
at com.navercorp.nid.oauth.a.d(Unknown Source:6)
at com.navercorp.nid.oauth.h.c(Unknown Source:5)
at f.g.a.a.i(Unknown Source:0)
at f.g.a.a.a(Unknown Source:15)
at f.j.a.b.d(Unknown Source:18)
at f.j.a.b.onMethodCall(Unknown Source:20)
at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(Unknown Source:17)
at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(Unknown Source:18)
at io.flutter.embedding.engine.dart.DartMessenger.a(Unknown Source:20)
at io.flutter.embedding.engine.dart.a.run(Unknown Source:12)
at android.os.Handler.handleCallback(Handler.java:942)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:226)
at android.os.Looper.loop(Looper.java:313)
at android.app.ActivityThread.main(ActivityThread.java:8741)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1067)
Caused by: android.security.KeyStoreException: Signature/MAC verification failed (internal Keystore code: -30 message: In KeystoreOperation::finish
Caused by:
0: In finish: KeyMint::finish failed.
1: Error::Km(ErrorCode(-30))) (public error code: 10 internal Keystore code: -30)
at android.security.KeyStore2.getKeyStoreException(KeyStore2.java:418)
at android.security.KeyStoreOperation.handleExceptions(KeyStoreOperation.java:78)
at android.security.KeyStoreOperation.finish(KeyStoreOperation.java:128)
at android.security.keystore2.KeyStoreCryptoOperationChunkedStreamer$MainDataStream.finish(KeyStoreCryptoOperationChunkedStreamer.java:228)
at android.security.keystore2.KeyStoreCryptoOperationChunkedStreamer.doFinal(KeyStoreCryptoOperationChunkedStreamer.java:181)
at android.security.keystore2.AndroidKeyStoreAuthenticatedAESCipherSpi$BufferAllOutputUntilDoFinalStreamer.doFinal(AndroidKeyStoreAuthenticatedAESCipherSpi.java:396)
at android.security.keystore2.AndroidKeyStoreCipherSpiBase.engineDoFinal(AndroidKeyStoreCipherSpiBase.java:609)
... 34 more
2022-11-23 16:22:26.443 688-688/? W/keymaster_tee: [WRN]begin req PARAMS: A32 B32 P1
2022-11-23 16:22:26.446 687-29628/? I/keystore2: keystore2::security_level: In create_operation. Success to create IKeystoreOperation. 10565, None
2022-11-23 16:22:26.449 688-688/? W/keymaster_tee: [WRN]Cmd 10, err -30
2022-11-23 16:22:26.450 687-29628/? E/keystore2: keystore2::error: In KeystoreOperation::finish
Caused by:
0: In finish: KeyMint::finish failed.
1: Error::Km(ErrorCode(-30))
2022-11-23 16:22:26.450 7907-7907/? W/a: cannot decrypt keyset:
javax.crypto.AEADBadTagException
at android.security.keystore2.AndroidKeyStoreCipherSpiBase.engineDoFinal(AndroidKeyStoreCipherSpiBase.java:617)
at javax.crypto.Cipher.doFinal(Cipher.java:2114)
at f.d.c.a.v.a.b.c(Unknown Source:32)
at f.d.c.a.v.a.b.b(Unknown Source:18)
at f.d.c.a.i.c(Unknown Source:11)
at f.d.c.a.i.j(Unknown Source:9)
at f.d.c.a.v.a.a$b.e(Unknown Source:6)
at f.d.c.a.v.a.a$b.f(Unknown Source:0)
at f.d.c.a.v.a.a$b.d(Unknown Source:11)
at e.m.a.a.b(Unknown Source:47)
at e.m.a.a.a(Unknown Source:4)
at com.navercorp.nid.oauth.a.h(Unknown Source:14)
at com.navercorp.nid.oauth.a.b(Unknown Source:0)
at com.navercorp.nid.oauth.a$a.a(Unknown Source:2)
at com.navercorp.nid.oauth.a$a.invoke(Unknown Source:0)
at kotlin.t.getValue(Unknown Source:22)
at com.navercorp.nid.oauth.a.f(Unknown Source:2)
at com.navercorp.nid.oauth.a.d(Unknown Source:6)
at com.navercorp.nid.oauth.h.c(Unknown Source:5)
at f.g.a.a.i(Unknown Source:0)
at f.g.a.a.a(Unknown Source:15)
at f.j.a.b.d(Unknown Source:18)
at f.j.a.b.onMethodCall(Unknown Source:20)
at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(Unknown Source:17)
at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(Unknown Source:18)
at io.flutter.embedding.engine.dart.DartMessenger.a(Unknown Source:20)
at io.flutter.embedding.engine.dart.a.run(Unknown Source:12)
at android.os.Handler.handleCallback(Handler.java:942)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:226)
at android.os.Looper.loop(Looper.java:313)
at android.app.ActivityThread.main(ActivityThread.java:8741)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1067)
Caused by: android.security.KeyStoreException: Signature/MAC verification failed (internal Keystore code: -30 message: In KeystoreOperation::finish
Caused by:
0: In finish: KeyMint::finish failed.
1: Error::Km(ErrorCode(-30))) (public error code: 10 internal Keystore code: -30)
at android.security.KeyStore2.getKeyStoreException(KeyStore2.java:418)
at android.security.KeyStoreOperation.handleExceptions(KeyStoreOperation.java:78)
at android.security.KeyStoreOperation.finish(KeyStoreOperation.java:128)
at android.security.keystore2.KeyStoreCryptoOperationChunkedStreamer$MainDataStream.finish(KeyStoreCryptoOperationChunkedStreamer.java:228)
at android.security.keystore2.KeyStoreCryptoOperationChunkedStreamer.doFinal(KeyStoreCryptoOperationChunkedStreamer.java:181)
at android.security.keystore2.AndroidKeyStoreAuthenticatedAESCipherSpi$BufferAllOutputUntilDoFinalStreamer.doFinal(AndroidKeyStoreAuthenticatedAESCipherSpi.java:396)
at android.security.keystore2.AndroidKeyStoreCipherSpiBase.engineDoFinal(AndroidKeyStoreCipherSpiBase.java:609)
... 34 more
2022-11-23 16:22:26.451 7907-7907/? E/DartMessenger: Uncaught exception in binary message listener
f.d.c.a.z.a.c0: Protocol message contained an invalid tag (zero).
at f.d.c.a.z.a.z.K(Unknown Source:74)
at f.d.c.a.z.a.z.G(Unknown Source:2)
at f.d.c.a.y.c0.X(Unknown Source:2)
at f.d.c.a.v.a.d.a(Unknown Source:8)
at f.d.c.a.b.a(Unknown Source:0)
at f.d.c.a.v.a.a$b.e(Unknown Source:29)
at f.d.c.a.v.a.a$b.f(Unknown Source:0)
at f.d.c.a.v.a.a$b.d(Unknown Source:11)
at e.m.a.a.b(Unknown Source:47)
at e.m.a.a.a(Unknown Source:4)
at com.navercorp.nid.oauth.a.h(Unknown Source:14)
at com.navercorp.nid.oauth.a.b(Unknown Source:0)
at com.navercorp.nid.oauth.a$a.a(Unknown Source:2)
at com.navercorp.nid.oauth.a$a.invoke(Unknown Source:0)
at kotlin.t.getValue(Unknown Source:22)
at com.navercorp.nid.oauth.a.f(Unknown Source:2)
at com.navercorp.nid.oauth.a.d(Unknown Source:6)
at com.navercorp.nid.oauth.h.c(Unknown Source:5)
at f.g.a.a.i(Unknown Source:0)
at f.g.a.a.a(Unknown Source:15)
at f.j.a.b.d(Unknown Source:18)
at f.j.a.b.onMethodCall(Unknown Source:20)
at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(Unknown Source:17)
at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(Unknown Source:18)
at io.flutter.embedding.engine.dart.DartMessenger.a(Unknown Source:20)
at io.flutter.embedding.engine.dart.a.run(Unknown Source:12)
at android.os.Handler.handleCallback(Handler.java:942)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:226)
at android.os.Looper.loop(Looper.java:313)
at android.app.ActivityThread.main(ActivityThread.java:8741)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1067)
2022-11-23 16:22:26.451 7907-7966/? I/flutter: naver login error MissingPluginException(No implementation found for method logIn on channel flutter_naver_login)
If I try to login with Naver, I see this log and get an error.
Appears only on one specific device (Galaxy S21)
Other Galaxy s21s do not generate errors, but only on one device.
If you press the button, it doesn't respond.
I think FlutterNaverLogin.login() doesn't work when I press the Login button.

App using flutter_inappwebview Crash after calling from out main.dart

I am using flutter_inappwebview: ^5.3.2 for implementation 3rd part payment gateway when I call the method from main.dart its running and working
but when I call it from other like cart.dart,checkout.dart, urwaypayment.dart The App crash immediately before Webview appear
this is the Calling method
result = await Navigator.of(context).push(
MaterialPageRoute<String>(builder: (BuildContext context) {
return new TransactPage(inURL: compURL);
}));
and this error meassage
I/Dialog (30035): mIsSamsungBasicInteraction = false, isMetaDataInActivity = false
W/Gralloc4(30035): allocator 3.x is not supported
W/Gralloc3(30035): allocator 3.x is not supported
W/com.amart1.app(30035): Accessing hidden method Lcom/android/org/conscrypt/OpenSSLSocketImpl;->setUseSessionTickets(Z)V (greylist-max-q,core-platform-api, reflection, denied)
E/AndroidRuntime(30035): FATAL EXCEPTION: main
E/AndroidRuntime(30035): Process: com.amart1.app, PID: 30035
E/AndroidRuntime(30035): java.lang.ExceptionInInitializerError
E/AndroidRuntime(30035): at okhttp3.OkHttpClient.(OkHttpClient.kt:211)
E/AndroidRuntime(30035): at okhttp3.OkHttpClient.(OkHttpClient.kt:204)
E/AndroidRuntime(30035): at com.pichillilorenzo.flutter_inappwebview.in_app_webview.InAppWebView.prepare(InAppWebView.java:184)
E/AndroidRuntime(30035): at com.pichillilorenzo.flutter_inappwebview.in_app_webview.FlutterWebView.(FlutterWebView.java:94)
E/AndroidRuntime(30035): at com.pichillilorenzo.flutter_inappwebview.in_app_webview.FlutterWebViewFactory.create(FlutterWebViewFactory.java:26)
E/AndroidRuntime(30035): at io.flutter.plugin.platform.SingleViewPresentation.onCreate(SingleViewPresentation.java:186)
E/AndroidRuntime(30035): at android.app.Dialog.dispatchOnCreate(Dialog.java:708)
E/AndroidRuntime(30035): at android.app.Dialog.show(Dialog.java:422)
E/AndroidRuntime(30035): at android.app.Presentation.show(Presentation.java:285)
E/AndroidRuntime(30035): at io.flutter.plugin.platform.VirtualDisplayController.(VirtualDisplayController.java:95)
E/AndroidRuntime(30035): at io.flutter.plugin.platform.VirtualDisplayController.create(VirtualDisplayController.java:48)
E/AndroidRuntime(30035): at io.flutter.plugin.platform.PlatformViewsController$1.createVirtualDisplayForPlatformView(PlatformViewsController.java:207)
E/AndroidRuntime(30035): at io.flutter.embedding.engine.systemchannels.PlatformViewsChannel$1.create(PlatformViewsChannel.java:104)
E/AndroidRuntime(30035): at io.flutter.embedding.engine.systemchannels.PlatformViewsChannel$1.onMethodCall(PlatformViewsChannel.java:59)
E/AndroidRuntime(30035): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:233)
E/AndroidRuntime(30035): at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:85)
E/AndroidRuntime(30035): at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:818)
E/AndroidRuntime(30035): at android.os.MessageQueue.nativePollOnce(Native Method)
E/AndroidRuntime(30035): at android.os.MessageQueue.next(MessageQueue.java:335)
E/AndroidRuntime(30035): at android.os.Looper.loop(Looper.java:206)
E/AndroidRuntime(30035): at android.app.ActivityThread.main(ActivityThread.java:8512)
E/AndroidRuntime(30035): at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(30035): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602)
E/AndroidRuntime(30035): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)
E/AndroidRuntime(30035): Caused by: java.lang.IllegalStateException: Expected Android API level 21+ but was 30
E/AndroidRuntime(30035): at okhttp3.internal.platform.AndroidPlatform$Companion.buildIfSupported(AndroidPlatform.kt:370)
E/AndroidRuntime(30035): at okhttp3.internal.platform.Platform$Companion.findPlatform(Platform.kt:204)
E/AndroidRuntime(30035): at okhttp3.internal.platform.Platform$Companion.access$findPlatform(Platform.kt:178)
E/AndroidRuntime(30035): at okhttp3.internal.platform.Platform.(Platform.kt:179)
E/AndroidRuntime(30035): ... 24 more
I/Process (30035): Sending signal. PID: 30035 SIG: 9
Lost connection to device.

how to solve FATAL EXCEPTION: AsyncTask #2 in flutter

I am using video_editor package in flutter. When I at debug mode it works and no error but when I release the apk, the apps clash and show the error :
D/flutter-ffmpeg(10753): Getting media information for /data/user/0/com.example.apps/cache/file_picker/Screenrecorder-2021-05-19-15-53-57-515.mp4.
E/AndroidRuntime(10753): FATAL EXCEPTION: AsyncTask #2
E/AndroidRuntime(10753): Process: com.example.apps, PID: 10753
E/AndroidRuntime(10753): java.lang.RuntimeException: An error occurred while executing doInBackground()
E/AndroidRuntime(10753): at android.os.AsyncTask$4.done(AsyncTask.java:399)
E/AndroidRuntime(10753): at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:383)
E/AndroidRuntime(10753): at java.util.concurrent.FutureTask.setException(FutureTask.java:252)
E/AndroidRuntime(10753): at java.util.concurrent.FutureTask.run(FutureTask.java:271)
E/AndroidRuntime(10753): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
E/AndroidRuntime(10753): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
E/AndroidRuntime(10753): at java.lang.Thread.run(Thread.java:919)
E/AndroidRuntime(10753): Caused by: java.lang.UnsatisfiedLinkError: Bad JNI version returned from JNI_OnLoad in "/data/app/com.example.apps-QO20kuBv0uYvExYVArrO7A==/lib/arm64/libmobileffmpeg.so": 0
E/AndroidRuntime(10753): at java.lang.Runtime.loadLibrary0(Runtime.java:1071)
E/AndroidRuntime(10753): at java.lang.Runtime.loadLibrary0(Runtime.java:1007)
E/AndroidRuntime(10753): at java.lang.System.loadLibrary(System.java:1667)
E/AndroidRuntime(10753): at com.arthenica.mobileffmpeg.Config.<clinit>(Unknown Source:148)
E/AndroidRuntime(10753): at com.arthenica.mobileffmpeg.Config.nativeFFprobeExecute(Native Method)
E/AndroidRuntime(10753): at com.arthenica.mobileffmpeg.f.a(Unknown Source:0)
E/AndroidRuntime(10753): at com.arthenica.mobileffmpeg.f.b(Unknown Source:0)
E/AndroidRuntime(10753): at com.arthenica.mobileffmpeg.f.a(Unknown Source:48)
E/AndroidRuntime(10753): at c.b.a.a.c.a(Unknown Source:21)
E/AndroidRuntime(10753): at c.b.a.a.c.doInBackground(Unknown Source:2)
E/AndroidRuntime(10753): at android.os.AsyncTask$3.call(AsyncTask.java:378)
E/AndroidRuntime(10753): at java.util.concurrent.FutureTask.run(FutureTask.java:266)
E/AndroidRuntime(10753): ... 3 more
Does anyone know how to solve this error?
Please check that all required dependencies are included within "dependencies:" in pubspec.yaml. Dependencies declared inside "dev_dependencies:" are not included in released app
Add the following entries into your proguard-rules.pro file. If you don't have this file you can create and put in app folder.
-keep class com.arthenica.mobileffmpeg.Config {
native <methods>;
void log(long, int, byte[]);
void statistics(long, int, float, float, long , int, double, double);
}
-keep class com.arthenica.mobileffmpeg.AbiDetect {
native <methods>;
}

Facebook Messenger SDK for Android: crash when sharing a URL

I need to use the Facebook Messenger SDK in an Android app. I want to send a URL, just as text. Since ShareToMessengerParams is too limited, I was forced to manually construct an intent as shown at https://developers.facebook.com/docs/messenger/android#integration_with_intents:
private static final String EXTRA_PROTOCOL_VERSION = "com.facebook.orca.extra.PROTOCOL_VERSION";
private static final String EXTRA_APP_ID = "com.facebook.orca.extra.APPLICATION_ID";
private static final int PROTOCOL_VERSION = 20150314;
private static final String YOUR_APP_ID = "[YOUR_FACEBOOK_APP_ID]";
private static final int SHARE_TO_MESSENGER_REQUEST_CODE = 1;
...
String mimeType = "text/plain";
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setPackage("com.facebook.orca");
intent.setType(mimeType);
intent.putExtra(Intent.EXTRA_TEXT, [MY_STRING_URL]);
intent.putExtra(EXTRA_PROTOCOL_VERSION, PROTOCOL_VERSION);
intent.putExtra(EXTRA_APP_ID, YOUR_APP_ID);
activity.startActivityForResult(shareIntent, SHARE_TO_MESSENGER_REQUEST_CODE);
This crashes with:
E/AndroidRuntime( 2429): FATAL EXCEPTION: main
E/AndroidRuntime( 2429): java.lang.ClassCastException: com.facebook.messaging.sharing.f cannot be cast to com.facebook.messaging.sharing.bs
E/AndroidRuntime( 2429): at com.facebook.messaging.sharing.cz.a(ShareLauncherActivity.java:294)
E/AndroidRuntime( 2429): at com.facebook.messaging.sharing.cz.onSuccess(ShareLauncherActivity.java:286)
E/AndroidRuntime( 2429): at com.google.common.f.a.q.run(Futures.java:1231)
E/AndroidRuntime( 2429): at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:442)
E/AndroidRuntime( 2429): at com.facebook.common.executors.dv.run(WrappingExecutorService.java:77)
E/AndroidRuntime( 2429): at android.os.Handler.handleCallback(Handler.java:615)
E/AndroidRuntime( 2429): at android.os.Handler.dispatchMessage(Handler.java:92)
E/AndroidRuntime( 2429): at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime( 2429): at android.app.ActivityThread.main(ActivityThread.java:4745)
E/AndroidRuntime( 2429): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 2429): at java.lang.reflect.Method.invoke(Method.java:511)
E/AndroidRuntime( 2429): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
E/AndroidRuntime( 2429): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
E/AndroidRuntime( 2429): at dalvik.system.NativeStart.main(Native Method)
W/ActivityManager( 312): Force finishing activity com.facebook.orca/com.facebook.messaging.sharing.ShareLauncherActivity
If I add:
intent.putExtra(Intent.EXTRA_STREAM, contentUri);
it doesn't crash but since my URL is just a link and does not point to a file, I get various errors: that the content could not be found, or, if I put a fake contentUri, the real URL I want to share is not activated upon clicking. If I remove:
intent.putExtra(EXTRA_APP_ID, YOUR_APP_ID);
it doesn't crash either but then users who have not installed my app (from which the sharing is done) do not get the Facebook Messenger "Install" button.
How can I share a web link and at the same time have users get the "Install" and "Reply" buttons as needed?