How do I install bundletool?

AndroidAndroid App-Bundle

Android Problem Overview


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?

Android Solutions


Solution 1 - Android

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.

Solution 2 - Android

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

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

Solution 3 - Android

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

Solution 4 - Android

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.

Solution 5 - Android

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.

Solution 6 - Android

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

Solution 7 - Android

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

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionVincent PaingView Question on Stackoverflow
Solution 1 - AndroidflarkmarupView Answer on Stackoverflow
Solution 2 - AndroidPierreView Answer on Stackoverflow
Solution 3 - AndroidTiago GouvêaView Answer on Stackoverflow
Solution 4 - AndroidTushar SahaView Answer on Stackoverflow
Solution 5 - AndroidGg MView Answer on Stackoverflow
Solution 6 - AndroidThaina YuView Answer on Stackoverflow
Solution 7 - AndroidJ.StangeView Answer on Stackoverflow