4

Integrating react native code into the existing android project facing the following error.

Caused by: java.lang.IllegalAccessError: Method 'void androidx.core.net.ConnectivityManagerCompat.()

We are trying to add the react native project into an existing android app. With the following reference link:

https://medium.com/mindorks/react-native-integration-with-existing-app-f2757c2e672d

. While switching from Android Main activity to Reactnative activity, we get the following exception

Caused by: java.lang.IllegalAccessError: Method 'void androidx.core.net.ConnectivityManagerCompat.()' is inaccessible to class 'com.facebook.react.modules.netinfo.NetInfoModule' (declaration of 'com.facebook.react.modules.netinfo.NetInfoModule`

. Please suggest.

2
  • 1
    did you found the solution? Commented Nov 1, 2020 at 23:04
  • IllegalAccessError mostly happens when importing the wrong version of libraries, because they try to call a specific method from the class but it doesn't exist anymore(or yet) at the runtime. Commented Nov 2, 2020 at 0:23

1 Answer 1

0

The guide you linked to is 3 years old, there has been a lot of changes in RN (and in Android, Gradle, etc.) during that time.

Can you try this guide: https://blog.usejournal.com/integrating-react-native-with-existing-android-apps-efficiently-3b39f2e061bd ? I used it a few weeks ago and it worked for me.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.