Simple template for MVVM with XML (Activity & Fragment) in Android, without Compose. (Compose version)
- Notices
- The INTERNET permission is enabled in the Manifest because there's a basic Retrofit2 usage.
BuildConfig
is enabled inbuild.gradle
to securely use important variables, such asBuildConfig.API_KEY
.- Put important variables in
keys.properties
. It'll be loaded inbuild.gradle
.
- Core Versions
agp = "8.3.0"
kotlin = "1.9.0"
room = "2.6.1"
hilt = "2.51.1"
gson = "2.10.1"
retrofit2 = "2.11.0"
ksp = "1.9.0-1.0.13"
okhttpLogging = "4.12.0"
- git clone this repo
git clone https://github.com/jhj0517/android-template-mvvm-xml.git
- Modify git remote url with yours
git remote set-url origin git@github.com:your_name/repo_name.git
- Go to the Project Files tab in the File Tree view within Android Studio, not the Android or Project tab.
- Change the
namespace
andapplicationId
in the module-levelbuild.gradle
.
android {
namespace = "com.jhj0517.android_template_mvvm_xml" // Change
defaultConfig {
applicationId = "com.jhj0517.android_template_mvvm_xml" // Change
}
}
- Change the
rootProject.name
in thesettings.gradle
rootProject.name = "android-template-mvvm-xml" // Change
- Build -> Clean Project -> Rebuild Project
- You're now ready to start your new project.