facebook / react-native

A framework for building native applications using React
https://reactnative.dev
MIT License
118.65k stars 24.29k forks source link

Could not set unknown property 'bundleInDebug' for extension 'react' of type com.facebook.react.ReactExtension #38720

Closed retyui closed 1 year ago

retyui commented 1 year ago

New Version

0.71

Old Version

0.70

Build Target(s)

Android debug

Output of react-native info

System:
  OS: macOS 13.4.1
  CPU: (10) arm64 Apple M1 Pro
  Memory: 1.78 GB / 32.00 GB
  Shell:
    version: 3.6.1
    path: /opt/homebrew/bin/fish
Binaries:
  Node:
    version: 18.17.0
    path: /usr/local/bin/node
  Yarn:
    version: 1.22.19
    path: /opt/homebrew/bin/yarn
  npm:
    version: 9.7.2
    path: /opt/homebrew/bin/npm
  Watchman:
    version: 2023.07.10.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.12.1
    path: /opt/homebrew/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 22.4
      - iOS 16.4
      - macOS 13.3
      - tvOS 16.4
      - watchOS 9.4
  Android SDK: Not Found
IDEs:
  Android Studio: Flamingo 2022.2.1 Patch 2 Flamingo 2022.2.1 Patch 2
  Xcode:
    version: 14.3.1/14E300c
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 11.0.19
    path: /usr/bin/javac
  Ruby:
    version: 2.6.10
    path: /usr/bin/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.72.3
    wanted: 0.72.3
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: true
  newArchEnabled: false

Issue and Reproduction Steps

  1. open android/app/build.gradle
  2. add
    react {
      bundleInDebug = true 
  3. try build yarn android
FAILURE: Build completed with 2 failures.

1: Task failed with an exception.
-----------
* Where:
Build file '/Users/i/tmp/MyApp/android/app/build.gradle' line: 9

* What went wrong:
A problem occurred evaluating project ':app'.
> Could not set unknown property 'bundleInDebug' for extension 'react' of type com.facebook.react.ReactExtension.
github-actions[bot] commented 1 year ago
:warning: Missing Reproducible Example
:information_source: We could not detect a reproducible example in your issue report. Please provide either:
  • If your bug is UI related: a Snack
  • If your bug is build/update related: use our Reproducer Template. A reproducer needs to be in a GitHub repository under your username.
cortinico commented 1 year ago
bundleInDebug = true 

This property doesn't exists. The documentation of the Gradle Plugin is on the website.

Specifically what you're looking for is debuggablevariants I suppose: https://reactnative.dev/docs/0.71/react-native-gradle-plugin#debuggablevariants

Still you don't need to specify bundleInDebug at all

retyui commented 1 year ago

thanks

// React Native <= 0.70.x
project.ext.react = [
  // ...
  bundleInDebug: System.getenv("FORCE_BUNDLING") != null,
]

// React Native >= 0.71.x
react {
    debuggableVariants = System.getenv("FORCE_BUNDLING") ? [] : ["debug"]
}
fachryadhitya-tvlk commented 2 months ago

thanks

// React Native <= 0.70.x
project.ext.react = [
  // ...
  bundleInDebug: System.getenv("FORCE_BUNDLING") != null,
]

// React Native >= 0.71.x
react {
    debuggableVariants = System.getenv("FORCE_BUNDLING") ? [] : ["debug"]
}

hi! do you happen to know the equivalent of jsBundleDirRelease (or debug) in React Native >= 0.71.x? since the prop is not exist anymore