Android Studio move so fast, the developer and ide tools are racing each other.
These are must you backup:
- Project name
- Your key file i.e jks for your project
- your project source
- <root_app> all files exlude folder .gradle .idea build eclude file.gitignore
- <root_app>/app all files include folder src, remove all folder remove file .gitignore
- <root_app>/gradle all exclude ./gradle/wrapper/gradle-wrapper.jar
For upgrading from old project, and your project does not have libs.versions.toml file:
- Create it (see below) or copy from other project.
- change build.gradle.kts (:app)
plugins {
id("com.android.application")
}
plugins {
alias(libs.plugins.android.application)
}
dependencies {
implementation("androidx.appcompat:appcompat:1.7.1")
implementation("com.google.android.material:material:1.12.0")
implementation("androidx.constraintlayout:constraintlayout:2.2.1")
testImplementation("junit:junit:4.13.2")
androidTestImplementation("androidx.test.ext:junit:1.2.1")
androidTestImplementation("androidx.test.espresso:espresso-core:3.6.1")
implementation("com.google.android.gms:play-services-ads-lite:24.0.0")
}
dependencies {
implementation(libs.appcompat)
implementation(libs.material)
testImplementation(libs.junit)
androidTestImplementation(libs.ext.junit)
androidTestImplementation(libs.espresso.core)
// admob
implementation(libs.play.services.ads)
}
- Update your libs.versions.toml, revise the version of necessary:
[versions]
agp = "8.13.0"
junit = "4.13.2"
junitVersion = "1.3.0"
espressoCore = "3.7.0"
appcompat = "1.7.1"
material = "1.13.0"
playServicesAds = "24.7.0"
[libraries]
junit = { group = "junit", name = "junit", version.ref = "junit" }
ext-junit = { group = "androidx.test.ext", name = "junit", version.ref = "junitVersion" }
espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espressoCore" }
appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "appcompat" }
material = { group = "com.google.android.material", name = "material", version.ref = "material" }
play-services-ads = { module = "com.google.android.gms:play-services-ads", version.ref = "playServicesAds" }
[plugins]
android-application = { id = "com.android.application", version.ref = "agp" }
Note: if you have other external dependency, keep the library first, and migrate after common library successfully upgraded.
To create libs.versions.toml, at left side Project Files -> gradle -> New -> File, name it with: libs.versions.toml. Continue step 2 above.