expo / expo

An open-source framework for making universal native apps with React. Expo runs on Android, iOS, and the web.
https://docs.expo.dev
MIT License
33.94k stars 5.43k forks source link

[Expo SDK 45] ReactNativeHostWrapperBase: Unresolved reference: RedBoxHandler #18166

Closed artkrv closed 2 years ago

artkrv commented 2 years ago

Summary

After upgrading RN 0.68.2 --> 0.69.1 I am facing the project build issue.

yarn android gives me an error:

image

Task :expo:compileDebugKotlin FAILED w: Detected multiple Kotlin daemon sessions at build/kotlin/sessions

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

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

See https://docs.gradle.org/7.3.3/userguide/command_line_interface.html#sec:command_line_warnings 347 actionable tasks: 341 executed, 6 up-to-date Note: Some input files use or override a deprecated API. Note: Recompile with -Xlint:deprecation for details. Note: Some input files use unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. Note: /projects/Mobile.App/node_modules/lottie-react-native/src/android/src/main/java/com/airbnb/android/react/lottie/LottieAnimationViewManager.java uses or overrides a deprecated API. Note: Recompile with -Xlint:deprecation for details. Note: /projects/Mobile.App/node_modules/lottie-react-native/src/android/src/main/java/com/airbnb/android/react/lottie/LottieAnimationViewManager.java uses unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. Note: /projects/Mobile.App/node_modules/@react-native-async-storage/async-storage/android/src/main/java/com/reactnativecommunity/asyncstorage/AsyncStorageModule.java uses or overrides a deprecated API. Note: Recompile with -Xlint:deprecation for details. Note: /projects/Mobile.App/node_modules/@react-native-async-storage/async-storage/android/src/main/java/com/reactnativecommunity/asyncstorage/AsyncStoragePackage.java uses unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. Note: Some input files use or override a deprecated API. Note: Recompile with -Xlint:deprecation for details. Note: Some input files use or override a deprecated API. Note: Recompile with -Xlint:deprecation for details. Note: Some input files use or override a deprecated API. Note: Recompile with -Xlint:deprecation for details. e: /projects/Mobile.App/node_modules/expo/android/src/main/java/expo/modules/ReactNativeHostWrapperBase.kt: (14, 38): Unresolved reference: RedBoxHandler e: /projects/Mobile.App/node_modules/expo/android/src/main/java/expo/modules/ReactNativeHostWrapperBase.kt: (42, 36): Unresolved reference: RedBoxHandler e: /projects/Mobile.App/node_modules/expo/android/src/main/java/expo/modules/ReactNativeHostWrapperBase.kt: (43, 12): Not enough information to infer type variable T

FAILURE: Build failed with an exception.

Managed or bare workflow? If you have ios/ or android/ directories in your project, the answer is bare!

bare

What platform(s) does this occur on?

Android

SDK Version (managed workflow only)

45.0.6

Environment


Gradle 7.3.3

Build time: 2021-12-22 12:37:54 UTC Revision: 6f556c80f945dc54b50e0be633da6c62dbe8dc71

Kotlin: 1.5.31 Groovy: 3.0.9 Ant: Apache Ant(TM) version 1.10.11 compiled on July 10 2021 JVM: 11.0.15 (Homebrew 11.0.15+0) OS: Mac OS X 12.4 aarch64

expo-env-info 1.0.4 environment info: System: OS: macOS 12.4 Shell: 5.8.1 - /bin/zsh Binaries: Node: 16.14.0 - /usr/local/bin/node Yarn: 1.22.19 - ~/.yarn/bin/yarn npm: 8.4.1 - /opt/homebrew/bin/npm Watchman: 2022.06.20.00 - /opt/homebrew/bin/watchman Managers: CocoaPods: 1.11.3 - /opt/homebrew/bin/pod SDKs: iOS SDK: Platforms: DriverKit 21.4, iOS 15.5, macOS 12.3, tvOS 15.4, watchOS 8.5 Android SDK: API Levels: 30, 31, 32 Build Tools: 30.0.2, 30.0.3, 31.0.0, 32.0.0 System Images: android-32 | Google APIs ARM 64 v8a, android-32 | Google Play ARM 64 v8a IDEs: Android Studio: 2021.1 AI-211.7628.21.2111.8139111 Xcode: 13.4.1/13F100 - /usr/bin/xcodebuild npmPackages: expo: ^45.0.6 => 45.0.6 react: 18.0.0 => 18.0.0 react-native: 0.69.1 => 0.69.1 npmGlobalPackages: eas-cli: 0.54.1 expo-cli: 5.4.12 Expo Workflow: bare

