dart_pdf
dart_pdf copied to clipboard
PrintingPlugin.java uses or overrides a deprecated API.
Describe the bug
when build android.
PrintingPlugin.java uses or overrides a deprecated API.
> flutter build apk
Running "flutter pub get" in xxx... 1,930ms
Building with sound null safety
Note: D:\dev\flutter\.pub-cache\hosted\pub.dartlang.org\printing-5.9.1\android\src\main\java\net\nfet\flutter\printing\PrintingPlugin.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Running Gradle task 'assembleRelease'... 87.5s
√ Built build\app\outputs\flutter-apk\app-release.apk (23.7MB).
To Reproduce Code snippet to reproduce the behavior:
// your code
Expected behavior
Screenshots
Flutter Doctor
> flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 3.0.5, on Microsoft Windows [Version 10.0.22000.795], locale ko-KR)
[√] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
[√] Chrome - develop for the web
[√] Visual Studio - develop for Windows (Visual Studio Community 2022 17.2.6)
[√] Android Studio (version 2021.2)
[√] VS Code (version 1.69.2)
[√] Connected device (3 available)
[√] HTTP Host Availability
• No issues found!
Desktop (please complete the following information):
- [ ] iOS
- [x] Android
- [ ] Browser
- [ ] Windows
- [ ] Linux
Smartphone (please complete the following information):
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]
Additional context
Is there any issue?
I also have the same problem now When I run the example application, this messages comes out to me.
Launching lib/main.dart on sdk gphone64 arm64 in debug mode...
Running Gradle task 'assembleDebug'...
Note: /Users/azat/Developer/SDKs/flutter/.pub-cache/hosted/pub.dartlang.org/printing-5.9.2/android/src/main/java/net/nfet/flutter/printing/PrintingPlugin.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
✓ Built build/app/outputs/flutter-apk/app-debug.apk.
Installing build/app/outputs/flutter-apk/app.apk...
Page code:
class PdfPage extends StatelessWidget {
final controller = Get.find<PdfController>();
final state = Get.find<PdfController>().state;
PdfPage({Key? key}) : super(key: key);
Future<Uint8List> _generatePdf(PdfPageFormat format, String title) async {
final pdf = pw.Document(version: PdfVersion.pdf_1_5, compress: true);
final font = await PdfGoogleFonts.nunitoExtraLight();
pdf.addPage(
pw.Page(
pageFormat: format,
build: (context) {
return pw.Column(
children: [
pw.SizedBox(
width: double.infinity,
child: pw.FittedBox(
child: pw.Text(title, style: pw.TextStyle(font: font)),
),
),
pw.SizedBox(height: 20),
pw.Flexible(child: pw.FlutterLogo())
],
);
},
),
);
return pdf.save();
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text("Services"),
leading: IconButton(
onPressed: () {
Get.back();
},
icon: const Icon(Icons.arrow_back),
),
actions: [
IconButton(
onPressed: () async {
await Printing.sharePdf(
bytes: state.file!.readAsBytesSync(),
filename: 'some.pdf');
},
icon: const Icon(Icons.share),
),
],
),
body: SafeArea(
child: GetBuilder<PdfController>(builder: (controller) {
return Container(
margin: const EdgeInsets.symmetric(vertical: 4),
child: state.fileLoaded
? PdfPreview(
build: (format) => _generatePdf(format, "sometext"),
)
: const Center(
child: CircularProgressIndicator(),
));
}),
),
);
}
}
Why is it a problem?
flutter claims that it uses or overrides a depricated plugin
Yes, it's backward compatibility with Android embedding 1
same problem, the security team always complains about this kind of messages for some reason
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days
Closing this stale issue because it has no activity.