Skip to content

React Native Android build fails with "package com.facebook.react.common.annotations.internal does not exist" on React Native 0.78 #52123

Closed
@ChinmayLale

Description

@ChinmayLale

Description

I'm encountering a build failure when running yarn android for my React Native project (RN 0.78). The error occurs during :app:compileDebugJavaWithJavac and seems related to autogenerated New Architecture files. iOS builds work fine.

Error Snippet:

/Users/socon/Documents/Chinmay/socon-mobile/android/app/build/generated/autolinking/src/main/java/com/facebook/react/ReactNativeApplicationEntryPoint.java:8: error: package com.facebook.react.common.annotations.internal does not exist import com.facebook.react.common.annotations.internal.LegacyArchitectureLogger;

What I've tried:

  1. ./gradlew clean (succeeds but doesn't resolve)
  2. ./gradlew build fails with same error
  3. Toggled newArchEnabled in gradle.properties (both true/false)
  4. Cleared all caches (yarn cache clean, ./gradlew clean, deleted node_modules, android/.gradle, android/build)
  5. Verified React Native doctor (npx react-native doctor shows no issues)

Environment:

  • React Native: 0.78.0
  • React: 19.0.0
  • Vision Camera: 4.6.4
  • Gradle: 8.12 (with JDK 17)

package.json

Steps to reproduce

  1. Install All deps in package.json
  2. newArchEnable=true in build.gradle
  3. try to run

React Native Version

0.78.0

Affected Platforms

Build - MacOS

Areas

Other (please specify), Fabric - The New Renderer

Output of npx @react-native-community/cli info

System:
  OS: macOS 15.5
  CPU: (8) arm64 Apple M2
  Memory: 131.34 MB / 8.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 20.14.0
    path: ~/.nvm/versions/node/v20.14.0/bin/node
  Yarn:
    version: 4.8.1
    path: ~/.nvm/versions/node/v20.14.0/bin/yarn
  npm:
    version: 10.7.0
    path: ~/.nvm/versions/node/v20.14.0/bin/npm
  Watchman:
    version: 2025.04.28.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.16.2
    path: /Users/socon/.rbenv/shims/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 24.5
      - iOS 18.5
      - macOS 15.5
      - tvOS 18.5
      - visionOS 2.5
      - watchOS 11.5
  Android SDK:
    API Levels:
      - "33"
      - "34"
      - "35"
    Build Tools:
      - 30.0.3
      - 34.0.0
      - 35.0.0
      - 35.0.1
      - 36.0.0
    System Images:
      - android-28 | Google ARM64-V8a Play ARM 64 v8a
      - android-29 | Google Play ARM 64 v8a
      - android-34 | Google Play ARM 64 v8a
      - android-35 | Google Play ARM 64 v8a
    Android NDK: Not Found
IDEs:
  Android Studio: 2024.3 AI-243.26053.27.2432.13536105
  Xcode:
    version: 16.4/16F6
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.11
    path: /usr/bin/javac
  Ruby:
    version: 3.2.2
    path: /Users/socon/.rbenv/shims/ruby
npmPackages:
  "@react-native-community/cli":
    installed: 15.0.1
    wanted: 15.0.1
  react:
    installed: 19.0.0
    wanted: 19.0.0
  react-native:
    installed: 0.78.0
    wanted: 0.78.0
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: true
iOS:
  hermesEnabled: true
  newArchEnabled: true

info React Native v0.80.0 is now available (your project is running on v0.78.0).
info Changelog: https://github.com/facebook/react-native/releases/tag/v0.80.0
info Diff: https://react-native-community.github.io/upgrade-helper/?from=0.78.0&to=0.80.0
info For more info, check out "https://reactnative.dev/docs/upgrading?os=macos".

Stacktrace or Logs

> Task :app:compileDebugJavaWithJavac FAILED

[Incubating] Problems report is available at: file:///Users/socon/Documents/Chinmay/socon-mobile/android/build/reports/problems/problems-report.html

Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

For more on this, please refer to https://docs.gradle.org/8.12/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.
489 actionable tasks: 1 executed, 488 up-to-date

info 💡 Tip: Make sure that you have set up your development environment correctly, by running npx react-native doctor. To read more about doctor command visit: https://github.com/react-native-community/cli/blob/main/packages/cli-doctor/README.md#doctor 

/Users/socon/Documents/Chinmay/socon-mobile/android/app/build/generated/autolinking/src/main/java/com/facebook/react/ReactNativeApplicationEntryPoint.java:8: error: package com.facebook.react.common.annotations.internal does not exist
import com.facebook.react.common.annotations.internal.LegacyArchitectureLogger;
                                                     ^
1 error

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler output below.
  /Users/socon/Documents/Chinmay/socon-mobile/android/app/build/generated/autolinking/src/main/java/com/facebook/react/ReactNativeApplicationEntryPoint.java:8: error: package com.facebook.react.common.annotations.internal does not exist
  import com.facebook.react.common.annotations.internal.LegacyArchitectureLogger;
                                                       ^
  1 error

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

BUILD FAILED in 7s
error Failed to install the app. Command failed with exit code 1: ./gradlew app:installDebug -PreactNativeDevServerPort=8081
/Users/socon/Documents/Chinmay/socon-mobile/android/app/build/generated/autolinking/src/main/java/com/facebook/react/ReactNativeApplicationEntryPoint.java:8: error: package com.facebook.react.common.annotations.internal does not exist
import com.facebook.react.common.annotations.internal.LegacyArchitectureLogger; ^
1 error FAILURE: Build failed with an exception. * What went wrong:
Execution failed for task ':app:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler output below. /Users/socon/Documents/Chinmay/socon-mobile/android/app/build/generated/autolinking/src/main/java/com/facebook/react/ReactNativeApplicationEntryPoint.java:8: error: package com.facebook.react.common.annotations.internal does not exist import com.facebook.react.common.annotations.internal.LegacyArchitectureLogger; ^ 1 error * Try:
> Check your code and dependencies to fix the compilation error(s)
> Run with --scan to get full insights. BUILD FAILED in 7s.
info Run CLI with --verbose flag for more details.

MANDATORY Reproducer

Not Present

Screenshots and Videos

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions