22 Nov 2018 - tsp
Last update 18 Dec 2019
2 mins
Note: The following method does not work any more! It’s to my knowledge not possible to circumvent aapt2 during the build process and not possible to run the binary (not even with the binary compatibility layer because it gets downloaded by gradle every time so branding doesn’t work). I’ve given up on using Android Studio on FreeBSD and went on to run it on a remote Linux VM and use X11 forwarding.
Note that the following instructions require Java to be installed already. Java is available via the java/openjdk8
port or package.
There are three parts to development on FreeBSD:
Note that FreeBSD is not a supported platform so things may break or not work as fluently as on other platforms. Another thing to note is that most tools that are implemented as shell-scripts may need modification (simply changing #!/bin/bash to #!/bin/sh is enough most of the time, don’t ask why they’ve used bash in the first place)
Download and unzip android SDK (cli tools), extract (unzip) …
cd ${ANDROID_HOME}
fetch https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip
unzip sdk-tools-linux-4333796.zip
cd tools
And install the SDKs you want to use. Available SDKs can be listed with
./sdkmanager --list
./sdkmanager --install "platforms;android-26"
./sdkmanager --install "platforms;android-18"
./sdkmanager --install "platforms;android-10"
./sdkmanager --install "extras;google;m2repository"
./sdkmanager --install "extras;google;google_play_services"
./sdkmanager --install "extras;android;m2repository"
./sdkmanager --install "docs"
These are available via ports/packages
at devel/android-tools-adb
and devel/android-tools-fastboot
and
can be installed either via
pkg install devel/android-tools-adb
pkg install devel/android-tools-fastboot
or via
cd /usr/ports/devel/android-tools-adb
make install && make clean
cd /usr/ports/devel/android-tools-fastboot
make install && make clean
First download and extract the zip file to an appropriate location
fetch https://dl.google.com/dl/android/studio/ide-zips/3.2.1.0/android-studio-ide-181.5056338-linux.zip
unzip https://dl.google.com/dl/android/studio/ide-zips/3.2.1.0/android-studio-ide-181.5056338-linux.zip
Add disable.android.first.run=true
to
android-studio/bin/idea.properties
`
Then one can launch (and really use) Android Studio via
./studio.sh
Note that some features like additionally loaded binary tools by gradle require the linux and linux64
compatibility layers loaded into the kernel. Also note that you have to configure your projects to use
the JRE from the JDK at /usr/local/openjdk8
and not the bundled one (you might encounter that problem
if the initial gradle sync fails)
This article is tagged:
Dipl.-Ing. Thomas Spielauer, Wien (webcomplains389t48957@tspi.at)
This webpage is also available via TOR at http://rh6v563nt2dnxd5h2vhhqkudmyvjaevgiv77c62xflas52d5omtkxuid.onion/