Open infinitronic opened 3 years ago
it's seems that an issue while installing the Android build tools (see https://stackoverflow.com/questions/51283357/i-am-not-able-to-install-sdk-command-tool-with-add-ons). Are you using the Android SDK that Bubblewrap offers to install for you or your own?
it's seems that an issue while installing the Android build tools (see https://stackoverflow.com/questions/51283357/i-am-not-able-to-install-sdk-command-tool-with-add-ons). Are you using the Android SDK that Bubblewrap offers to install for you or your own?
Hello @andreban, and thanks for your dependable swift response. I downloaded the latest sdk directly (not the one bubblewrap offers to install). Could that be the issue? I tried running bubblewrap init again but it is not asking for the sdk location/to do the download for me: it's now bypassing that step.
Yes, that is likely the issue. The path for utilities on the Android SDK can change between releases. Bubble wrap will installation a version that is known to work.
You can delete the directory under
${USER_HOME}/.bubblewrap/
and the run bubblewrap build
and it should prompt for installation the JDK again.
Yes, that is likely the issue. The path for utilities on the Android SDK can change between releases. Bubble wrap will installation a version that is known to work.
You can delete the directory under
${USER_HOME}/.bubblewrap/
and the run
bubblewrap build
and it should prompt for installation the JDK again.
Hello @andreban and thanks again for your dependable swift response. I did the ${USER_HOME}/.bubblewrap wipe, ran bubblewrap build again, it took a bit to download the CLI, but threw an undefined error again. Here's the output:
" Decompressing the Android SDK... Installing Android Build Tools. Please, read and accept the license agreement. build Installing Build Tools Error: Could not find or load main class 2.bubblewrap\android_sdk\tools\bin\..
cli ERROR undefined "
Hello @andreban: I found this: https://github.com/GoogleChromeLabs/bubblewrap/issues/223 (where you had resolved a similar issue in the past), and consequently moved my Android CLI/SDK to a directory with a no-space path, and then I was able to proceed with downloading and installing the build tools. Now, I'm at yet another hurdle: the bubblewrap build command is still not executing completely: this time it's throwing a keystore error, stating that: it can't find a key with the alias (name) specified in the keystore: it's suggesting that perhaps the password is wrong? and a long list of other statements, all in red. The passwords I used are absolutely correct, and so is the keystore alias... I've done the process twice (deleted android.keystore and recreated it...). What could be causing this?
Got it - yes, you are right, Android CLI tools doesn't like paths with spaces...
Re: the keystore, would you mind pasting the error messages?
Dear @andreban: thanks for the swift response. Gladly. It's a lot of lines though:
cli ERROR Command failed: E:\jdk8\bin\java.exe -Xmx1024M -Xss1m -jar E:\android_sdk\build-tools\30.0.3\lib\apksigner.jar sign --ks E:\xampp_2\htdocs\apps\zoomer\android.keystore --ks-key-alias june --ks-pass pass:trillionsdonland --key-pass pass:natruethetrillionsdonland --out ./app-release-signed.apk ./app-release-unsigned-aligned.apk Failed to load signer "signer #1" java.io.IOException: Failed to obtain key with alias "june" from E:\xampp_2\htdocs\apps\zoomer\android.keystore. Wrong password? at com.android.apksigner.SignerParams.loadPrivateKeyAndCertsFromKeyStore(SignerParams.java:320) at com.android.apksigner.SignerParams.loadPrivateKeyAndCerts(SignerParams.java:181) at com.android.apksigner.ApkSignerTool.getSignerConfig(ApkSignerTool.java:395) at com.android.apksigner.ApkSignerTool.sign(ApkSignerTool.java:316) at com.android.apksigner.ApkSignerTool.main(ApkSignerTool.java:88) Caused by: java.security.UnrecoverableKeyException: Get Key failed: Given final block not properly padded. Such issues can arise if a bad key is used during decryption. at sun.security.pkcs12.PKCS12KeyStore.engineGetKey(PKCS12KeyStore.java:438) at sun.security.provider.KeyStoreDelegator.engineGetKey(KeyStoreDelegator.java:96) at sun.security.provider.JavaKeyStore$DualFormatJKS.engineGetKey(JavaKeyStore.java:71) at java.security.KeyStore.getKey(KeyStore.java:1023) at com.android.apksigner.SignerParams.getKeyStoreKey(SignerParams.java:375) at com.android.apksigner.SignerParams.loadPrivateKeyAndCertsFromKeyStore(SignerParams.java:288) ... 4 more Caused by: javax.crypto.BadPaddingException: Given final block not properly padded. Such issues can arise if a bad key is used during decryption. at com.sun.crypto.provider.CipherCore.unpad(CipherCore.java:975) at com.sun.crypto.provider.CipherCore.fillOutputBuffer(CipherCore.java:1056) at com.sun.crypto.provider.CipherCore.doFinal(CipherCore.java:853) at com.sun.crypto.provider.PKCS12PBECipherCore.implDoFinal(PKCS12PBECipherCore.java:405) at com.sun.crypto.provider.PKCS12PBECipherCore$PBEWithSHA1AndDESede.engineDoFinal(PKCS12PBECipherCore.java:437) at javax.crypto.Cipher.doFinal(Cipher.java:2168) at sun.security.pkcs12.PKCS12KeyStore.engineGetKey(PKCS12KeyStore.java:371) ... 9 more
Was your signing key generated via Bubblewrap init? It does look like the key is corrupted. I'd recommend regenerating the key via Bubblewrap init.
Was your signing key generated via Bubblewrap init? It does look like the key is corrupted. I'd recommend regenerating the key via Bubblewrap init.
Hello @andreban and thanks for your sustained support. Yes it was generated using Bubblewrap init, and I did it many times (I deleted android.keystore and tried it again severally).
Hello @andreban, I'm actually still using a jdk8 I downloaded directly. I'm letting Bubblewrap do the download for me as we speak, and I'll run the Bubblewrap build command again afterwards. I see some 'Java' mentions in the error thrown, and the first line in the error thrown states: "cli ERROR Command failed: E:\jdk8\bin\java.exe -Xmx1024M -Xss1m -jar" (points to the jdk). Maybe letting Bubblewrap use its defualt openjdk8 might help? It might take a bit to get the download done though.
Hello @andreban, I'm actually still using a jdk8 I downloaded directly. I'm letting Bubblewrap do the download for me as we speak, and I'll run the Bubblewrap build command again afterwards. I see some 'Java' mentions in the error thrown, and the first line in the error thrown states: "cli ERROR Command failed: E:\jdk8\bin\java.exe -Xmx1024M -Xss1m -jar" (points to the jdk). Maybe letting Bubblewrap use its defualt openjdk8 might help? It might take a bit to get the download done though.
Hello @andreban. Bubblewrap seems to be unable to download the jdk directly. It keeps breaking with the error: "cli ERROR end of central directory record signature not found". It's happened around 5 times - once after downloading over 70MB of the Java jdk. Being that I'm not even sure if the issue is coming from the jdk8 I downloaded directly, I think I'll have to hold up a bit to hear what you're presently thinking?
I tested it out on a Windows machine today, but can't reproduce the issue. It sounds like it's trying to decompress the downloaded JDK, but the zipfile is corrupted. Any change the connection broke while downloading the JDK?
I'm having the same issue now, almost a year later. Any info on this?
I'm having the same issue now, almost a year later. Any info on this?
As mentioned in the previous message, we weren't able to reproduce the issue. It would be very helpful if you could provide details on OS and Node.js versions, and any reproduction steps.
After adding the passwords Bubblewrap gave me those errors (3 times in a row, I hidden the passwords):
cli ERROR Command failed: /Users/pm/.bubblewrap/android_sdk/build-tools/30.0.3/apksigner sign --ks /Users/pm/Documents/PG-Android-App/android.keystore --ks-key-alias android --ks-pass pass:PASSWORD --key-pass pass:PASSWORD2 --out ./app-release-signed.apk ./app-release-unsigned-aligned.apk Failed to load signer "signer #1" java.io.IOException: Failed to obtain key with alias "android" from /Users/pm/Documents/PG-Android-App/android.keystore. Wrong password? at com.android.apksigner.SignerParams.loadPrivateKeyAndCertsFromKeyStore(SignerParams.java:320) at com.android.apksigner.SignerParams.loadPrivateKeyAndCerts(SignerParams.java:181) at com.android.apksigner.ApkSignerTool.getSignerConfig(ApkSignerTool.java:395) at com.android.apksigner.ApkSignerTool.sign(ApkSignerTool.java:316) at com.android.apksigner.ApkSignerTool.main(ApkSignerTool.java:88) Caused by: java.security.UnrecoverableKeyException: Get Key failed: Given final block not properly padded. Such issues can arise if a bad key is used during decryption. at java.base/sun.security.pkcs12.PKCS12KeyStore.engineGetKey(PKCS12KeyStore.java:465) at java.base/sun.security.util.KeyStoreDelegator.engineGetKey(KeyStoreDelegator.java:90) at java.base/java.security.KeyStore.getKey(KeyStore.java:1057) at com.android.apksigner.SignerParams.getKeyStoreKey(SignerParams.java:375) at com.android.apksigner.SignerParams.loadPrivateKeyAndCertsFromKeyStore(SignerParams.java:288) ... 4 more Caused by: javax.crypto.BadPaddingException: Given final block not properly padded. Such issues can arise if a bad key is used during decryption. at java.base/com.sun.crypto.provider.CipherCore.unpad(CipherCore.java:975) at java.base/com.sun.crypto.provider.CipherCore.fillOutputBuffer(CipherCore.java:1056) at java.base/com.sun.crypto.provider.CipherCore.doFinal(CipherCore.java:853) at java.base/com.sun.crypto.provider.PKCS12PBECipherCore.implDoFinal(PKCS12PBECipherCore.java:408) at java.base/com.sun.crypto.provider.PKCS12PBECipherCore$PBEWithSHA1AndDESede.engineDoFinal(PKCS12PBECipherCore.java:440) at java.base/javax.crypto.Cipher.doFinal(Cipher.java:2202) at java.base/sun.security.pkcs12.PKCS12KeyStore.lambda$engineGetKey$0(PKCS12KeyStore.java:406) at java.base/sun.security.pkcs12.PKCS12KeyStore$RetryWithZero.run(PKCS12KeyStore.java:295) at java.base/sun.security.pkcs12.PKCS12KeyStore.engineGetKey(PKCS12KeyStore.java:400) ... 8 more
Dear @andreban: thanks for the swift response. Gladly. It's a lot of lines though:
cli ERROR Command failed: E:\jdk8\bin\java.exe -Xmx1024M -Xss1m -jar E:\android_sdk\build-tools\30.0.3\lib\apksigner.jar sign --ks E:\xampp_2\htdocs\apps\zoomer\android.keystore --ks-key-alias june --ks-pass pass:trillionsdonland --key-pass pass:natruethetrillionsdonland --out ./app-release-signed.apk ./app-release-unsigned-aligned.apk Failed to load signer "signer #1" java.io.IOException: Failed to obtain key with alias "june" from E:\xampp_2\htdocs\apps\zoomer\android.keystore. Wrong password? at com.android.apksigner.SignerParams.loadPrivateKeyAndCertsFromKeyStore(SignerParams.java:320) at com.android.apksigner.SignerParams.loadPrivateKeyAndCerts(SignerParams.java:181) at com.android.apksigner.ApkSignerTool.getSignerConfig(ApkSignerTool.java:395) at com.android.apksigner.ApkSignerTool.sign(ApkSignerTool.java:316) at com.android.apksigner.ApkSignerTool.main(ApkSignerTool.java:88) Caused by: java.security.UnrecoverableKeyException: Get Key failed: Given final block not properly padded. Such issues can arise if a bad key is used during decryption. at sun.security.pkcs12.PKCS12KeyStore.engineGetKey(PKCS12KeyStore.java:438) at sun.security.provider.KeyStoreDelegator.engineGetKey(KeyStoreDelegator.java:96) at sun.security.provider.JavaKeyStore$DualFormatJKS.engineGetKey(JavaKeyStore.java:71) at java.security.KeyStore.getKey(KeyStore.java:1023) at com.android.apksigner.SignerParams.getKeyStoreKey(SignerParams.java:375) at com.android.apksigner.SignerParams.loadPrivateKeyAndCertsFromKeyStore(SignerParams.java:288) ... 4 more Caused by: javax.crypto.BadPaddingException: Given final block not properly padded. Such issues can arise if a bad key is used during decryption. at com.sun.crypto.provider.CipherCore.unpad(CipherCore.java:975) at com.sun.crypto.provider.CipherCore.fillOutputBuffer(CipherCore.java:1056) at com.sun.crypto.provider.CipherCore.doFinal(CipherCore.java:853) at com.sun.crypto.provider.PKCS12PBECipherCore.implDoFinal(PKCS12PBECipherCore.java:405) at com.sun.crypto.provider.PKCS12PBECipherCore$PBEWithSHA1AndDESede.engineDoFinal(PKCS12PBECipherCore.java:437) at javax.crypto.Cipher.doFinal(Cipher.java:2168) at sun.security.pkcs12.PKCS12KeyStore.engineGetKey(PKCS12KeyStore.java:371) ... 9 more
It looks like there was an error signing the Android app using the apksigner tool. The specific error message is: "Failed to load signer "signer #1" java.io.IOException: Failed to obtain key with alias "june" from E:\xampp_2\htdocs\apps\zoomer\android.keystore. Wrong password?"
This error message suggests that the keystore could not be accessed with the provided password. A keystore is a file that contains the private keys that are used to sign an Android app. It's possible that the password provided to the apksigner tool is incorrect, or that the keystore file has become corrupted.
If you're certain that the password is correct, you can try to resolve this issue by regenerating the keystore file. You can do this by following the steps in the Android documentation: https://developer.android.com/studio/publish/app-signing#generate-key.
If you continue to have issues, it might be helpful to try running the apksigner tool with the -v flag to enable verbose output. This can provide additional information that can help you troubleshoot the problem.
I definitely had to create the 'android.keystore' from Android Studio, because the one that generates bubblewrap didn't work.
After creating the keystore, I ran 'bubblewrap init --manifest= ...' before 'bubblewrap build'. Note that Android Studio generates the keystore with the '.jks' extension, so it must be specified when configuring it in the 'init'
I am also facing same issue , I am using bubblewrap for react pwa. when i am creating the build that time the java exception error is coming from android sdk.
![Uploading err.png…]()
Hi @EduardoChavero , Did it work after you generated the keystone from the android studio? If yes, Can you please lead me to any article video to generate keystore with android studio? Thanks
Hey, I'm getting this kind of error when i run bubblewrap build Installing Android Build Tools. Please, read and accept the license agreement. build Installing Build Tools Error: Could not find or load main class s Caused by: java.lang.ClassNotFoundException: s
cli ERROR undefined I have let bubblewrap install its own jdk and android sdk.
I am running into the same error of cli error undefined
when trying to run bubblewrap build
.
I am using node v20.10.0 (windows 10) and I'm following the steps found here: https://developers.google.com/codelabs/pwa-in-play#1
I am letting bubblewrap handle all the install dependencies and generate new key information. Steps have been successful up until trying the bubblewrap build
step.
I'm also using a site.webmanifest file rather than the suggested .json file. Not sure whether that's relevant ( it doesn't seem to have an obvious issue with it).
build Installing Build Tools Error: Could not find or load main class myuserdir.bubblewrap\android_sdk\tools\bin\.. Caused by: java.lang.ClassNotFoundException: myuserdir\/bubblewrap\android_sdk\tools\bin\//
@designerjason what's your JRE version? Also, can you restart in a clean slate by removing ~/.bubblewrap folder?
@ibrahimkarahan bubblewrap seems to install two JRE versions: jdk-11.0.9.1+1
and jdk11u-jdk-11.0.9.1-1
Note this was already from a clean slate as it's the first time I've installed bubblewrap. I did try to run a clean slate a couple of times after that, but still had the same issue. In the meantime I've been able to compile my build fine using this tool: https://www.pwabuilder.com/
The 'bubblewrap build' command is failing, throwing a CLI undefined error: but before then it states that:
Warning: Failed to find package 'Downloaded'
Why is this happening and what package which was downloaded is it failing to find?