resolvePath static method
Returns the path to the app-level Gradle file under projectRoot.
Checks build.gradle.kts (Kotlin DSL, RN 0.77+) first, then falls back
to build.gradle (Groovy). Returns null if neither exists.
Layout depends on projectType: native Android (kotlin) has no
android/ wrapper — its Gradle files sit at app/ under
projectRoot. Everything else (Flutter, React Native) uses
android/app/. Defaults to the android/app/ layout so existing
call sites stay backward-compatible.
Implementation
static String? resolvePath(String projectRoot, {String? projectType}) {
final appDir = projectType == 'kotlin'
? p.join(projectRoot, 'app')
: p.join(projectRoot, 'android', 'app');
final kts = p.join(appDir, 'build.gradle.kts');
final groovy = p.join(appDir, 'build.gradle');
if (File(kts).existsSync()) return kts;
if (File(groovy).existsSync()) return groovy;
return null;
}