Exception during build-bundle when parts of the output path doesn't exist
See original GitHub issueDescribe the bug
When running build-bundle
it seems that bundletool fails with an exception when a folder along the output path doesn’t exist yet.
My build crashed on CI but was working fine locally, and the only difference I found was that the last step on the output path (android, as seen in the stacktrace below) didn’t exist on CI yet. Once I changed my pipeline to create that folder bundletool worked just fine.
Bundletool version(s) affected Version: 1.2.0
Stacktrace
[BT:1.2.0] Error: java.nio.file.NoSuchFileException: /var/folders/xk/4xx_qglx49gbgckw1mskrc0r0000gp/T/ZipBuilder-3357403704097616359.zip.tmp -> /Users/macpro/jenkins/workspace/frontend/BuildPipeline/builds/android/Client-0.59.0--6.aab
java.io.UncheckedIOException: java.nio.file.NoSuchFileException: /var/folders/xk/4xx_qglx49gbgckw1mskrc0r0000gp/T/ZipBuilder-3357403704097616359.zip.tmp -> /Users/macpro/jenkins/workspace/frontend/BuildPipeline/builds/android/Client-0.59.0--6.aab
at com.android.tools.build.bundletool.commands.BuildBundleCommand.execute(BuildBundleCommand.java:261)
at com.android.tools.build.bundletool.BundleToolMain.main(BundleToolMain.java:71)
at com.android.tools.build.bundletool.BundleToolMain.main(BundleToolMain.java:47)
Caused by: java.nio.file.NoSuchFileException: /var/folders/xk/4xx_qglx49gbgckw1mskrc0r0000gp/T/ZipBuilder-3357403704097616359.zip.tmp -> /Users/macpro/jenkins/workspace/frontend/BuildPipeline/builds/android/Client-0.59.0--6.aab
at sun.nio.fs.UnixException.translateToIOException(UnixException.java:86)
at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
at sun.nio.fs.UnixCopyFile.move(UnixCopyFile.java:457)
at sun.nio.fs.UnixFileSystemProvider.move(UnixFileSystemProvider.java:262)
at java.nio.file.Files.move(Files.java:1395)
at com.android.tools.build.bundletool.io.ZipBuilder.writeTo(ZipBuilder.java:107)
at com.android.tools.build.bundletool.io.AppBundleSerializer.writeToDisk(AppBundleSerializer.java:115)
at com.android.tools.build.bundletool.commands.BuildBundleCommand.execute(BuildBundleCommand.java:259)
... 2 more
exit code: 1
To Reproduce
Call bundletool build-bundle --output="/some/output/path/bundle.aab"
with a path where the last subfolder doesn’t exist yet.
Expected behavior Bundletool should create the output folder when it doesn’t exist, similarly to how it’s done at BuildApksCommand.java#L650.
Known workaround The workaround is making sure that the folder exists prior to calling bundletool 😉
Environment: OS: OSX 10.15.7
Additional context I’m using bundletool in Unity with the Google PAD plug-in, but I don’t think this makes a difference at all.
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (2 by maintainers)
Top GitHub Comments
Thank you for the contribution!
It appears that this bug is the cause of https://github.com/google/play-unity-plugins/issues/74. I’ll update to 1.4.0 to see if it fixes the issue.