Reproducible demo

npx react-native upgrade yarn android

eleonne commented 2 years ago

I`m stuck for the last few days. Trying to create a new react-native project and the key lib (react native tensorflow) depends on expo. I simply can't create a new project with current expo + RN0.69. I track it down to this error, but I think it goes beyond. Aparently this class is an interface now and have to be instantiated via factory.

thespacemanatee commented 2 years ago

You should never upgrade RN on Expo if it's not explicitly supported and if you do, you have to bear the consequences. SDK 46 is coming out soon, so be a little more patient.

eleonne commented 2 years ago

@thespacemanatee, Do you know how soon?

Kudo commented 2 years ago

hi there! react-native 0.69 introduced some breaking changes that sdk 45 doesn't support. we are working on it for expo sdk 46 and it should be available for beta before the end of this month. thanks!

neandher commented 1 year ago

same error here any help?

mingeee commented 1 year ago

same error here any help?

I am getting the same error too. Let me know if you have found the solution. If I do found one, I will let you know. ^.^

bencoopertx commented 1 year ago

same error here any help?

I am getting the same error too. Let me know if you have found the solution. If I do found one, I will let you know. ^.^

Same... except I'm getting on same old react native version 0.64.3

dion- commented 1 year ago

Suddenly experiencing this issue on RN version 0.68.2

bencoopertx commented 1 year ago

Wonder are we all suddenly here today... what's the linking piece?

bencoopertx commented 1 year ago

Here's my full log, getting on "react-native": "0.64.3" and "expo": "^43.0.0" e: /Users/bencooper/Desktop/projects/every-two/node_modules/expo/android/src/main/java/expo/modules/ReactNativeHostWrapper.kt: (14, 38): Unresolved reference: RedBoxHandler e: /Users/bencooper/Desktop/projects/every-two/node_modules/expo/android/src/main/java/expo/modules/ReactNativeHostWrapper.kt: (28, 15): Unresolved reference: onWillCreateReactInstanceManager e: /Users/bencooper/Desktop/projects/every-two/node_modules/expo/android/src/main/java/expo/modules/ReactNativeHostWrapper.kt: (36, 15): Unresolved reference: onDidCreateReactInstanceManager e: /Users/bencooper/Desktop/projects/every-two/node_modules/expo/android/src/main/java/expo/modules/ReactNativeHostWrapper.kt: (42, 36): Unresolved reference: RedBoxHandler e: /Users/bencooper/Desktop/projects/every-two/node_modules/expo/android/src/main/java/expo/modules/ReactNativeHostWrapper.kt: (43, 12): Not enough information to infer type variable T e: /Users/bencooper/Desktop/projects/every-two/node_modules/expo/android/src/main/java/expo/modules/ReactNativeHostWrapper.kt: (51, 3): 'getUIImplementationProvider' overrides nothing e: /Users/bencooper/Desktop/projects/every-two/node_modules/expo/android/src/main/java/expo/modules/ReactNativeHostWrapper.kt: (51, 76): Unresolved reference: UIImplementationProvider e: /Users/bencooper/Desktop/projects/every-two/node_modules/expo/android/src/main/java/expo/modules/ReactNativeHostWrapper.kt: (52, 12): Not enough information to infer type variable T

mingeee commented 1 year ago

Here's my full log, getting on "react-native": "0.64.3" and "expo": "^43.0.0" e: /Users/bencooper/Desktop/projects/every-two/node_modules/expo/android/src/main/java/expo/modules/ReactNativeHostWrapper.kt: (14, 38): Unresolved reference: RedBoxHandler e: /Users/bencooper/Desktop/projects/every-two/node_modules/expo/android/src/main/java/expo/modules/ReactNativeHostWrapper.kt: (28, 15): Unresolved reference: onWillCreateReactInstanceManager e: /Users/bencooper/Desktop/projects/every-two/node_modules/expo/android/src/main/java/expo/modules/ReactNativeHostWrapper.kt: (36, 15): Unresolved reference: onDidCreateReactInstanceManager e: /Users/bencooper/Desktop/projects/every-two/node_modules/expo/android/src/main/java/expo/modules/ReactNativeHostWrapper.kt: (42, 36): Unresolved reference: RedBoxHandler e: /Users/bencooper/Desktop/projects/every-two/node_modules/expo/android/src/main/java/expo/modules/ReactNativeHostWrapper.kt: (43, 12): Not enough information to infer type variable T e: /Users/bencooper/Desktop/projects/every-two/node_modules/expo/android/src/main/java/expo/modules/ReactNativeHostWrapper.kt: (51, 3): 'getUIImplementationProvider' overrides nothing e: /Users/bencooper/Desktop/projects/every-two/node_modules/expo/android/src/main/java/expo/modules/ReactNativeHostWrapper.kt: (51, 76): Unresolved reference: UIImplementationProvider e: /Users/bencooper/Desktop/projects/every-two/node_modules/expo/android/src/main/java/expo/modules/ReactNativeHostWrapper.kt: (52, 12): Not enough information to infer type variable T

That is the same error I have got but I am running expo 45 and rn 68. Tested on rn 69 too...

If I upgrade to expo 46, it spit out this error: image

williamliangwl commented 1 year ago

I'm getting the same error message, the builds were working fine yesterday

I'm using expo 46 and rn 69.4

mingeee commented 1 year ago

It could be related to this: I think?! https://github.com/facebook/react-native/issues/35210#issuecomment-1304446688

neandher commented 1 year ago

Fix is here too https://github.com/expo/expo/commit/02fb0a91694af1d32226f8bc26ec8a88648c3131

bencoopertx commented 1 year ago

It could be related to this: I think?! facebook/react-native#35210 (comment)

Fixed it for me. Thank you šŸ‘

younthu commented 1 year ago

Suddenly experiencing this issue on RN version 0.68.2

desca595 commented 1 year ago

Experiencing the same also with "react-native": "0.68.2" the fix https://github.com/expo/expo/commit/02fb0a91694af1d32226f8bc26ec8a88648c3131 also worked for me!

NantEiPhyoThet commented 1 year ago

Has anyone here who are having this build failed issue tried to build signed bundle/apk for android? Because the solutions hereĀ react-native/issues/35210Ā and (expo/expo@02fb0a9), it makes the build for android successful on emulator and on real device. But my signed bundle/apk is crashing as soon as it's downloaded and opened. I'm on RN 0.66 and I've tried gradle 6.9.0, 7.0.1 and 7.2.1 and my signed bundle is still crashing with no error messages shown.

Yandamuri commented 1 year ago

It could be related to this: I think?! facebook/react-native#35210 (comment)

This solution worked for me. I was in RN 0.64.3 then installed RN 0.64.4. Issue got resolved.

congcong09 commented 1 year ago

That is the same error I have got but I am running expo 45 and rn 68. Tested on rn 69 too...

If I upgrade to expo 46, it spit out this error: image

Did you fix it? I met the problem too.

mingeee commented 1 year ago

That is the same error I have got but I am running expo 45 and rn 68. Tested on rn 69 too... If I upgrade to expo 46, it spit out this error: image

Did you fix it? I met the problem too.

Yeah! follow the fix here: https://github.com/facebook/react-native/issues/35210#issuecomment-1304446688

OneLoneFox commented 1 year ago

Updating react native to the corresponding patch mentioned in the issue above solves the problem however if you ever use "expo prebuild" expo will insist on using a broken version and update your package.json and install the broken version, in my case Expo SDK 45 with react native 0.68.2 (the fixed version is 0.68.5)

ilyavf commented 1 year ago

It could be related to this: I think?! https://github.com/facebook/react-native/issues/35210#issuecomment-1304446688

This solution worked for me. I was in RN 0.64.3 then installed RN 0.64.4. Issue got resolved.

I was also on 0.64.3, but upgrading to 0.64.4 did not help. But I first was getting different errors.

Here is my full history (I am on expo 44.0.6, bare workflow, gradle 6.9).

First: Execution failed for task ':app:checkReleaseAarMetadata'.

The minCompileSdk (31) specified ... is greater than this module's compileSdkVersion (android-30).
Dependency: androidx.appcompat:appcompat:1.4.1

This is when I upgraded to 0.64.4 but the error stayed. I cannot upgrade minCompileSdk to 31, so to move forward I had to specify versions for the following packages in android/app/build.gradle:

force 'androidx.appcompat:appcompat:1.2.0'
force 'androidx.appcompat:appcompat-resources:1.2.0'
force 'androidx.tracing:tracing:1.0.0'
force 'androidx.tracing:tracing-ktx:1.0.0'

Then, the next error was:

Execution failed for task ':expo-modules-core:compileReleaseKotlin'.
...
e: /Users/ilya/.gradle/caches/transforms-3/0391baf9a5d979baeff13af67647940b/transformed/jetified-kotlin-stdlib-jdk7-1.6.10.jar!/META-INF/kotlin-stdlib-jdk7.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.4.1.
... (and lots of similar errors) ...

To fix this I had to specify the version of Kotlin in android/build.gradle:

kotlinVersion = "1.6.0"

And now I am getting the error described in this issue:

Task :expo:compileReleaseKotlin FAILED
node_modules/expo/android/src/main/java/expo/modules/ReactNativeHostWrapper.kt: (14, 38): Unresolved reference: RedBoxHandler
node_modules/expo/android/src/main/java/expo/modules/ReactNativeHostWrapper.kt: (42, 36): Unresolved reference: RedBoxHandler
node_modules/expo/android/src/main/java/expo/modules/ReactNativeHostWrapper.kt: (43, 12): Not enough information to infer type variable T
node_modules/expo/android/src/main/java/expo/modules/ReactNativeHostWrapper.kt: (51, 3): 'getUIImplementationProvider' overrides nothing
node_modules/expo/android/src/main/java/expo/modules/ReactNativeHostWrapper.kt: (51, 76): Unresolved reference: UIImplementationProvider
node_modules/expo/android/src/main/java/expo/modules/ReactNativeHostWrapper.kt: (52, 12): Not enough information to infer type variable T
ilyavf commented 1 year ago

This is what helped me: https://github.com/facebook/react-native/issues/35249#issuecomment-1307495082

MkrierPharmanity commented 1 year ago

got the same error, its a new project with react native v0.70.5

ibravoh commented 1 year ago

hi Guys, I have been battling with this for the past few days and i still cannot get my app to build I have tried everything here and here https://github.com/facebook/react-native/issues/35210 too . but nothing has worked so far. I am stuck. I am using a bare workflow but installed expo SDK to be able to use thinks like expo-fonts, e.t.c React native version : 0.69.3 expo SDK version : 46.0.0

below are the errors that i have been getting.

Please help!

*Configure project :expo-modules-core WARNING:Software Components will not be created automatically for Maven publishing from Android Gradle Plugin 8.0. To opt-in to the future behavior, set the Gradle property android.disableAutomaticComponentCreation=true in the gradle.properties file or use the new publishing DSL.

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

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

See https://docs.gradle.org/7.3.3/userguide/command_line_interface.html#sec:command_line_warnings 6 actionable tasks: 6 up-to-date

FAILURE: Build completed with 2 failures.

1: Task failed with an exception.

2: Task failed with an exception.

BUILD FAILED in 4m 28s

error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup. Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081

FAILURE: Build completed with 2 failures.

1: Task failed with an exception.

2: Task failed with an exception.

BUILD FAILED in 4m 28s

Ozaoujal commented 10 months ago

same issue, with RN0.70.1, but upgrading expo the issue's gone