Consider filing an upstream issue with react-native-test-app to unblock the AGP 9 opt-outs
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 42/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Tranquilo
- Stack tecnológico
- android, kotlin, react-native
- Área
- build-system, mobile
Línea de trabajo
Vuelve a comprobar la versión actual de react-native-test-app y el issue tracker upstream, y luego inspecciona android/app/build.gradle y android/support/build.gradle alrededor de las líneas enlazadas. Reproduce el fallo de compilación de AGP 9 si hay disponible una toolchain de Android; se considera hecho presentar un informe upstream actual con referencias verificadas, o confirmar que es preferible un PR probado.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
#389 tracks dropping the AGP 9 opt-outs from the test app. We can't close it ourselves: the remaining blockers are both in react-native-test-app, and nobody upstream is tracking either (searched microsoft/react-native-test-app for newDsl, builtInKotlin and AGP 9 DSL — no issues, no PRs).
So this is the decision: do we report it upstream, and in what form? Filing costs nothing and the text is written. Someone with a working Android toolchain might reasonably prefer to send a PR for the built-in Kotlin half, which is a two-line change.
What we learned by building it
An earlier revision of this issue claimed the new DSL was the only blocker and that we were already running built-in Kotlin. That was wrong, and only a real Android build showed it. Building the test app with android.builtInKotlin unset (react-native-test-app 5.4.8, React Native 0.88 nightly, AGP 9.2.1) fails in react-native-test-app's own Kotlin:
e: ComponentActivity.kt:33:9 Unresolved reference 'ComponentActivityDelegate'
e: MainActivity.kt:145:9 Unresolved reference 'testApp'
e: MainActivity.kt:225:50 Unresolved reference 'reactHost'
e: MainActivity.kt:135:17 Unresolved reference 'canUseCamera'
e: MainActivity.kt:25:45 Unresolved reference 'ComponentBottomSheetDialogFragment'
Every unresolved symbol is defined in a directory the app module adds through main.java.srcDirs +=. Files under the standard src/main/java compile; nothing from an added directory does. The Kotlin plugin adds those directories to the Kotlin source set, AGP's built-in Kotlin does not.
So there are two independent blockers, and the useBuiltInKotlin gate addresses neither — it prevents the plugin-conflict failure, but the module still needs the plugin to compile at all.
Two things that shape the ask
- react-native-test-app is mirroring React Native, not making its own call. The commit that added the opt-outs (11c4fff) says "See react-native-community/template@775d99a". Asking them to change the template default is asking them to diverge from React Native, and they'd be right to decline. The ask is only that their modules stop forcing the opt-outs on projects that are otherwise ready.
- The flags are coupled, one way.
builtInKotlin=falserequiresnewDsl=false, so the built-in Kotlin fix is a prerequisite for the DSL one, not an alternative to it.
Paste-ready
Title:
Android: react-native-test-app forces both AGP 9 opt-outs on its consumers
Body:
The template ships `android.builtInKotlin=false` + `android.newDsl=false` as of 5.4.2 (11c4fff, mirroring react-native-community/template@775d99a). Those defaults are a sensible ecosystem-wide transition aid and this isn't a request to change them.
The narrower problem: a project that is otherwise ready for AGP 9 still cannot drop either flag, because react-native-test-app's own modules require both. Line references are against `5.4.8`.
## 1. Built-in Kotlin: sources added via `java.srcDirs` are not compiled
[`android/app/build.gradle#L188`](https://github.com/microsoft/react-native-test-app/blob/4d674bcb1773a87e02aa4e3582b1b048219e56cb/android/app/build.gradle#L188) adds the version-specific sources with `main.java.srcDirs += [...]`. The Kotlin plugin adds those directories to the Kotlin source set; AGP's built-in Kotlin only picks up the standard ones, so every Kotlin symbol defined in an added directory goes unresolved.
With `android.builtInKotlin` unset (react-native-test-app 5.4.8, React Native 0.88 nightly, AGP 9.2.1), `:app:compileReleaseKotlin` fails:
e: ComponentActivity.kt:33:9 Unresolved reference 'ComponentActivityDelegate'
e: MainActivity.kt:145:9 Unresolved reference 'testApp'
e: MainActivity.kt:225:50 Unresolved reference 'reactHost'
e: MainActivity.kt:135:17 Unresolved reference 'canUseCamera'
e: MainActivity.kt:25:45 Unresolved reference 'ComponentBottomSheetDialogFragment'
…one per symbol defined under `src/reactactivitydelegate-0.75/java`, `src/reactapplication-0.76/java`, `src/reacthost-0.76/java`, `src/camera/java` and the rest of that list.
The [`useBuiltInKotlin`](https://github.com/microsoft/react-native-test-app/blob/4d674bcb1773a87e02aa4e3582b1b048219e56cb/android/app/build.gradle#L15) gate doesn't cover this — it avoids applying the Kotlin plugin on top of built-in Kotlin, but the module still needs the plugin in order to compile.
Adding the same directories to `main.kotlin.srcDirs` alongside `main.java.srcDirs` should make the module work under both, since the Kotlin plugin honours `kotlin.srcDirs` too. Happy to send that as a PR if you'd prefer.
## 2. New DSL: old DSL in both modules
| Location | Old DSL |
| --- | --- |
| [`android/app/build.gradle#L77`](https://github.com/microsoft/react-native-test-app/blob/4d674bcb1773a87e02aa4e3582b1b048219e56cb/android/app/build.gradle#L77) | `compileSdkVersion` |
| [`android/app/build.gradle#L88`](https://github.com/microsoft/react-native-test-app/blob/4d674bcb1773a87e02aa4e3582b1b048219e56cb/android/app/build.gradle#L88) | `kotlinOptions` (already gated on `!useBuiltInKotlin`) |
| [`android/app/build.gradle#L95-L96`](https://github.com/microsoft/react-native-test-app/blob/4d674bcb1773a87e02aa4e3582b1b048219e56cb/android/app/build.gradle#L95-L96) | `minSdkVersion`, `targetSdkVersion` |
| [`android/app/build.gradle#L161`](https://github.com/microsoft/react-native-test-app/blob/4d674bcb1773a87e02aa4e3582b1b048219e56cb/android/app/build.gradle#L161) | `lintOptions` |
| [`android/support/build.gradle#L16`](https://github.com/microsoft/react-native-test-app/blob/4d674bcb1773a87e02aa4e3582b1b048219e56cb/android/support/build.gradle#L16) | `compileSdkVersion` |
| [`android/support/build.gradle#L19-L20`](https://github.com/microsoft/react-native-test-app/blob/4d674bcb1773a87e02aa4e3582b1b048219e56cb/android/support/build.gradle#L19-L20) | `minSdkVersion`, `targetSdkVersion` |
Since `builtInKotlin=false` requires `newDsl=false`, (1) is a prerequisite for (2) — but (1) is worth doing on its own.
**Why now:** React Native 0.87 pins AGP 9.2.1, and Android's [DSL/API migration timeline](https://developer.android.com/build/releases/gradle-plugin-roadmap) has AGP 10 (estimated late 2026) removing *both* opt-outs outright — at which point every react-native-test-app consumer needs this done, not just the ones opting in early.
Tracked on our side at callstackincubator/react-native-node-api#389.
Before filing
- Re-check that no upstream issue has appeared in the meantime.
- Re-check the line numbers against whatever the current release is — the links are permalinked to
5.4.8(4d674bc), so they stay valid, but the ask should describe current code. - The
main.kotlin.srcDirssuggestion is reasoned from the failure, not tested. Verifying it locally would turn this into a PR, which is the more useful contribution.
- Lenguaje dominante
- TypeScript
- Estrellas
- 188
- Forks
- 10
- Merge medio
- 2 d 17 h
- PR fusionados (30 d)
- 3
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de callstackincubator/react-native-node-api
-
Android 🤖
Dificultad 2/5 1-3 horas Aptitud para principiantes 66/100
-
Sanity check of Hermes source directory via environment variable, when building Android projects AbiertoAndroid 🤖 good first issue
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
callstackincubator/react-native-node-api#163 · 1 comentario ·
-
enhancement good first issue gyp-to-cmake
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
callstackincubator/react-native-node-api#161 · 3 comentarios · 1 reacción ·
-
enhancement Host 🏡
Dificultad 5/5 Más de una semana Aptitud para principiantes 25/100
-
Automatable good first issue
Dificultad 3/5 1-2 días Aptitud para principiantes 15/100
callstackincubator/react-native-node-api#424 · 1 comentario ·
Todos los issues de callstackincubator/react-native-node-api
Issues similares
-
VerificationGate: ATTRIBUTION quote guard never matches a normal quotation (\b around the quote) Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
danielmiessler/LifeOS#2234 ·
-
T: Bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 85/100
-
Mend: dependency security vulnerability untriaged
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100