Setting Up Your Mac for Android Development Using Tauri

To get started with android development using Tauri you'll need a few things to get setup. In this guide we'll install Java, Android Studio, and NDK.

Installing Java

If you're on a mac you can install Java using brew. you can install brew here if you don't have it.

brew install openjdk@17

Next add the following to your .bash_profile or .zshrc

export PATH="$PATH:/opt/homebrew/opt/openjdk@17/bin"
export JAVA_HOME="/opt/homebrew/opt/openjdk@17"

Then reload the file:

source ~/.zshrc

Install Android Studio and NDK

Next go install Android Studio. Android Studio will let us install other dependancies and run android emulators.
Once you have that installed and running install the Native Development Kit (NDK) by opening the settings, then go to "Languages and Frameworks" > "Android SDK" > click the "SDK Tools" tab, find "NDK (Side by side)" and check the box and click the "Apply" button. It will open a window to finish the install and agree to a license. When it installs there will be a message that reads like this:
"Packages to install: - NDK (Side by side) 28.0.12433566 (ndk;28.0.12433566)" the number there is the version number, copy the whole version number and we will use it in the next step.

Go back to your .bash_profile or .zshrc and add two more environment variables

export ANDROID_HOME="$HOME/Library/Android/sdk"
export NDK_HOME="$HOME/Library/Android/sdk/ndk/<version>"

If you need to find the correct directory you can run this:

ls ~/Library/Android/sdk/ndk

Then source the file again

source ~/.zshrc

If you have a Tauri project setup for mobile you should now be able to run it on android using

npx tauri android dev

It should start the emulator for you and open the app once it installs into the emulator. You're now ready to start working on your Android app.

For more info on android development visit the Android docs.