-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
File sharing script crashes on Flutter 3.27.3 #5434
Comments
Hello! 👋 Have you checked whether the share_plus package version in your project needs to be updated after upgrading to Flutter 3.27.3? It might require a higher version to work correctly. |
Yes @Alezanello , I used the latest version still it crashed, I also switched to share_extend, esys_flutter_share_plus, whatsapp_share packages but it seems like shareFile mechanism itself is affected. All the packages when shareFile they crashed with: Please mark it as platform bug because ever since Flutter 3.27.3 sdk got updated this incompatibility of sharingFile mechanism started occuring. Any sharing package which shares file is facing this crash on Android devices. |
Hi @Alezanello, Please give an update about My app's update is affected and users are frustrated because they can't share PDFs, Flutter 3.27.3 has broken one of our core functionalities. One of the solutions I found online was adding a Proguard rule: Please look into this issue, everything was right before the latest Flutterflow 3.27.3 release. |
fluttercommunity/plus_plugins#2462 Hi @Alezanello, the ones who are editing code manually can do all the changes if needed, but the ones who are using flutterflow entirely to manage there code, it would be impossible for them to add rules manually to progaurd-rules.pro that's why flutterflow has to do it and for the every package user uses. please make sure the issue is sorted. check the above link for your reference. |
Thanks @suhailbilalw for pointing it out, it's exactly why currently it's beyond the control of Flutterflow users to edit proguard-rules.pro file, In any case the breaking changes occured after Flutter 3.27.3 and all the share file based packages are crashing. @Alezanello Please have a look at this issue because before the latest Flutterflow release - sharing files on Android/iOS worked fine and not even needing to think about proguard-rules.pro. Sharing file functionality is critical to my App users and it's really affecting us negatively.|\ |
Hello everyone, The team is aware of the ProGuard issues, including this one. I'll keep you updated as soon as I have any news. Thanks for your patience! |
Thanks for your support @Alezanello. |
Can we access your project?
Current Behavior
I am using
share_plus
package and I used to be able to share pdf with ease. But since 3.27.3 flutter sdk update the Share file calls are getting crashed on all Android version except Android 15 (Which hardly any of my app users currently use).02-16 17:12:35.949 15301 15902 E flutter : [ERROR:flutter/runtime/dart_vm_initializer.cc(40)] Unhandled Exception: PlatformException(Share failed, Class 'android.content.res.XmlBlock$Parser' does not implement interface 'dl.a' in call to 'int dl.a.next()' (declaration of 'd0.b' appears in /data/app/~~tveD1Z7J9DHjm2iSZXyPxA==/com.exampleapp-8Vk9iCBWOiIk60RIrHWkew==/base.apk), java.lang.IncompatibleClassChangeError: Class 'android.content.res.XmlBlock$Parser' does not implement interface 'dl.a' in call to 'int dl.a.next()' (declaration of 'd0.b' appears in /data/app/~~tveD1Z7J9DHjm2iSZXyPxA==/com.exampleapp-8Vk9iCBWOiIk60RIrHWkew==/base.apk)
02-16 17:12:35.949 15301 15902 E flutter : at d0.b.g(SourceFile:1)
02-16 17:12:35.949 15301 15902 E flutter : at d0.b.e(SourceFile:1)
02-16 17:12:35.949 15301 15902 E flutter : at d0.b.getUriForFile(SourceFile:1)
02-16 17:12:35.949 15301 15902 E flutter : at bh.b.j(SourceFile:1)
02-16 17:12:35.949 15301 15902 E flutter : at bh.b.n(SourceFile:1)
02-16 17:12:35.949 15301 15902 E flutter : at bh.a.onMethodCall(SourceFile:1)
02-16 17:12:35.949 15301 15902 E flutter : at oh.j$a.a(SourceFile:1)
02-16 17:12:35.949 15301 15902 E flutter : at fh.c.l(SourceFile:1)
02-16 17:12:35.949 15301 15902 E flutter : at fh.c.m(SourceFile:1)
02-16 17:12:35.949 15301 15902 E flutter : at fh.c.h(SourceFile:1)
02-16 17:12:35.949 15301 15902 E flutter : at fh.b.run(SourceFile:1)
02-16 17:12:35.949 15301 15902 E flutter : at android.os.Handler.handleCallback(Handler.java:958)
02-16 17:12:35.949 15301 15902 E flutter : at android.os.Handler.dispatchMessage(Handler.java:99)
02-16 17:12:35.949 15301 15902 E flutter : at android.os.Looper.loopOnce(Looper.java:257)
02-16 17:12:35.949 15301 15902 E flutter : at android.os.Looper.loop(Looper.java:368)
02-16 17:12:35.949 15301 15902 E flutter : at android.app.ActivityThread.main(ActivityThread.java:8839)
02-16 17:12:35.949 15301 15902 E flutter : at java.lang.reflect.Method.invoke(Native Method)
02-16 17:12:35.949 15301 15902 E flutter : at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:572)
02-16 17:12:35.949 15301 15902 E flutter : at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1049)
02-16 17:12:35.949 15301 15902 E flutter : , null)
02-16 17:12:35.949 15301 15902 E flutter : #0 StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:646)
02-16 17:12:35.949 15301 15902 E flutter : #1 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:334)
02-16 17:12:35.949 15301 15902 E flutter :
02-16 17:12:35.949 15301 15902 E flutter : #2 MethodChannelShare.shareXFiles (package:share_plus_platform_interface/method_channel/method_channel_share.dart:112)
02-16 17:12:35.949 15301 15902 E flutter :
02-16 17:12:35.949 15301 15902 E flutter : #3 cartPdfShare (package:sourceCode/custom_code/actions/cart_pdf_share.dart:38)
02-16 17:12:35.949 15301 15902 E flutter :
02-16 17:12:35.949 15301 15902 E flutter : #4 _BillPdfViewShareWidgetState.build. (package:g_s_t_calculator/pages/billbox/bill_pdf_view_share/bill_pdf_view_share_widget.dart:212)
02-16 17:12:35.949 15301 15902 E flutter :
02-16 17:12:35.949 15301 15902 E flutter : #5 _FlutterFlowIconButtonState.build. (package:app_package/flutter_flow/flutter_flow_icon_button.dart:156)
02-16 17:12:35.949 15301 15902 E flutter :
02-16 17:12:35.949 15301 15902 E flutter :
Expected Behavior
The shareBillPdf function used to work fine earlier, Once the 3.27.3 update of flutter was on flutterflow the sharing files functionality gets crashed.
Steps to Reproduce
You would have to add items in the App run mode and Make bill.
After making bill click on Final PDF and Click on Whatsapp button to face this error
Reproducible from Blank
Bug Report Code (Required)
IT40i/nY7cx+sO4D7qn6XfVagiMhGlwYUOdEse5RaCwqGJToPLUMPsneVFRuZr2qTGxtfU6WoDoK/PfqkvDDGOwoHE6sbbpz/pNiTzuWfHGnbqqlBc+NfW1RI5tPfxW94YmjmxNQCOhiZV4cwzv3BOuXHzHdJ7WxIlQsAMqbJdeK2SrDX1iXc2URm05KZDPz
Visual documentation
cartPdfShare custom action ->
// Automatic FlutterFlow imports
import '/backend/backend.dart';
import "package:invoicer_nfjrun/backend/schema/structs/index.dart"
as invoicer_nfjrun_data_schema;
import '/backend/schema/structs/index.dart';
import '/backend/schema/enums/enums.dart';
import '/actions/actions.dart' as action_blocks;
import "package:invoicer_nfjrun/backend/schema/structs/index.dart"
as invoicer_nfjrun_data_schema;
import "package:invoicer_nfjrun/backend/schema/enums/enums.dart"
as invoicer_nfjrun_enums;
import 'package:ff_theme/flutter_flow/flutter_flow_theme.dart';
import '/flutter_flow/flutter_flow_util.dart';
import '/custom_code/actions/index.dart'; // Imports other custom actions
import '/flutter_flow/custom_functions.dart'; // Imports custom functions
import 'package:flutter/material.dart';
// Begin custom action code
// DO NOT REMOVE OR MODIFY THE CODE ABOVE!
import 'dart:io';
import 'package:path_provider/path_provider.dart';
import 'package:share_plus/share_plus.dart';
Future cartPdfShare(FFUploadedFile pdfDoc) async {
// Add your function code here!
// Get temporary directory
final directory = await getTemporaryDirectory();
String fileName = pdfDoc.name!;
// Create a temporary file
final tempFile = File('${directory.path}/$fileName');
// Write PDF data to the file
await tempFile.writeAsBytes(pdfDoc.bytes!);
// Share the file
await Share.shareXFiles([XFile(tempFile.path)], text: 'Invoice: $fileName');
}
Environment
Additional Information
No response
The text was updated successfully, but these errors were encountered: