Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

RNN Wix > Task :react-native-navigation:compileReactNative68DebugJavaWithJavac FAILED

So i opened up my project today, ready to export and compile an Android build.

I ran: react-native run-android and ./gradlew bundleRelease" as i always does, but now it errors and fails every time. It's still working on iOS, and no changes have been made to the android part.

Error:

Task :react-native-navigation:compileReactNative68DebugJavaWithJavac FAILED /Users/xxxxxx/Documents/Github/YourProjectName/node_modules/react-native-navigation/lib/android/app/src/reactNative68/java/com/reactnativenavigation/react/NavigationReactNativeHost.java: error: cannot find symbol .setUIImplementationProvider(getUIImplementationProvider())

Anyone know how i can fix this? Been trying literally all answers on SO and GitHub (their repo)

Using Kotlin 1.6 (tried with 1.4.31 also) RN: 0.68.2

Any help is much appreciated!

Edit (solution) Add the following in your android/build.gradle file

exclusiveContent {
           // We get React Native's Android binaries exclusively through npm,
           // from a local Maven repo inside node_modules/react-native/.
           // (The use of exclusiveContent prevents looking elsewhere like Maven Central
           // and potentially getting a wrong version.)
           filter {
               includeGroup "com.facebook.react"
           }
           forRepository {
               maven {
                   url "$rootDir/../node_modules/react-native/android"
               }
           }
       }

It's all related to https://github.com/facebook/react-native/issues/35210 and this https://github.com/wix/react-native-navigation/issues/7630

like image 245
Stian Instebo Avatar asked Oct 20 '25 01:10

Stian Instebo


1 Answers

I have been facing an issue with the android build today as well. Though with a different error message but I suspect you are experiencing the same core problem.

First I noticed that the react-native version resolved for android was incorrect. To see if it's the case also for you navigate to the android folder in your project in the terminal (cd android) and then run a command to generate a dependency tree: ./gradlew app:dependencies > dep.txt. Then in the file dep.txt search for react-native:. If the version of react native doesn't match the version you are using (0.68.2) then add the following to your top-level build.gradle file:

allprojects {
    repositories {
+       exclusiveContent {
+           // We get React Native's Android binaries exclusively through npm,
+           // from a local Maven repo inside node_modules/react-native/.
+           // (The use of exclusiveContent prevents looking elsewhere like Maven Central
+           // and potentially getting a wrong version.)
+           filter {
+               includeGroup "com.facebook.react"
+           }
+           forRepository {
+               maven {
+                   url "$rootDir/../node_modules/react-native/android"
+               }
+           }
+       }
        // ...
    }
}

You can find more details about the issue here https://github.com/facebook/react-native/issues/35210

like image 160
Karol Avatar answered Oct 22 '25 23:10

Karol



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!