upgrade-support
upgrade-support copied to clipboard
Android codegen failure in New Architecture (0.75.3 -> 0.76.5)
Environment
etai@etai-C02GM2XEQ05N mobile % npx react-native info
info Fetching system and libraries information...
System:
OS: macOS 14.7.1
CPU: (8) arm64 Apple M1
Memory: 103.41 MB / 16.00 GB
Shell:
version: "5.9"
path: /bin/zsh
Binaries:
Node:
version: 20.11.1
path: ~/.nvm/versions/node/v20.11.1/bin/node
Yarn: Not Found
npm:
version: 10.2.4
path: ~/.nvm/versions/node/v20.11.1/bin/npm
Watchman:
version: 2024.09.09.00
path: /opt/homebrew/bin/watchman
Managers:
CocoaPods:
version: 1.13.0
path: /opt/homebrew/lib/ruby/gems/3.3.0/bin/pod
SDKs:
iOS SDK:
Platforms:
- DriverKit 23.2
- iOS 17.2
- macOS 14.2
- tvOS 17.2
- watchOS 10.2
Android SDK:
Android NDK: 22.1.7171670
IDEs:
Android Studio: 2024.2 AI-242.23339.11.2421.12700392
Xcode:
version: 15.1/15C65
path: /usr/bin/xcodebuild
Languages:
Java:
version: 17.0.12
path: /usr/bin/javac
Ruby:
version: 3.3.5
path: /opt/homebrew/opt/ruby/bin/ruby
npmPackages:
"@react-native-community/cli":
installed: 15.0.1
wanted: 15.0.1
react:
installed: 18.3.1
wanted: 18.3.1
react-native:
installed: 0.76.5
wanted: 0.76.5
react-native-macos: Not Found
npmGlobalPackages:
"*react-native*": Not Found
Android:
hermesEnabled: true
newArchEnabled: true
iOS:
hermesEnabled: true
newArchEnabled: true
Things I’ve done to figure out my issue
- [x] I used upgrade-helper to do my upgrade.
- [x] iOS and js unit tests run successfully
- [x] Tried running with New Architecture turned off (Compiles but fails on JS side with
Error: Exception in HostObject::get for prop 'RNCConfigModule': java.lang.IllegalArgumentException: Could not convert class com.<...>.storage.Environment, js engine: hermes) - [x] Upgraded relevant node packages
- [ ] Move to typescript (working on it)
- [ ] Update directory structure (currently, mobile/package.json isn't a sister of mobile/xxx/android but that hasn't been so far)
Upgrading version
FROM RN 0.75.3 TO RN 0.76.5 + New Arch
Description
generateCodegenArtifactsFromSchema step fails in Android Studio, leading to CMake failure to build.
etai@etai-C02GM2XEQ05N android % ./gradlew generateCodegenArtifactsFromSchema
> Configure project :app
Reading env from: .env
**************************
*** Missing .env file ****
**************************
> Configure project :expo
Using expo modules
- expo-file-system (18.0.5)
- expo-linking (7.0.3)
- expo-local-authentication (15.0.1)
- expo-modules-core (2.1.1)
- expo-secure-store (14.0.0)
- expo-store-review (7.0.2)
> Task :react-native-image-picker:generateCodegenSchemaFromJavaScript FAILED
node:fs:1643
const stats = binding.lstat(
^
Error: ENOENT: no such file or directory, lstat 'android'
at Object.lstatSync (node:fs:1643:25)
at /Users/etai/mobile/node_modules/react-native-codegen/lib/cli/combine/combine-js-to-schema-cli.js:75:10
at Array.forEach (<anonymous>)
at Object.<anonymous> (/Users/etai/mobile/node_modules/react-native-codegen/lib/cli/combine/combine-js-to-schema-cli.js:74:10)
at Module._compile (node:internal/modules/cjs/loader:1376:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
at Module.load (node:internal/modules/cjs/loader:1207:32)
at Module._load (node:internal/modules/cjs/loader:1023:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:135:12)
at node:internal/main/run_main_module:28:49 {
errno: -2,
code: 'ENOENT',
syscall: 'lstat',
path: 'android'
}
Node.js v20.11.1
> Task :react-native-community_geolocation:generateCodegenSchemaFromJavaScript FAILED
node:fs:1643
const stats = binding.lstat(
^
Error: ENOENT: no such file or directory, lstat 'android'
at Object.lstatSync (node:fs:1643:25)
at /Users/etai/mobile/node_modules/react-native-codegen/lib/cli/combine/combine-js-to-schema-cli.js:75:10
at Array.forEach (<anonymous>)
at Object.<anonymous> (/Users/etai/mobile/node_modules/react-native-codegen/lib/cli/combine/combine-js-to-schema-cli.js:74:10)
at Module._compile (node:internal/modules/cjs/loader:1376:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
at Module.load (node:internal/modules/cjs/loader:1207:32)
at Module._load (node:internal/modules/cjs/loader:1023:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:135:12)
at node:internal/main/run_main_module:28:49 {
errno: -2,
code: 'ENOENT',
syscall: 'lstat',
path: 'android'
}
Node.js v20.11.1
> Task :react-native-pager-view:generateCodegenSchemaFromJavaScript FAILED
node:fs:1643
const stats = binding.lstat(
^
Error: ENOENT: no such file or directory, lstat 'android'
at Object.lstatSync (node:fs:1643:25)
at /Users/etai/mobile/node_modules/react-native-codegen/lib/cli/combine/combine-js-to-schema-cli.js:75:10
at Array.forEach (<anonymous>)
at Object.<anonymous> (/Users/etai/mobile/node_modules/react-native-codegen/lib/cli/combine/combine-js-to-schema-cli.js:74:10)
at Module._compile (node:internal/modules/cjs/loader:1376:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
at Module.load (node:internal/modules/cjs/loader:1207:32)
at Module._load (node:internal/modules/cjs/loader:1023:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:135:12)
at node:internal/main/run_main_module:28:49 {
errno: -2,
code: 'ENOENT',
syscall: 'lstat',
path: 'android'
}
Node.js v20.11.1
> Task :react-native-async-storage_async-storage:generateCodegenSchemaFromJavaScript FAILED
node:fs:1643
const stats = binding.lstat(
^
Error: ENOENT: no such file or directory, lstat 'android'
at Object.lstatSync (node:fs:1643:25)
at /Users/etai/mobile/node_modules/react-native-codegen/lib/cli/combine/combine-js-to-schema-cli.js:75:10
at Array.forEach (<anonymous>)
at Object.<anonymous> (/Users/etai/mobile/node_modules/react-native-codegen/lib/cli/combine/combine-js-to-schema-cli.js:74:10)
at Module._compile (node:internal/modules/cjs/loader:1376:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
at Module.load (node:internal/modules/cjs/loader:1207:32)
at Module._load (node:internal/modules/cjs/loader:1023:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:135:12)
at node:internal/main/run_main_module:28:49 {
errno: -2,
code: 'ENOENT',
syscall: 'lstat',
path: 'android'
}
Node.js v20.11.1
> Task :react-native-gesture-handler:generateCodegenSchemaFromJavaScript FAILED
node:fs:1643
const stats = binding.lstat(
^
Error: ENOENT: no such file or directory, lstat 'android'
at Object.lstatSync (node:fs:1643:25)
at /Users/etai/mobile/node_modules/react-native-codegen/lib/cli/combine/combine-js-to-schema-cli.js:75:10
at Array.forEach (<anonymous>)
at Object.<anonymous> (/Users/etai/mobile/node_modules/react-native-codegen/lib/cli/combine/combine-js-to-schema-cli.js:74:10)
at Module._compile (node:internal/modules/cjs/loader:1376:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
at Module.load (node:internal/modules/cjs/loader:1207:32)
at Module._load (node:internal/modules/cjs/loader:1023:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:135:12)
at node:internal/main/run_main_module:28:49 {
errno: -2,
code: 'ENOENT',
syscall: 'lstat',
path: 'android'
}
Node.js v20.11.1
FAILURE: Build completed with 5 failures.
1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':react-native-image-picker:generateCodegenSchemaFromJavaScript'.
> Process 'command 'node'' finished with non-zero exit value 1
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.
==============================================================================
2: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':react-native-community_geolocation:generateCodegenSchemaFromJavaScript'.
> Process 'command 'node'' finished with non-zero exit value 1
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.
==============================================================================
3: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':react-native-pager-view:generateCodegenSchemaFromJavaScript'.
> Process 'command 'node'' finished with non-zero exit value 1
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.
==============================================================================
4: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':react-native-async-storage_async-storage:generateCodegenSchemaFromJavaScript'.
> Process 'command 'node'' finished with non-zero exit value 1
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.
==============================================================================
5: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':react-native-gesture-handler:generateCodegenSchemaFromJavaScript'.
> Process 'command 'node'' finished with non-zero exit value 1
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.
==============================================================================
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.10.2/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.
BUILD FAILED in 13s
18 actionable tasks: 8 executed, 10 up-to-date
Reproducible demo
TODO
Same Issue
any solution???
me too (0.74.1 -> 0.76.9)
Similar:
> Task :appdynamics_react-native-agent:generateCodegenArtifactsFromSchema UP-TO-DATE
Caching disabled for task ':appdynamics_react-native-agent:generateCodegenArtifactsFromSchema' because:
Build cache is disabled
Caching has not been enabled for the task
Skipping task ':appdynamics_react-native-agent:generateCodegenArtifactsFromSchema' as it is up-to-date.
Resolve mutations for :lottie-react-native:generateCodegenSchemaFromJavaScript (Thread[Execution worker Thread 6,5,main]) started.
:lottie-react-native:generateCodegenSchemaFromJavaScript (Thread[Execution worker Thread 6,5,main]) started.
But then on build:
CMake Error at /..../android/app/build/generated/autolinking/src/main/jni/Android-autolinking.cmake:9 (add_subdirectory):
add_subdirectory given source
"/.../node_modules/@appdynamics/react-native-agent/android/build/generated/source/codegen/jni/"
which is not an existing directory.
Call Stack (most recent call first):
/..../node_modules/react-native/ReactAndroid/cmake-utils/ReactNative-application.cmake:100 (include)
CMakeLists.txt:31 (include)