How do I install bundletool?

Viewed 52482

Although the docs mentioned

If you haven't already done so, download bundletool from the GitHub repository.

However, the repo contains only a jar file. How do I install it so that I can run with the 'bundletool' command just like the docs' example?

8 Answers

If you have brew installed simply run brew install bundletool and the alias will be set up for you as well. It did the trick for me.

You can create an alias (or doskey on Windows), e.g.

alias bundletool='java -jar bundletool-all.jar'

Another alternative is access Bundletool release page and download the bundletool-all-[LAST-VERSION].jar file into some directory.

After that you could run it on the directory calling:

java -jar bundletool-all-0.10.2.jar your_arguments_here

If you want, rename the jar file to bundletool.jar, then run it calling:

java -jar bundletool.jar your_arguments_here

If you don't want call java every time, you can create an alias for that, and after that run quicly:

alias bundletool='java -jar bundletool-all.jar'

bundletool your_arguments_here

On a mac, it can be easily done using homebrew

brew install bundletool

then you can run commands like this

bundletool install-apks --apks=release.apks

you can use the command below to generate apks

bundletool build-apks --bundle=aab_path.aab --output=release.apks

The above command generates apks file which can later be extracted to give various apk files.

To make shortcut/alias in Windows 10, in cmd run:

@doskey bundletool=java -jar <youPath>\bundletool-all.jar $*

You must be already added Java folder path to system environment variables or just google it.

As for me, on windows, I just set assoc and ftype so that .jar will open with java -jar

First I download bundletool.someversion.jar into some folder under PATH env (so that it would exposed)

Open cmd as admin and link .jar to jarfile with cmd assoc .jar=jarfile (actually can be any name, make it jarfile is just convention in the same way as other file)

Then ftype jarfile=^%JAVA_HOME^%\bin\java.exe -jar %1 %~2

https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/ftype

Then we could execute bundletool.someversion.jar or any jar to open it as java directly

Apparently for Linux you have to download the jar from: https://github.com/google/bundletool/releases

and then run java -jar <PATH_TO_JAR> ...

to simplify things you can add in /usr/local/bin/ a bundletool script

#!/usr/bin/env zsh
exec java -jar "$HOME/path/to/jar" "$@"

and sudo chmod +x /usr/local/bin/bundletool

Now you can run bundletool from wherever you want

You don't need to have

brew.

Install it somewhere, but not in your project directory
npm install bundletool

Related