Change location of android keystore for bubblewrap

117 Views Asked by At

We have used Bubblewrap to create a wrapper application for our progress web app, and we have successfully deployed it to the Google Play store. The original developer who created the wrapper app with Bubblewrap checked his code into our source code repository such that c:\my-pwa is the root folder for the application.

Now I have checked out this code and it sits on my workstation in the folder C:\Dev\bubblewrap-apps\dev-bubblewrap. When I try performing a 'bubble wrap' build command, I get an error saying "The system cannot find the path specified", and here is the full output:

C:\Dev\bubblewrap-apps\dev-bubblewrap>bubblewrap build
,-----.        ,--.  ,--.  ,--.
|  |) /_,--.,--|  |-.|  |-.|  |,---.,--.   ,--,--.--.,--,--.,---.
|  .-.  |  ||  | .-. | .-. |  | .-. |  |.'.|  |  .--' ,-.  | .-. |
|  '--' '  ''  | `-' | `-' |  \   --|   .'.   |  |  \ '-'  | '-' '
`------' `----' `---' `---'`--'`----'--'   '--`--'   `--`--|  |-'
                                                       `--'
Please, enter passwords for the keystore C:\my-pwa\android.keystore and alias android.

? Password for the Key Store: ********
? Password for the Key: ********

Building the Android App...


cli ERROR Command failed: C:\Users\myuser\.bubblewrap\jdk\jdk-11.0.9.1+1\bin\java.exe -Xmx1024M -Xss1m -jar C:\Users\myuser\.bubblewrap\android_sdk\build-tools\33.0.2\lib\apksigner.jar sign --ks C:\my-pwa\android.keystore --ks-key-alias android --ks-pass pass:Password --key-pass pass:Password --out ./app.apk ./app-release.apk
Failed to load signer "signer #1"
java.io.FileNotFoundException: C:\my-pwa\android.keystore (The system cannot find the path specified)
    at java.base/java.io.FileInputStream.open0(Native Method)
    at java.base/java.io.FileInputStream.open(FileInputStream.java:219)
    at java.base/java.io.FileInputStream.<init>(FileInputStream.java:157)
    at java.base/java.io.FileInputStream.<init>(FileInputStream.java:112)
    at com.android.apksigner.SignerParams.loadKeyStoreFromFile(SignerParams.java:361)
    at com.android.apksigner.SignerParams.loadPrivateKeyAndCertsFromKeyStore(SignerParams.java:248)
    at com.android.apksigner.SignerParams.loadPrivateKeyAndCerts(SignerParams.java:181)
    at com.android.apksigner.ApkSignerTool.getSignerConfig(ApkSignerTool.java:419)
    at com.android.apksigner.ApkSignerTool.sign(ApkSignerTool.java:336)
    at com.android.apksigner.ApkSignerTool.main(ApkSignerTool.java:92)

C:\Dev\bubblewrap-apps\dev-bubblewrap>

So the build is failing because its looking for the keystore in the same location as where the original developer had put it. I've found that I can get around this by manually changing the twa-manifest.json file from this:

"signingKey": {
  "path": "C:\\my-pwa\\android.keystore",
  "alias": "android"
},

to this:

"signingKey": {
  "path": "C:\\Dev\\bubblewrap-apps\\dev-bubblewrap\\android.keystore",
  "alias": "android"
},

What I'm wondering is if there's a more graceful way of handling this than cracking open the twa-manifest.json file and updating it? It seems to me like there should be some sort of bubblewrap command to handle this.

0

There are 0 best solutions below