Unable to sign APK due to FileAlreadyExistsException
See original GitHub issueDescribe the bug
Unable to generate APKS file from an AAB bundle, getting an Unable to sign APK
error caused by a FileAlreadyExistsException
within C:/Users/name/AppData/Local/Temp
Bundletool version(s) affected Version: 1.8.1
Stacktrace
[BT:1.8.1] Error: Unable to sign APK.
com.android.tools.build.bundletool.model.exceptions.CommandExecutionException: Unable to sign APK.
at com.android.tools.build.bundletool.model.exceptions.InternalExceptionBuilder.build(InternalExceptionBuilder.java:57)
at com.android.tools.build.bundletool.io.ApkSigner.signApk(ApkSigner.java:84)
at com.android.tools.build.bundletool.io.ZipFlingerApkSerializerHelper.writeToZipFile(ZipFlingerApkSerializerHelper.java:173)
at com.android.tools.build.bundletool.io.ZipFlingerApkSerializerHelper.writeToZipFile(ZipFlingerApkSerializerHelper.java:112)
at com.android.tools.build.bundletool.io.StandaloneApkSerializer.writeToDiskInternal(StandaloneApkSerializer.java:76)
at com.android.tools.build.bundletool.io.StandaloneApkSerializer.writeToDisk(StandaloneApkSerializer.java:43)
at com.android.tools.build.bundletool.io.ApkSetBuilderFactory$ApkSetArchiveBuilder.addStandaloneApk(ApkSetBuilderFactory.java:130)
at com.android.tools.build.bundletool.io.ApkSerializerManager$ApkSerializer.serialize(ApkSerializerManager.java:495)
at com.android.tools.build.bundletool.io.ApkSerializerManager.lambda$null$4(ApkSerializerManager.java:233)
at com.google.common.util.concurrent.TrustedListenableFutureTask$TrustedFutureInterruptibleTask.runInterruptibly(TrustedListenableFutureTask.java:125)
at com.google.common.util.concurrent.InterruptibleTask.run(InterruptibleTask.java:69)
at com.google.common.util.concurrent.TrustedListenableFutureTask.run(TrustedListenableFutureTask.java:78)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.nio.file.FileAlreadyExistsException: C:\Users\bengrah\AppData\Local\Temp\ApkSigner2236382018700181045\signed.apk -> C:\Users\bengrah\AppData\Local\Temp\AutoValue_BuildApksCommand3237083126039129873\standalones\standalone-armeabi_mdpi.apk
at sun.nio.fs.WindowsException.translateToIOException(Unknown Source)
at sun.nio.fs.WindowsException.rethrowAsIOException(Unknown Source)
at sun.nio.fs.WindowsFileCopy.move(Unknown Source)
at sun.nio.fs.WindowsFileSystemProvider.move(Unknown Source)
at java.nio.file.Files.move(Unknown Source)
at com.android.tools.build.bundletool.io.ApkSigner.signApk(ApkSigner.java:75)
... 13 more
To Reproduce
- Generated an AAB file using command
ionic cordova build android --release
- New file created successfully, named
aab-release.aab
- Run the following command:
java -jar .\bundletool.jar build-apks --bundle=app-release.aab --output=./app-signed.apks --ks=C:/keystore/location/my.keystore --ks-key-alias=alias_name
- I’m prompted to enter the password for the keystore, enter the correct keystore password
- Hit Return, nothing happens for about 20s
Expected behavior Generated an APKS file with some sort of successful message on the console.
Known workaround N/A
Environment: Windows 10
Issue Analytics
- State:
- Created 2 years ago
- Comments:8
Top Results From Across the Web
FileAlreadyExistsException - Android Developers
Returns the string explaining why the file system operation failed. ... be returned by getStackTrace() and printed by printStackTrace() and related methods.
Read more >FileAlreadyExistsException when debug - MSDN - Microsoft
User365854 posted. When I try to debug I get the output below. I just keep pressing Debug until eventually it runs.
Read more >How to fix issue Caused by: java.nio.file.NoSuchFileException ...
I was able to sign my apk fine until I did some android studio update or reset something in jar files. Not sure...
Read more >Issues · google/bundletool - GitHub
Bundletool is a command-line tool to manipulate Android App Bundles ... 1.13.1 - build-apks on .aab generated by 1.8.2 incorrectly fails ...
Read more >[UTIL][NOV 24, 2022] Apktool - Tool for reverse engineering ...
Senior Member · 1. Trying to decompile AOSP 5.1's Settings.apk using the 5.1 framework -- failed · 2. Trying to decompile the same...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I have the same problem as you. I solved the problem.
Command line add : --mode=universal
This should be fixed in the latest version.