After upgrading to RN 0.74.0 the npx react-native run-android
fails with the error –
error Failed to install the app. Command failed with exit code 1: ./gradlew app:installDebug -PreactNativeDevServerPort=8081
/Users/phil/Code/app-name/android/app/src/main/java/com/app-name/app/newarchitecture/MainApplicationReactNativeHost.java:19: error: cannot find symbol
import com.facebook.react.fabric.FabricJSIModuleProvider; ^ symbol: class FabricJSIModuleProvider location: package com.facebook.react.fabric
I’ve followed the steps in upgrading from 0.7.3.6 to 0.74.0 using the Upgrade Helper. iOS builds are okay but facing this issue with Android builds. I understand this is related to using the New Architecture, however I have newArchEnabled=false
setting in gradle.properties
.
2
Answers
So, I managed to work around this by deleting the
newarchitecture
folder which contained theMainApplicationReactNativeHost.java
file (and a few other java files). Since I'm not using the New Architecture in RN (newArchEnabled=false
) I figured I don't need these files. I can now build successfully for Android.I’m not sure, but try :
If it still not work :
add this in your proguard-rules.pro
-keep class com.facebook.react.fabric.** { *; }