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

Android release artifacts not always found by shorebird release android #1798

Closed
bryanoltman opened this issue Mar 18, 2024 · 10 comments · Fixed by #1799
Closed

Android release artifacts not always found by shorebird release android #1798

bryanoltman opened this issue Mar 18, 2024 · 10 comments · Fixed by #1799
Labels
bug Something isn't working

Comments

@bryanoltman
Copy link
Contributor

Description

Android builds output the libapp.so files (release artifacts) to build/app/intermediates/stripped_native_libs/[A]/[B]/out/lib/[arch]/libapp.so, where:

A is either release or [flavorName]Release, depending on whether the app uses flavors
B is one of

  • nothing (i.e., out is an immediate subdirectory of A)
  • stripReleaseDebugSymbols, if no flavors were used
  • strip[flavor]ReleaseDebugSymbols, where [flavor] is the name of the flavor that was used.

arch is one of (arm64-v8a, armeabi-v7a, x86_64)

Shorebird looks for build/app/intermediates/stripped_native_libs/release/out/lib/[arch]/libapp.so, so the addition of the B directory from above causes a PathNotFound exception:

Unhandled exception:
PathNotFoundException: Cannot open file, path = '/Users/bryanoltman/Downloads/mobile-main/build/app/intermediates/stripped_native_libs/release/out/lib/arm64-v8a/libapp.so' (OS Error: No such file or directory, errno = 2)
#0      _checkForErrorResponse (dart:io/common.dart:55:9)
#1      _File.open.<anonymous closure> (dart:io/file_impl.dart:381:7)
#2      _rootRunUnary (dart:async/zone.dart:1407:47)
#3      _CustomZone.runUnary (dart:async/zone.dart:1308:19)
<asynchronous suspension>
#4      _File.readAsBytes.<anonymous closure> (dart:io/file_impl.dart:562:24)
<asynchronous suspension>
#5      CodePushClientWrapper.createAndroidReleaseArtifacts (package:shorebird_cli/src/code_push_client_wrapper.dart:416:35)
<asynchronous suspension>
#6      ReleaseAndroidCommand.run.<anonymous closure> (package:shorebird_cli/src/commands/release/release_android_command.dart:274:9)
<asynchronous suspension>
#7      ReleaseAndroidCommand.run (package:shorebird_cli/src/commands/release/release_android_command.dart:155:12)
@bryanoltman bryanoltman added the bug Something isn't working label Mar 18, 2024
@bryanoltman
Copy link
Contributor Author

Currently attempting to find out why this is happening

@bryanoltman
Copy link
Contributor Author

bryanoltman commented Mar 18, 2024

Reproduction steps:

  1. Create a new Flutter app using flutter create strip_symbols
  2. Apply the following diff:
diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties
index e1ca574..5e6b542 100644
--- a/android/gradle/wrapper/gradle-wrapper.properties
+++ b/android/gradle/wrapper/gradle-wrapper.properties
@@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
 distributionPath=wrapper/dists
 zipStoreBase=GRADLE_USER_HOME
 zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.3-all.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-all.zip
