cant execute buildtool jar file to extract apks from abb file

336 Views Asked by At

when I typing in this :

C:\Users\Ora Ora\Desktop\Dev\React\Native\Abb to APk>>java -jar bundletool-all-1.4.0.jar //..rest of args

I get thsi error :

'-jar' is not recognized as an internal or external command, operable program or batch file. but when I type in when I typing in this :

C:\Users\Ora Ora\Desktop\Dev\React\Native\Abb to APk>>$ java -jar bundletool-all-1.4.0.jar //..rest of args

I gues it works but I'm getting this error :

[BT:1.4.0] Error: null java.lang.NullPointerException at com.android.tools.build.bundletool.model.SignerConfig.lambda$extractFromKeystore$0(SignerConfig.java:109) at java.base/java.util.Optional.orElseGet(Optional.java:362) at com.android.tools.build.bundletool.model.SignerConfig.extractFromKeystore(SignerConfig.java:106) at com.android.tools.build.bundletool.commands.BuildApksCommand.populateSigningConfigurationFromFlags(BuildApksCommand.java:1059) at com.android.tools.build.bundletool.commands.BuildApksCommand.fromFlags(BuildApksCommand.java:593) at com.android.tools.build.bundletool.commands.BuildApksCommand.fromFlags(BuildApksCommand.java:559) at com.android.tools.build.bundletool.BundleToolMain.main(BundleToolMain.java:75) at com.android.tools.build.bundletool.BundleToolMain.main(BundleToolMain.java:47)

here is the full command :

java -jar bundletool-all-1.4.0.jar build-apks --bundle="C:\Users\Ora Ora\Desktop\Dev\React\Native\Abb to APk\app-release.aab" --output="C:\Users\Ora Ora\Desktop\Dev\React\Native\Abb to APk\apks.apks" --ks="C:\Users\Ora Ora\Desktop\Dev\React\Native\DistributionApp\android\app\my-upload-key.keystore" --ks-key-alias=my-key-alias
1

There are 1 best solutions below

0
On

Looking at the source code (bundletool is open-source), it looks like you're running a Java environment that does not provide a console for you to enter the password.

I recall this is an issue on Windows platforms and I don't know an immediate workaround to enter the password on the command line.

However, you can provide the password in different ways, e.g. passing the --ks-pass flag. From bundletool's help command:

--ks-pass: (Optional) Password of the keystore to use to sign the generated APKs. If provided, must be prefixed with either 'pass:' (if the password is passed in clear text, e.g. 'pass:qwerty') or 'file:' (if the password is the first line of a file, e.g. 'file:/tmp/myPassword.txt'). If this flag is not set, the password will be requested on the prompt.

Same for --key-pass in case the password of the key is different from the password from the keystore.

--key-pass: (Optional) Password of the key in the keystore to use to sign the generated APKs. If provided, must be prefixed with either 'pass:' (if the password is passed in clear text, e.g. 'pass:qwerty') or 'file:' (if the password is the first line of a file, e.g. 'file: /tmp/myPassword.txt'). If this flag is not set, the keystore password will be tried. If that fails, the password will be requested on the prompt.