syncfusion / flutter-widgets

Syncfusion Flutter widgets libraries include high quality UI widgets and file-format packages to help you create rich, high-quality applications for iOS, Android, and web from a single code base.
1.55k stars 752 forks source link

Failed to find Platform SDK with path: platforms;android-31 #1982

Closed LongwayCHOW closed 1 week ago

LongwayCHOW commented 1 month ago

Bug description

My compilation environment in android studio macOS: android { compileSdk 34 ndkVersion "26.1.10909125" defaultConfig { minSdkVersion 21 targetSdkVersion 34 } } The error I encountered at first was:Failed to find Platform SDK with path: platforms;android-31

Steps to reproduce

Then I tried to force a build with sdk 34 in my build.gradle configuration: subprojects { afterEvaluate { project -> if (project.hasProperty("android")) { android { compileSdkVersion 34 defaultConfig { targetSdkVersion 34 } } } } } After doing the above, start the project in the VM and get the error message:

Launching lib/main.dart on sdk gphone64 arm64 in debug mode... Running Gradle task 'assembleDebug'... ../../../../../.pub-cache/hosted/pub.flutter-io.cn/syncfusion_flutter_pdfviewer-26.1.42/lib/src/form_fields/pdf_signature.dart:590:25: Error: Couldn't find constructor 'WidgetStatePropertyAll'. ? const WidgetStatePropertyAll(Colors.transparent) ^^^^^^^^^^^^^^^^^^^^^^ ../../../../../.pub-cache/hosted/pub.flutter-io.cn/syncfusion_flutter_core-26.1.42/lib/src/theme/theme_widget.dart:123:47: Error: The getter 'surfaceContainerHighest' isn't defined for the class 'ColorScheme'.

FAILURE: Build failed with an exception.

BUILD FAILED in 10s Error: Gradle task assembleDebug failed with exit code 1

Code sample

Code sample ```dart class EbookDetailPage extends StatefulWidget { static const String id = 'ebook_detail_page'; final String filePath; final String fileType; EbookDetailPage({required this.filePath, required this.fileType}); @override _EbookDetailPageState createState() => _EbookDetailPageState(); } class _EbookDetailPageState extends State { late Box _progressBox; late ScrollController _scrollController; late EpubController _epubController; late PdfViewerController _pdfController; @override void initState() { super.initState(); _progressBox = Hive.box('progressBox'); _scrollController = ScrollController(); double initialScrollOffset = _progressBox.get(widget.filePath, defaultValue: 0.0); WidgetsBinding.instance.addPostFrameCallback((_) { _scrollController.jumpTo(initialScrollOffset); }); _scrollController.addListener(_saveProgress); if (widget.fileType == 'epub') { _epubController = EpubController( document: EpubDocument.openFile(File(widget.filePath)), ); } else if (widget.fileType == 'pdf') { _pdfController = PdfViewerController(); } } void _saveProgress() { double currentScroll = _scrollController.position.pixels; _progressBox.put(widget.filePath, currentScroll); } @override void dispose() { _scrollController.removeListener(_saveProgress); _scrollController.dispose(); if (widget.fileType == 'epub') { _epubController.dispose(); } else if (widget.fileType == 'pdf') { _pdfController.dispose(); } super.dispose(); } @override Widget build(BuildContext context) { switch (widget.fileType) { case 'epub': return Scaffold( appBar: AppBar( title: EpubViewActualChapter( controller: _epubController, builder: (chapterValue) => Text( 'Chapter: ' + (chapterValue?.chapter?.Title ?.replaceAll('\n', '') .trim() ?? ''), textAlign: TextAlign.start, ), ), ), drawer: Drawer( child: EpubViewTableOfContents( controller: _epubController, ), ), body: EpubView( controller: _epubController, ), ); case 'pdf': return Scaffold( appBar: AppBar(title: Text('PDF ')), body: SfPdfViewer.file( File(widget.filePath), controller: _pdfController, ), ); case 'txt': return Scaffold( appBar: AppBar(title: Text('TXT')), body: FutureBuilder( future: File(widget.filePath).readAsString(), builder: (BuildContext context, AsyncSnapshot snapshot) { if (snapshot.connectionState == ConnectionState.done) { return SingleChildScrollView( controller: _scrollController, child: Text(snapshot.data ?? ' noting'), ); } else { return Center(child: CircularProgressIndicator()); } }, ), ); default: return Center(child: Text('unacceptale')); } } } ```

Screenshots or Video

Screenshots / Video demonstration image

Stack Traces

