A template project in Scala 3 for the latest Android Studio translated from Java.
Android Studio is currently quite opinionated towards Kotlin,
so a Java module is not an option you get in the New > New Project… menu.
If you want to use Scala 3 together with Kotlin, starting from the standard Kotlin template, please check https://github.com/mcallisto/Scala-3-Android-Studio-Kotlin-template.
Helping the adoption of Scala in Android Studio.
This is the Scala project you get if:
-
in Android Studio Narwhal 4 Feature Drop | 2025.4.1 you create an
appmodule with the Fragment + ViewModel template. -
then add a minimal Scala 3.3.7 module named
coreand call it from theappmodule -
use STTP to query ScalaDex and display the results. Credits and big thanks for this to @keynmol
-
translate to Scala the activity, fragment and model Java code in the
appmodule
Because is the first LTS Scala version shipping scala/scala3#22632, backported from the 3.7.x lineage. The emitted Scala code is more compatible with Android ART.
Since currently all Scala libraries are not yet published to Maven Central with this version,
the workaround is to let Android R8 minify the code,
so minifyEnabled true must be set even for debug builds.
In this project two different solutions coexist:
-
The
appmodule is built using the scala-android-plugin, which is brilliantly designed to work with the official Android Gradle Plugin (AGP). -
The separate
coremodule is built with the official Gradle Scala Plugin, which is not compatible with AGP.