Android Initial Setup
This page provides an overview of the initial setup required for building Android applications using Mill.
1. Install Mill
Don’t have Mill installed yet? You can follow the steps as described in Installation & IDE Setup
2. SDK cmdline-tools
Mill requires the Android SDK cmdline-tools
to build Android applications.
Ensure the $ANDROID_HOME
environment variable is set (typically to ~/Android/Sdk
).
Mill will automatically install and use the 19.0
version.
To use a different version, override cmdlineToolsVersion
in your build.mill
.
The SDK package licenses must be accepted before installing new packages.
If not accepted, Mill will throw an error with instructions.
You can also configure Mill to automatically accept the licenses by overriding |
object androidSdkModule0 extends AndroidSdkModule {
override def cmdlineToolsVersion = "17.0"
// Or
override def cmdlineToolsVersion = "latest"
// Automatically accept licenses
override def autoAcceptLicenses = true
}
This feature is still experimental.
If any issues occur with the automatic installation, you can manually install the |
3. Create a new Mill project
The structure of a Mill project and the relative Android commands can be found in the following pages:
If you want to start with an example project, you can use the init
command as shown in this page.
5. Release the project
By default, mill projects are considered in debug mode, so if your project is ready for release, you should add the following to your app object in the build.mill
file:
override def androidIsDebug = Task { false }
def androidReleaseKeyName: Option[String] = Some("releaseKey.jks")
def androidReleaseKeyAlias: T[Option[String]] = Task { Some("releaseKey") }
def androidReleaseKeyPass: T[Option[String]] = Task { Some("MillBuildTool") }
def androidReleaseKeyStorePass: T[Option[String]] = Task { Some("MillBuildTool") }
Make sure to replace the values with your actual keystore information.
If you don’t have a keystore yet, you can create one using the keytool
command:
keytool -genkey -v -keystore releaseKey.jks \
-storepass <PASS> -keyalg RSA \
-keysize 2048 -validity 10000 \
-alias releaseKey -keypass <PASS>