Stack Traces ```dart Launching lib/main.dart on sdk gphone64 arm64 in debug mode... Running Gradle task 'assembleDebug'... ../../../../../.pub-cache/hosted/pub.flutter-io.cn/syncfusion_flutter_pdfviewer-26.1.42/lib/src/form_fields/pdf_signature.dart:590:25: Error: Couldn't find constructor 'WidgetStatePropertyAll'. ? const WidgetStatePropertyAll(Colors.transparent) ^^^^^^^^^^^^^^^^^^^^^^ ../../../../../.pub-cache/hosted/pub.flutter-io.cn/syncfusion_flutter_core-26.1.42/lib/src/theme/theme_widget.dart:123:47: Error: The getter 'surfaceContainerHighest' isn't defined for the class 'ColorScheme'. - 'ColorScheme' is from 'package:flutter/src/material/color_scheme.dart' ('../../../../../development/flutter/packages/flutter/lib/src/material/color_scheme.dart'). Try correcting the name to the name of an existing getter, or defining a getter or field named 'surfaceContainerHighest'. surfaceVariant: themeData.colorScheme.surfaceContainerHighest, ^^^^^^^^^^^^^^^^^^^^^^^ ../../../../../.pub-cache/hosted/pub.flutter-io.cn/syncfusion_flutter_core-26.1.42/lib/src/theme/theme_widget.dart:148:47: Error: The getter 'surfaceContainerHighest' isn't defined for the class 'ColorScheme'. - 'ColorScheme' is from 'package:flutter/src/material/color_scheme.dart' ('../../../../../development/flutter/packages/flutter/lib/src/material/color_scheme.dart'). Try correcting the name to the name of an existing getter, or defining a getter or field named 'surfaceContainerHighest'. surfaceVariant: themeData.colorScheme.surfaceContainerHighest, ^^^^^^^^^^^^^^^^^^^^^^^ ../../../../../.pub-cache/hosted/pub.flutter-io.cn/syncfusion_flutter_pdfviewer-26.1.42/lib/src/control/pdfviewer_canvas.dart:605:36: Error: The getter 'WidgetStateProperty' isn't defined for the class 'CanvasRenderBox'. - 'CanvasRenderBox' is from 'package:syncfusion_flutter_pdfviewer/src/control/pdfviewer_canvas.dart' ('../../../../../.pub-cache/hosted/pub.flutter-io.cn/syncfusion_flutter_pdfviewer-26.1.42/lib/src/control/pdfviewer_canvas.dart'). Try correcting the name to the name of an existing getter, or defining a getter or field named 'WidgetStateProperty'. padding: WidgetStateProperty.all( ^^^^^^^^^^^^^^^^^^^ ../../../../../.pub-cache/hosted/pub.flutter-io.cn/syncfusion_flutter_pdfviewer-26.1.42/lib/src/control/pdfviewer_canvas.dart:638:38: Error: The getter 'WidgetStateProperty' isn't defined for the class 'CanvasRenderBox'. - 'CanvasRenderBox' is from 'package:syncfusion_flutter_pdfviewer/src/control/pdfviewer_canvas.dart' ('../../../../../.pub-cache/hosted/pub.flutter-io.cn/syncfusion_flutter_pdfviewer-26.1.42/lib/src/control/pdfviewer_canvas.dart'). Try correcting the name to the name of an existing getter, or defining a getter or field named 'WidgetStateProperty'. padding: WidgetStateProperty.all( ^^^^^^^^^^^^^^^^^^^ Target kernel_snapshot failed: Exception FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':app:compileFlutterBuildDebug'. > Process 'command '/Users/longwaychow/development/flutter/bin/flutter'' finished with non-zero exit value 1 * Try: > Run with --stacktrace option to get the stack trace. > Run with --info or --debug option to get more log output. > Run with --scan to get full insights. > Get more help at https://help.gradle.org. BUILD FAILED in 10s Error: Gradle task assembleDebug failed with exit code 1 ```

On which target platforms have you observed this bug?

Android

Flutter Doctor output

Doctor output ```console [✓] Flutter (Channel stable, 3.19.3, on macOS 14.2 23C64 darwin-arm64, locale zh-Hans-HK) [✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0) [✗] Xcode - develop for iOS and macOS ✗ Xcode installation is incomplete; a full installation is necessary for iOS and macOS development. Download at: https://developer.apple.com/xcode/ Or install Xcode via the App Store. Once installed, run: sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer sudo xcodebuild -runFirstLaunch ✗ CocoaPods not installed. CocoaPods is used to retrieve the iOS and macOS platform side's plugin code that responds to your plugin usage on the Dart side. Without CocoaPods, plugins will not work on iOS or macOS. For more info, see https://flutter.dev/platform-plugins To install see https://guides.cocoapods.org/using/getting-started.html#installation for instructions. [✓] Chrome - develop for the web [✓] Android Studio (version 2023.2) [✓] Connected device (3 available) [✓] Network resources ```
immankumarsync commented 1 month ago

@LongwayCHOW, we have migrated our source to be compatible with Flutter SDK 3.22. In Flutter SDK version 3.22, MaterialState and its related APIs have been moved out of the Material library and renamed to WidgetState.

So, we kindly request that you upgrade the Flutter SDK version to 3.22, or else use the syncfusion_flutter_pdfviewer package version below 25.2.4.

We have also shared the breaking changes documentation below for your reference. Rename MaterialState to WidgetState | Flutter

We hope it will help you resolve the issue. If you have any further queries, please get back to us.

LongwayCHOW commented 1 month ago

@LongwayCHOW, we have migrated our source to be compatible with Flutter SDK 3.22. In Flutter SDK version 3.22, MaterialState and its related APIs have been moved out of the Material library and renamed to WidgetState.

So, we kindly request that you upgrade the Flutter SDK version to 3.22, or else use the syncfusion_flutter_pdfviewer package version below 25.2.4.

We have also shared the breaking changes documentation below for your reference. Rename MaterialState to WidgetState | Flutter

We hope it will help you resolve the issue. If you have any further queries, please get back to us.

I have received the e-mail you sent and will pick it up as soon as possible, thank you for your letter and have a nice day~

Deepak1799 commented 1 week ago

@LongwayCHOW We are closing this issue since we do not have enough information to proceed further. You can reopen this anytime and share the requested details to proceed further.