cbl-dart / cbl-dart

Couchbase Lite for Dart and Flutter
https://cbl-dart.dev
Apache License 2.0
115 stars 18 forks source link

Build fails on Flutter 3.24.0 (dart 3.5.0) #598

Closed tomas-mazak closed 1 week ago

tomas-mazak commented 1 month ago

Describe the bug

Build of the flutter project fails on cbl package:

$ flutter build apk  

You are applying Flutter's app_plugin_loader Gradle plugin imperatively using the apply script method, which is deprecated and will be removed in a future release. Migrate to applying Gradle plugins with the declarative plugins block: https://flutter.dev/to/flutter-gradle-plugin-apply

Native libraries for Couchbase Lite for android are already installed
../../../.pub-cache/hosted/pub.dev/cbl-3.0.0/lib/src/document/blob.dart:212:22: Error: The method 'UnmodifiableUint8ListView' isn't defined for the class 'BlobImpl'.
 - 'BlobImpl' is from 'package:cbl/src/document/blob.dart' ('../../../.pub-cache/hosted/pub.dev/cbl-3.0.0/lib/src/document/blob.dart').
Try correcting the name to the name of an existing method, or defining a method named 'UnmodifiableUint8ListView'.
            sink.add(UnmodifiableUint8ListView(data));
                     ^^^^^^^^^^^^^^^^^^^^^^^^^
Target kernel_snapshot_program failed: Exception

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:compileFlutterBuildRelease'.
> Process 'command '/opt/homebrew/Caskroom/flutter/3.24.0/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 28s
Running Gradle task 'assembleRelease'...                           28.9s
Gradle task assembleRelease failed with exit code 1

To Reproduce

Install flutter 3.24.0, ensure flutter --version shows dart 3.5.0:

$ flutter --version
Flutter 3.24.0 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 80c2e84975 (8 days ago) • 2024-07-30 23:06:49 +0700
Engine • revision b8800d88be
Tools • Dart 3.5.0 • DevTools 2.37.2

Expected behavior

Build should pass, as it does on version 3.22.3 (dart 3.4.4)

Environment (please complete the following information):

Additional context

This seems to be connected to deprecation of some types in dart 3.5.0, similar issue in a different project: https://github.com/jonataslaw/get_cli/issues/263

paulobreim commented 1 month ago

Flutter (Channel stable, 3.24.0 and Dart SDK version: 3.5.0 (stable)

This error is occurring in the stable version that was released yesterday. It is very difficult to waste time with the nonsense that the Flutter people do. This error, so far, has no solution, and even if you are not using the Windows version, it gives this error.

Medformatik commented 1 month ago

Unfortunately, I can confirm this problem.

cbl: ^3.0.0
cbl_flutter: ^3.0.0
cbl_flutter_ce: ^3.0.0
$ flutter --version
Flutter 3.24.0 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 80c2e84975 (9 days ago) • 2024-07-30 23:06:49 +0700
Engine • revision b8800d88be
Tools • Dart 3.5.0 • DevTools 2.37.2
build error

``` ../../../../.pub-cache/hosted/pub.dev/win32-5.2.0/lib/src/guid.dart:32:9: Error: Type 'UnmodifiableUint8ListView' not found. final UnmodifiableUint8ListView bytes; ^^^^^^^^^^^^^^^^^^^^^^^^^ ../../../../.pub-cache/hosted/pub.dev/win32-5.2.0/lib/src/guid.dart:32:9: Error: 'UnmodifiableUint8ListView' isn't a type. final UnmodifiableUint8ListView bytes; ^^^^^^^^^^^^^^^^^^^^^^^^^ ../../../../.pub-cache/hosted/pub.dev/win32-5.2.0/lib/src/guid.dart:52:17: Error: Method not found: 'UnmodifiableUint8ListView'. return Guid(UnmodifiableUint8ListView(guid)); ^^^^^^^^^^^^^^^^^^^^^^^^^ ../../../../.pub-cache/hosted/pub.dev/win32-5.2.0/lib/src/guid.dart:56:31: Error: Method not found: 'UnmodifiableUint8ListView'. factory Guid.zero() => Guid(UnmodifiableUint8ListView(Uint8List(16))); ^^^^^^^^^^^^^^^^^^^^^^^^^ ../../../../.pub-cache/hosted/pub.dev/win32-5.2.0/lib/src/guid.dart:100:17: Error: Method not found: 'UnmodifiableUint8ListView'. return Guid(UnmodifiableUint8ListView(Uint8List.fromList(guidAsBytes))); ^^^^^^^^^^^^^^^^^^^^^^^^^ ../../../../.pub-cache/hosted/pub.dev/cbl-3.0.0/lib/src/document/blob.dart:212:22: Error: The method 'UnmodifiableUint8ListView' isn't defined for the class 'BlobImpl'. - 'BlobImpl' is from 'package:cbl/src/document/blob.dart' ('../../../../.pub-cache/hosted/pub.dev/cbl-3.0.0/lib/src/document/blob.dart'). Try correcting the name to the name of an existing method, or defining a method named 'UnmodifiableUint8ListView'. sink.add(UnmodifiableUint8ListView(data)); ^^^^^^^^^^^^^^^^^^^^^^^^^ Target kernel_snapshot_program failed: Exception FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':app:compileFlutterBuildDebug'. ```

mulderpf commented 3 weeks ago

I have just upgraded to Flutter 3.24.0 and I am getting the same issue. I do not care for Windows whatsoever (developing on a Mac for Android and iOS only).

paulobreim commented 3 weeks ago

I have just upgraded to Flutter 3.24.0 and I am getting the same issue. I do not care for Windows whatsoever (developing on a Mac for Android and iOS only).

Just do it to fix. flutter pub upgrade --major-versions

horacioduca23 commented 2 weeks ago

I have just upgraded to Flutter 3.24.0 and I am getting the same issue. I do not care for Windows whatsoever (developing on a Mac for Android and iOS only).

Just do it to fix. flutter pub upgrade --major-versions

This worked for me. Thanks

blaugold commented 1 week ago

I've just released cbl 3.1.0 which contains the fix for this issue.