diff --git a/android/settings.gradle b/android/settings.gradle
index 1d6d19b..f181659 100644
--- a/android/settings.gradle
+++ b/android/settings.gradle
@@ -19,7 +19,7 @@ pluginManagement {
 
 plugins {
     id "dev.flutter.flutter-plugin-loader" version "1.0.0"
-    id "com.android.application" version "7.3.0" apply false
+    id "com.android.application" version '8.3.0' apply false
     id "org.jetbrains.kotlin.android" version "1.7.10" apply false
 }
  1. Run shorebird release android
  2. Observe that the libapp.so paths are /Users/bryanoltman/Documents/sandbox/strip_symbols/build/app/intermediates/stripped_native_libs/release/stripReleaseDebugSymbols/out/lib/[arch]/libapp.so
  3. Observe the output:
⑆ shorebird release android
✓ Building release with Flutter 3.19.3 (a6d1747d7f) (8.0s)
✓ Fetching apps (0.2s)
✓ Detecting release version (0.2s)
✓ Fetching releases (82ms)

🚀 Ready to create a new release!

📱 App: strip_symbols (f6abac49-027b-48dc-a4f0-f0a404c9e197)
📦 Release Version: 1.0.0+1
🕹️  Platform: android (arm64, arm32, x86_64)
🐦 Flutter Version: 3.19.3 (a6d1747d7f)

Would you like to continue? (y/N) Yes
✓ Creating release (0.1s)
Unhandled exception:
PathNotFoundException: Cannot open file, path = '/Users/bryanoltman/Documents/sandbox/strip_symbols/build/app/intermediates/stripped_native_libs/release/out/lib/arm64-v8a/libapp.so' (OS Error: No such file or directory, errno = 2)
#0      _checkForErrorResponse (dart:io/common.dart:55:9)
#1      _File.open.<anonymous closure> (dart:io/file_impl.dart:381:7)
#2      _rootRunUnary (dart:async/zone.dart:1407:47)
#3      _CustomZone.runUnary (dart:async/zone.dart:1308:19)
<asynchronous suspension>
#4      _File.readAsBytes.<anonymous closure> (dart:io/file_impl.dart:562:24)
<asynchronous suspension>
#5      CodePushClientWrapper.createAndroidReleaseArtifacts (package:shorebird_cli/src/code_push_client_wrapper.dart:416:35)
<asynchronous suspension>
#6      ReleaseAndroidCommand.run.<anonymous closure> (package:shorebird_cli/src/commands/release/release_android_command.dart:274:9)
<asynchronous suspension>
#7      ReleaseAndroidCommand.run (package:shorebird_cli/src/commands/release/release_android_command.dart:155:12)
<asynchronous suspension>
#8      CommandRunner.runCommand (package:args/command_runner.dart:212:13)
<asynchronous suspension>
#9      ShorebirdCliCommandRunner.runCommand (package:shorebird_cli/src/command_runner.dart:208:18)
<asynchronous suspension>
#10     ShorebirdCliCommandRunner.run (package:shorebird_cli/src/command_runner.dart:124:14)
<asynchronous suspension>
#11     main (file:///Users/bryanoltman/shorebirdtech/_shorebird/shorebird/packages/shorebird_cli/bin/shorebird.dart:28:5)
<asynchronous suspension>

@Fudal
Copy link

Fudal commented Mar 19, 2024

I have now the same error with Shorebird 0.26.7 and Flutter 3.19.3.
Should I check for new version of Shorebird?

github workflow log:
Run shorebird release android -- --dart-define=SENTRY_DSN=*** --dart-define=LOCALIZELY_SDK_TOKEN=*** --dart-define=LOCALIZELY_DISTRIBUTION_ID=*** --dart-define=MIXPANEL_TOKEN=***
⠋ Building release with Flutter 3.[19](https://github.com/Repository_name/name-app/actions/runs/8345827114/job/22841643741#step:11:20).3 (a6d1747d7f)...
✓ Building release with Flutter 3.19.3 (a6d1747d7f) (671.5s)
⠋ Fetching apps...
✓ Fetching apps (0.6s)
⠋ Detecting release version...
✓ Detecting release version (3.3s)
⠋ Fetching releases...
✓ Fetching releases (0.1s)

🚀 Ready to create a new release!

📱 App: name-app (e4df7b53-a335-4225-a43a-976412678a10)
📦 Release Version: 1.4.4+94
🕹️  Platform: android (arm64, arm32, x86_64)
🐦 Flutter Version: 3.19.3 (a6d1747d7f)

⠋ Creating release...
✓ Creating release (0.2s)
Unhandled exception:
PathNotFoundException: Cannot open file, path = '/home/runner/work/name-app/name-app/build/app/intermediates/stripped_native_libs/release/out/lib/arm64-v8a/libapp.so' (OS Error: No such file or directory, errno = 2)
#0      _checkForErrorResponse (dart:io/common.dart:55:9)
#1      _File.open.<anonymous closure> (dart:io/file_impl.dart:381:7)
#2      _rootRunUnary (dart:async/zone.dart:1407:47)
<asynchronous suspension>
#3      _File.readAsBytes.<anonymous closure> (dart:io/file_impl.dart:562:24)
<asynchronous suspension>
#4      CodePushClientWrapper.createAndroidReleaseArtifacts (package:shorebird_cli/src/code_push_client_wrapper.dart:386:35)
<asynchronous suspension>
#5      ReleaseAndroidCommand.run.<anonymous closure> (package:shorebird_cli/src/commands/release/release_android_command.dart:274:9)
<asynchronous suspension>
#6      ReleaseAndroidCommand.run (package:shorebird_cli/src/commands/release/release_android_command.dart:155:12)
<asynchronous suspension>
#7      CommandRunner.runCommand (package:args/command_runner.dart:212:13)
<asynchronous suspension>
#8      ShorebirdCliCommandRunner.runCommand (package:shorebird_cli/src/command_runner.dart:[20](https://github.com/Repository_name/name-app/actions/runs/8345827114/job/22841643741#step:11:21)8:18)
<asynchronous suspension>
#9      ShorebirdCliCommandRunner.run (package:shorebird_cli/src/command_runner.dart:1[24](https://github.com/Repository_name/name-app/actions/runs/8345827114/job/22841643741#step:11:25):14)
<asynchronous suspension>
#10     main (file:///home/runner/.config/shorebird/packages/shorebird_cli/bin/shorebird.dart:28:5)
<asynchronous suspension>
⠋ Creating artifacts...
Error: Process completed with exit code [25](https://github.com/Repository_name/name-app/actions/runs/8345827114/job/22841643741#step:11:26)5.

@bryanoltman
Copy link
Contributor Author

Hmm, I think that might be a different error – the CLI should be looking there already. Does your app use flavors by any chance?

@Fudal
Copy link

Fudal commented Mar 19, 2024

No, I my app doesn't use flavors and I've never had error like this before. My app using shorebird from few months and always everything was fine

@bryanoltman
Copy link
Contributor Author

We haven't made any changes to this recently, but maybe it's possible that you upgraded your com.android.application Gradle plugin version? If so, this will be fixed in our next release.

@Fudal
Copy link

Fudal commented Mar 19, 2024

I've updated my app and Gradle - yes, but I think I did that before my latest release (with success build)

@Fudal
Copy link

Fudal commented Mar 20, 2024

@bryanoltman when will be next release with fix for that?

@bryanoltman
Copy link
Contributor Author

@Fudal the fix was just released in version 0.27.0

@Fudal
Copy link

Fudal commented Mar 21, 2024

Thank you for the update!

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

Successfully merging a pull request may close this issue.

2 participants