react / react/react-native

ReactNativeApplicationEntryPoint.java doesn't generate correctly during release .aab build

Offen
#52,754 24 Kommentare 3 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Issue: Author Provided Repro Needs: Triage :mag:
Vorherrschende Sprache
C++
Sterne
127k
Forks
25.3k
Ø Merge
1 T. 23 Std.
Gemergte PRs (30 T.)
4

Beschreibung

Description

Hey everyone, my set:

    "react": "19.1.0",
    "react-native": "0.80.1",

devDependencies:
    "@react-native-community/cli": "19.0.0",
    "@react-native-community/cli-platform-android": "19.0.0",
    "@react-native-community/cli-platform-ios": "19.0.0",
    "babel-plugin-react-compiler": "^19.1.0-rc.2",

I’m experiencing (what seems to be?) a non-standard caching issue that did not occur in previous versions of React Native.

Previously, on react-native: 0.76.9 and react: 18.3.1, I did not encounter this problem.

Context

My app uses a shared codebase but serves multiple clients/entities. I achieve this by using react-native-config to switch between .env files. Each flavor has different keys and assets (logos, etc.). So essentially, I have multiple apps with the same code, but different .env configurations and resources.

I build each version with a command like:
cd android && ./gradlew bundle[Appname]app

Problem

During build, the file:
android/app/build/generated/autolinking/src/main/java/com/facebook/react/ReactNativeApplicationEntryPoint.java

somehow gets injected with stale .env data — specifically this block:
if (com.[company].[Appname].BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) { DefaultNewArchitectureEntryPoint.load(); }

Now here’s the strange part:
• The [Appname] used in this file is outdated — it does not match the currently selected .env file.
• In fact, the outdated [Appname] no longer exists in any .env file, yet it still gets inserted into the generated Java class.
• Console logs during the Gradle build clearly show the correct current values.
• I also verified the build.gradle flavor setup:

flavorDimensions "env"
productFlavors {
  project.ext.envConfigFiles.each { flavorName, _ ->
    "$flavorName" {
      dimension 'env'
    }
  }
}

Everything seems to be correct.

What I Tried:

• ./gradlew clean — did not help.
• Manually clearing the android/app/build directory — did not help.
• Only thing that helps: deleting yarn.lock and reinstalling with yarn install — which makes me suspect some kind of caching is happening inside node_modules.

From what I’ve read, autolinking is handled by the @react-native-community/cli package — so maybe it’s caching something unexpectedly?

Thanks in advance for any help, and have a great day! 🙌

Steps to reproduce
•	Execute `yarn install` inside the ReproducerApp directory.
•	From the root directory, run `yarn run android`. At this stage, the application should build and launch successfully. For testing, I used the Android Studio emulator Pixel 3a API 35.
•	Next, run the script from the root directory: `node runme.js`. This is a small utility script that replaces the application name required in several places. On previous React Native versions, this process worked without any issues.
•	Upon execution, the console should confirm that the application name substitution was successful.
•	Finally, run `yarn run android` again - and at this point, the error occurs.
React Native Version

0.80.1

Affected Platforms

Build - MacOS

Output of npx @react-native-community/cli info
System:
  OS: macOS 15.5
  CPU: (8) arm64 Apple M2
  Memory: 130.05 MB / 16.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 18.20.5
    path: ~/.nvm/versions/node/v18.20.5/bin/node
  Yarn:
    version: 3.6.4
    path: ~/.yarn/bin/yarn
  npm:
    version: 10.8.2
    path: ~/.nvm/versions/node/v18.20.5/bin/npm
  Watchman:
    version: 2024.12.02.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.15.2
    path: /opt/homebrew/lib/ruby/gems/3.3.0/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 24.4
      - iOS 18.4
      - macOS 15.4
      - tvOS 18.4
      - visionOS 2.4
      - watchOS 11.4
  Android SDK: Not Found
IDEs:
  Android Studio: 2025.1 AI-251.25410.109.2511.13665796
  Xcode:
    version: 16.3/16E140
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.9
    path: /usr/bin/javac
  Ruby:
    version: 3.3.6
    path: /opt/homebrew/opt/ruby/bin/ruby
npmPackages:
  "@react-native-community/cli":
    installed: 19.0.0
    wanted: 19.0.0
  react:
    installed: 19.1.0
    wanted: 19.1.0
  react-native:
    installed: 0.80.1
    wanted: 0.80.1
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: true
iOS:
  hermesEnabled: true
  newArchEnabled: true
Stacktrace or Logs
/Users/arturbuja/Desktop/app/[companyName]/android/app/build/generated/autolinking/src/main/java/com/facebook/react/ReactNativeApplicationEntryPoint.java:29: error: package com.[companyName].[appBuildId#1] does not exist
    if (com.[companyName].[appBuildId#1].BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
                                ^
1 error

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:compile[companyName]appDebugJavaWithJavac'.
> Compilation failed; see the compiler output below.
  /Users/arturbuja/Desktop/app/[companyName]/android/app/build/generated/autolinking/src/main/java/com/facebook/react/ReactNativeApplicationEntryPoint.java:29: error: package com.[companyName].[appBuildId#1] does not exist
      if (com.[companyName].[appBuildId#1].BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
                                  ^
  1 error

* Try:
> Check your code and dependencies to fix the compilation error(s)
> Run with --scan to get full insights.

BUILD FAILED in 4s
error Failed to install the app. Command failed with exit code 1: ./gradlew app:installRoboticketappDebug -PreactNativeDevServerPort=8081 -PreactNativeArchitectures=arm64-v8a
/Users/arturbuja/Desktop/app/[companyName]/android/app/build/generated/autolinking/src/main/java/com/facebook/react/ReactNativeApplicationEntryPoint.java:29: error: package com.[companyName].[appBuildId#1] does not exist if (com.[companyName].[appBuildId#1].BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) { ^
1 error FAILURE: Build failed with an exception. * What went wrong:
Execution failed for task ':app:compile[companyName]appDebugJavaWithJavac'.
> Compilation failed; see the compiler output below. /Users/arturbuja/Desktop/app/[appName]/android/app/build/generated/autolinking/src/main/java/com/facebook/react/ReactNativeApplicationEntryPoint.java:29: error: package com.[companyName].[appBuildId#1] does not exist if (com.[companyName].[appBuildId#1].BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) { ^ 1 error * Try:
> Check your code and dependencies to fix the compilation error(s)
> Run with --scan to get full insights. BUILD FAILED in 4s.
info Run CLI with --verbose flag for more details.
MANDATORY Reproducer

(https://github.com/ArturBuja/Repro_error_build)

Screenshots and Videos

No response

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne mit dem obligatorischen Repro_error_build-Reproducer, führe yarn install, yarn run android und node runme.js aus und anschließend erneut yarn run android. Untersuche android/app/build/generated/autolinking/src/main/java/com/facebook/react/ReactNativeApplicationEntryPoint.java und die gemeldete Gradle-Aufgabe; als erledigt gilt es, wenn der generierte Einstiegspunkt den ausgewählten Anwendungsnamen verwendet und der wiederholte Build erfolgreich abgeschlossen wird.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
java, react-native
Bereich
build-system, mobile
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.