From 7722d6f2b995292121ef60bf5a567af76b1fbe72 Mon Sep 17 00:00:00 2001 From: Rui Moreira Mendes Date: Tue, 11 Aug 2026 17:27:16 +0100 Subject: [PATCH] fix(cli): declare app/build.gradle dependency versions in cap migrate --- cli/src/tasks/migrate.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/cli/src/tasks/migrate.ts b/cli/src/tasks/migrate.ts index 843bf9629..ac5492174 100644 --- a/cli/src/tasks/migrate.ts +++ b/cli/src/tasks/migrate.ts @@ -553,6 +553,23 @@ async function updateAppBuildGradle(filename: string) { `, '', ); + + if (!replaced.includes('def androidxAppCompatVersion = rootProject.ext.androidxAppCompatVersion')) { + replaced = replaced.replace( + `apply plugin: 'com.android.application'\n\n`, + `apply plugin: 'com.android.application' + +def androidxAppCompatVersion = rootProject.ext.androidxAppCompatVersion +def androidxCoordinatorLayoutVersion = rootProject.ext.androidxCoordinatorLayoutVersion +def coreSplashScreenVersion = rootProject.ext.coreSplashScreenVersion +def junitVersion = rootProject.ext.junitVersion +def androidxJunitVersion = rootProject.ext.androidxJunitVersion +def androidxEspressoCoreVersion = rootProject.ext.androidxEspressoCoreVersion + +`, + ); + } + writeFileSync(filename, replaced, 'utf-8'); }