Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Selectively disabling autolinking for Android in react-native.config.js fails build on 0.75.0-rc.6 #45901

Closed
oblador opened this issue Aug 5, 2024 · 4 comments
Assignees
Labels
API: Linking Platform: Android Android applications. Resolution: Fixed A PR that fixes this issue has been merged.

Comments

@oblador
Copy link
Contributor

oblador commented Aug 5, 2024

Description

Selectively disabling autolinking of a native dependency in react-native.config.js causes build to fail with gradle trying to build it. If the dependency is disabled on both iOS and Android, it doesn't try to build it and build passes.

Looks like #45223 seems to attempt to fix this, but doesn't work for me.

Related:

Steps to reproduce

  1. Create new project with npx @react-native-community/cli@latest init AutolinkingBug --version 0.75.0-rc.6
  2. Add random dependency with native code (e.g. react-native-vector-icons).
  3. Disable said dependency in react-native.config.js, with:
{
  dependencies: {
    'react-native-vector-icons': {
      platforms: {
        android: null,
      },
    },
  },
}

React Native Version

0.75.0-rc.6

Affected Platforms

Other (please specify)

Output of npx react-native info

info Fetching system and libraries information...
System:
  OS: macOS 14.5
  CPU: (10) arm64 Apple M1 Pro
  Memory: 67.98 MB / 32.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 20.11.0
    path: ~/.asdf/installs/nodejs/20.11.0/bin/node
  Yarn:
    version: 1.22.22
    path: /opt/homebrew/bin/yarn
  npm:
    version: 10.2.4
    path: ~/.asdf/plugins/nodejs/shims/npm
  Watchman:
    version: 2023.03.27.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.12.1
    path: /Users/joel/.asdf/shims/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 23.5
      - iOS 17.5
      - macOS 14.5
      - tvOS 17.5
      - visionOS 1.2
      - watchOS 10.5
  Android SDK:
    API Levels:
      - "28"
      - "30"
      - "31"
      - "32"
      - "33"
      - "34"
    Build Tools:
      - 29.0.2
      - 30.0.2
      - 30.0.3
      - 31.0.0
      - 32.0.0
      - 33.0.0
      - 33.0.1
      - 34.0.0
    System Images:
      - android-32 | Google APIs ARM 64 v8a
      - android-33 | Google Play ARM 64 v8a
      - android-34 | Google APIs ARM 64 v8a
    Android NDK: Not Found
IDEs:
  Android Studio: 2023.3 AI-233.14808.21.2331.11842104
  Xcode:
    version: 15.4/15F31d
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.9
    path: /usr/bin/javac
  Ruby:
    version: 3.0.3
    path: /Users/joel/.asdf/shims/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.3.1
    wanted: 18.3.1
  react-native:
    installed: 0.75.0-rc.6
    wanted: 0.75.0-rc.6
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: true
  newArchEnabled: false

Stacktrace or Logs

1: Task failed with an exception.
-----------
* Where:
Build file '/Users/joel/Code/AutolinkingBug/android/app/build.gradle' line: 54

* What went wrong:
A problem occurred evaluating project ':app'.
> Project with path ':react-native-vector-icons' could not be found in project ':app'.

Reproducer

https://github.com/oblador/react-native-android-autolinking-bug-repro

Screenshots and Videos

No response

@oblador
Copy link
Contributor Author

oblador commented Aug 5, 2024

Hmm, I tried reproducing this with a unit test on latest main, but I can't, so maybe it is indeed fixed, just not properly released. Will wait for RC 7 and confirm.

@cortinico
Copy link
Contributor

Hmm, I tried reproducing this with a unit test on latest main, but I can't, so maybe it is indeed fixed, just not properly released. Will wait for RC 7 and confirm.

Yup it's indeed fixed by #45749

We had a problem with publishing of @react-native/gradle-plugin so that the RC6 published version was faulty (was missing a couple of commits). We're going to publish RC7 today which will include this fix as well

@cortinico cortinico added Resolution: PR Submitted A pull request with a fix has been provided. and removed Needs: Triage 🔍 labels Aug 6, 2024
@cortinico cortinico self-assigned this Aug 6, 2024
@cortinico
Copy link
Contributor

This should be fixed now @oblador

@cortinico cortinico added Resolution: Fixed A PR that fixes this issue has been merged. and removed Resolution: PR Submitted A pull request with a fix has been provided. labels Aug 7, 2024
@oblador
Copy link
Contributor Author

oblador commented Aug 7, 2024

Can confirm it works now, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API: Linking Platform: Android Android applications. Resolution: Fixed A PR that fixes this issue has been merged.
Projects
None yet
Development

No branches or pull requests

3 participants