Skip to content
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

fix: shorebird release android --artifact apk throws an error #2434

Closed
Sheikh-X opened this issue Aug 21, 2024 · 3 comments
Closed

fix: shorebird release android --artifact apk throws an error #2434

Sheikh-X opened this issue Aug 21, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@Sheikh-X
Copy link

App ID: (67e9fb3567c0)

Description

The command fails with the below error

Gradle task bundleRelease failed with exit code 1
[ ]
#0 throwToolExit (package:flutter_tools/src/base/common.dart:10:3)
#1 AndroidGradleBuilder.buildGradleApp (package:flutter_tools/src/android/gradle.dart:500:9)

#2 AndroidGradleBuilder.buildAab (package:flutter_tools/src/android/gradle.dart:245:5)

#3 BuildAppBundleCommand.runCommand (package:flutter_tools/src/commands/build_appbundle.dart:178:5)

#4 FlutterCommand.run. (package:flutter_tools/src/runner/flutter_command.dart:1408:27)

#5 AppContext.run. (package:flutter_tools/src/base/context.dart:153:19)

#6 CommandRunner.runCommand (package:args/command_runner.dart:212:13)

#7 FlutterCommandRunner.runCommand. (package:flutter_tools/src/runner/flutter_command_runner.dart:420:9)

#8 AppContext.run. (package:flutter_tools/src/base/context.dart:153:19)

#9 FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:364:5)

#10 run.. (package:flutter_tools/runner.dart:130:9)

#11 AppContext.run. (package:flutter_tools/src/base/context.dart:153:19)

#12 main (package:flutter_tools/executable.dart:93:3)

Steps To Reproduce

Run "shorebird release android --artifact apk"

Expected Behavior

A .aab and apk file as the output.

Screenshots

If applicable, add screenshots to help explain your problem.

Additional Context
I tried "flutter build apk" and it built an apk successfully, same with using "flutter build appbundle"

Add any other context about the problem here.
1724238254295_shorebird.log

@Sheikh-X Sheikh-X added the bug Something isn't working label Aug 21, 2024
@eseidel
Copy link
Contributor

eseidel commented Aug 21, 2024

The error is:

IO  : Writing 932903 characters to text file /Users/afeez/.pub-cache/log/pub_log.txt.
[+1072 ms] [+1770 ms] ../../../.pub-cache/hosted/pub.dev/win32-5.5.0/lib/src/guid.dart:32:9: Error: Type 'UnmodifiableUint8ListView' not found.
[   +4 ms] [   +1 ms]   final UnmodifiableUint8ListView bytes;
[        ] [        ]         ^^^^^^^^^^^^^^^^^^^^^^^^^
[+3191 ms] [+3122 ms] ../../../.pub-cache/hosted/pub.dev/win32-5.5.0/lib/src/guid.dart:32:9: Error: 'UnmodifiableUint8ListView' isn't a type.
[        ] [        ]   final UnmodifiableUint8ListView bytes;
[        ] [        ]         ^^^^^^^^^^^^^^^^^^^^^^^^^
[        ] [        ] ../../../.pub-cache/hosted/pub.dev/win32-5.5.0/lib/src/guid.dart:52:17: Error: Method not found: 'UnmodifiableUint8ListView'.
[        ] [        ]     return Guid(UnmodifiableUint8ListView(guid));
[        ] [        ]                 ^^^^^^^^^^^^^^^^^^^^^^^^^
[        ] [        ] ../../../.pub-cache/hosted/pub.dev/win32-5.5.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.5.0/lib/src/guid.dart:100:17: Error: Method not found: 'UnmodifiableUint8ListView'.
[        ] [        ]     return Guid(UnmodifiableUint8ListView(Uint8List.fromList(guidAsBytes)));
[        ] [        ]                 ^^^^^^^^^^^^^^^^^^^^^^^^^
[        ] [   +2 ms] Target kernel_snapshot_program failed: Exception

Because Shorebird by default uses the latest flutter stable (in this case 3.24.0) and it looks like your project isn't expecting that (and is hitting an upgrade error with Dart 3.5.0).

If you'd like to update to Flutter 3.24.0 that will solve the bug. Otherwise you can also build with shorebird release --fluter-version=3.22.3 which will build you with an older flutter.

See also https://shorebird.dev/blog/dart-3.5.0/ for when you hit this during upgrade. You'll need to dart pub upgrade after running flutter upgrade to work around this upgrade error in 3.5.0

@Sheikh-X
Copy link
Author

shorebird release --fluter-version=3.22.3

shorebird release --fluter-version=3.22.3shorebird release --fluter-version=3.22.3

The solution worked but there is a spelling error, it should be "shorebird release --flutter-version=3.22.3" in case you have the same issue and find yourself here.

@ZotInfo
Copy link

ZotInfo commented Oct 15, 2024

The error is:

IO  : Writing 932903 characters to text file /Users/afeez/.pub-cache/log/pub_log.txt.
[+1072 ms] [+1770 ms] ../../../.pub-cache/hosted/pub.dev/win32-5.5.0/lib/src/guid.dart:32:9: Error: Type 'UnmodifiableUint8ListView' not found.
[   +4 ms] [   +1 ms]   final UnmodifiableUint8ListView bytes;
[        ] [        ]         ^^^^^^^^^^^^^^^^^^^^^^^^^
[+3191 ms] [+3122 ms] ../../../.pub-cache/hosted/pub.dev/win32-5.5.0/lib/src/guid.dart:32:9: Error: 'UnmodifiableUint8ListView' isn't a type.
[        ] [        ]   final UnmodifiableUint8ListView bytes;
[        ] [        ]         ^^^^^^^^^^^^^^^^^^^^^^^^^
[        ] [        ] ../../../.pub-cache/hosted/pub.dev/win32-5.5.0/lib/src/guid.dart:52:17: Error: Method not found: 'UnmodifiableUint8ListView'.
[        ] [        ]     return Guid(UnmodifiableUint8ListView(guid));
[        ] [        ]                 ^^^^^^^^^^^^^^^^^^^^^^^^^
[        ] [        ] ../../../.pub-cache/hosted/pub.dev/win32-5.5.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.5.0/lib/src/guid.dart:100:17: Error: Method not found: 'UnmodifiableUint8ListView'.
[        ] [        ]     return Guid(UnmodifiableUint8ListView(Uint8List.fromList(guidAsBytes)));
[        ] [        ]                 ^^^^^^^^^^^^^^^^^^^^^^^^^
[        ] [   +2 ms] Target kernel_snapshot_program failed: Exception

Because Shorebird by default uses the latest flutter stable (in this case 3.24.0) and it looks like your project isn't expecting that (and is hitting an upgrade error with Dart 3.5.0).

If you'd like to update to Flutter 3.24.0 that will solve the bug. Otherwise you can also build with shorebird release --fluter-version=3.22.3 which will build you with an older flutter.

See also https://shorebird.dev/blog/dart-3.5.0/ for when you hit this during upgrade. You'll need to dart pub upgrade after running flutter upgrade to work around this upgrade error in 3.5.0

this command save my life, but need a correction:
shorebird release android --flutter-version=3.22.3

change 3.22.3 for your local flutter version

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants