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: invalid or corrupt bundletool #1006

Closed
bryanoltman opened this issue Aug 3, 2023 · 12 comments · Fixed by #1087 or #2335
Closed

fix: invalid or corrupt bundletool #1006

bryanoltman opened this issue Aug 3, 2023 · 12 comments · Fixed by #1087 or #2335
Assignees

Comments

@bryanoltman
Copy link
Contributor

When creating a release, a couple users have reported an error of the form Failed to extract version code from app bundle: Error: Invalid or corrupt jarfile /path/to/bundletool.jar

@bryanoltman bryanoltman converted this from a draft issue Aug 3, 2023
@eseidel
Copy link
Contributor

eseidel commented Aug 3, 2023

Other than some slightly strange factoring (e.g. extractArtifact not actually extracting in the base class), I don't see anything obviously wrong:

String get name => 'bundletool.jar';

We could try hard-coding a signature and verifying that?
e.g.
MD5 (/Users/eseidel/Downloads/bundletool-all-1.14.1.jar) = b783dab02ff42fe447f1c47c1616c698

@eseidel
Copy link
Contributor

eseidel commented Aug 3, 2023

If we think this might be early termination, we should just download to a temp file and then move it into place. I learned the other day that that's the only way to do an atomic write on file systems is that "rename" is atomic and so you always write to a side file and then rename into place when you want atomic writes (for downloads or otherwise).

@eseidel
Copy link
Contributor

eseidel commented Aug 3, 2023

https://www.reddit.com/r/dartlang/comments/r15lhw/best_way_to_write_a_file_atomically/ is actually a pretty good answer it looks like.

@eseidel eseidel moved this from Customers to Todo in Adoption Blockers Aug 4, 2023
@eseidel
Copy link
Contributor

eseidel commented Aug 4, 2023

Our current guess is that maybe customers are interrupting the script during download and we don't recover correctly.

@felangel felangel self-assigned this Aug 10, 2023
@felangel felangel moved this from Todo to In Progress in Adoption Blockers Aug 10, 2023
@github-project-automation github-project-automation bot moved this from In Progress to Done in Adoption Blockers Aug 10, 2023
@eseidel
Copy link
Contributor

eseidel commented Aug 15, 2023

One report of hitting this error again just now. ✗ Exception: Failed to extract version code from app bundle: Error: Invalid or corrupt jarfile

@felangel
Copy link
Contributor

One report of hitting this error again just now. ✗ Exception: Failed to extract version code from app bundle: Error: Invalid or corrupt jarfile

Affected customers will need to clear their cache for the fix the take effect.

@ThatSaxyDev
Copy link

One report of hitting this error again just now. ✗ Exception: Failed to extract version code from app bundle: Error: Invalid or corrupt jarfile

Affected customers will need to clear their cache for the fix the take effect.

What does this mean?

@eseidel
Copy link
Contributor

eseidel commented Nov 12, 2023

One report of hitting this error again just now. ✗ Exception: Failed to extract version code from app bundle: Error: Invalid or corrupt jarfile

Affected customers will need to clear their cache for the fix the take effect.

What does this mean?

I believe Felix was referring to shorebird cache clean which will force Shorebird to re-download all its dependencies.

@zyq9613
Copy link

zyq9613 commented Jul 9, 2024

Shorebird cache clean doesn't work, or will it report an error

@eseidel
Copy link
Contributor

eseidel commented Jul 9, 2024

Shorebird cache clean doesn't work, or will it report an error

Can you share the error you're seeing?

@zyq9613
Copy link

zyq9613 commented Jul 10, 2024

linxi@linxideMac-mini kx_flutter_verticalscreen % shorebird cache clean
✓ Cleared cache (1.0s)
linxi@linxideMac-mini kx_flutter_verticalscreen %
linxi@linxideMac-mini kx_flutter_verticalscreen %
linxi@linxideMac-mini kx_flutter_verticalscreen % shorebird init --force
Updating Flutter...
Cloning into '/Users/linxi/.shorebird/bin/cache/flutter/f32fc7841eacae535b034d1a5477632ac45df1c5'...
remote: Enumerating objects: 42103, done.
remote: Counting objects: 100% (1/1), done.
remote: Total 42103 (delta 0), reused 1 (delta 0), pack-reused 42102
Receiving objects: 100% (42103/42103), 23.62 MiB | 9.34 MiB/s, done.
Resolving deltas: 100% (2072/2072), done.
remote: Enumerating objects: 1914, done.
remote: Counting objects: 100% (517/517), done.
remote: Compressing objects: 100% (461/461), done.
remote: Total 1914 (delta 100), reused 58 (delta 56), pack-reused 1397
Receiving objects: 100% (1914/1914), 322.09 KiB | 1.19 MiB/s, done.
Resolving deltas: 100% (121/121), done.
remote: Enumerating objects: 6598, done.
remote: Counting objects: 100% (4415/4415), done.
remote: Compressing objects: 100% (3824/3824), done.
remote: Total 6598 (delta 1530), reused 591 (delta 590), pack-reused 2183
Receiving objects: 100% (6598/6598), 12.32 MiB | 9.59 MiB/s, done.
Resolving deltas: 100% (2031/2031), done.
Updating files: 100% (8308/8308), done.
HEAD is now at f32fc784 chore: roll engine to 4d1ece65265a615daf1933d86930c596042c888e (fix: copy wide arg registers)
Shorebird Engine • revision 4d1ece65265a615daf1933d86930c596042c888e
Downloading Darwin arm64 Dart SDK from Flutter engine 4d1ece65265a615daf1933d86930c596042c888e...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
100 84.5M 100 84.5M 0 0 16.5M 0 0:00:05 0:00:05 --:--:-- 21.1M
Building flutter tool...
Resolving dependencies...
Downloading packages...
Got dependencies.
Flutter 3.22.3-0.0.pre.14 • channel [user-branch] • unknown source
Framework • revision f32fc7841e (5 hours ago) • 2024-07-09 15:57:05 -0500
Engine • revision 4d1ece6526
Tools • Dart 3.4.3 • DevTools 2.34.1
Building Shorebird...
Resolving dependencies...
Downloading packages...
Got dependencies.
✓ No product flavors detected. (0.8s)

🐦 Shorebird initialized successfully!

✅ A shorebird app has been created.
✅ A "shorebird.yaml" has been created.
✅ The "pubspec.yaml" has been updated to include "shorebird.yaml" as an asset.

Reference the following commands to get started:

📦 To create a new release use: "shorebird release".
🚀 To push an update use: "shorebird patch".
👀 To preview a release use: "shorebird preview".

For more information about Shorebird, visit https://shorebird.dev
✓ Shorebird is up-to-date (2.1s)
✓ Flutter install is correct (1.1s)
[!] Shorebird does not respect the FLUTTER_STORAGE_BASE_URL environment variable at this time
✓ AndroidManifest.xml files contain INTERNET permission (35ms)
✓ Has access to storage.googleapis.com (0.3s)
✓ shorebird.yaml found in pubspec.yaml assets (6ms)
1 issue detected.
linxi@linxideMac-mini kx_flutter_verticalscreen % shorebird release android --artifact=apk

^C
linxi@linxideMac-mini kx_flutter_verticalscreen % shorebird release android --artifact=apk
✓ Fetching apps (0.7s)
✓ Building app bundle with Flutter 3.22.2 (f32fc7841e) (69.8s)
✓ Building APK with Flutter 3.22.2 (f32fc7841e) (9.3s)
✗ Exception: Failed to extract version code from app bundle: Error: Invalid or corrupt jarfile /Users/linxi/.shorebird/bin/cache/artifacts/bundletool/bundletool.jar
(12ms)

If you aren't sure why this command failed, re-run with the --verbose flag to see more information.

You can also file an issue if you think this is a bug. Please include the following log file in your report:
/Users/linxi/Library/Application Support/shorebird/logs/1720576370226_shorebird.log

linxi@linxideMac-mini kx_flutter_verticalscreen %

@eseidel
Copy link
Contributor

eseidel commented Jul 10, 2024

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Status: Done
5 participants