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> remove folders .gradle .idea and build, remove file .gitignore
- <root_app>/app remove folders build, libs and release, remove file .gitignore
- <root_app>/gradle remove file ./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 <root_app>/gradle/libs.versions.toml.
- change build.gradle.kts (:app)into
plugins {id("com.android.application")}Change dependencyplugins {alias(libs.plugins.android.application)}intodependencies {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)// admobimplementation(libs.play.services.ads)} - Update your libs.versions.toml, revise the version if 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.
This is example of external library, how to move jsoup into libs.versions.toml
Change build.gradle.kts (:app) from
dependencies {
...
implementation("org.jsoup:jsoup:1.21.2") // jsoup
}
change into
dependencies {
....
implementation(libs.jsoup)
}
And add into libs.versions.toml
[versions]
...
# Define the version number
jsoup = "1.21.2"
...
[libraries]
...
# Define the library coordinates, referencing the version above
jsoup = { group = "org.jsoup", name = "jsoup", version.ref = "jsoup" }
...




