Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrating with an Android existing app crashes the application #10371

Closed
SandroMachado opened this issue Oct 13, 2016 · 6 comments
Closed

Integrating with an Android existing app crashes the application #10371

SandroMachado opened this issue Oct 13, 2016 · 6 comments
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@SandroMachado
Copy link
Contributor

Issue Description

Integrating React Native in an existing Android application does not work. Every time I try to run the Activity with the ReactRootView I get the following crash:

 Theme: themes:{default=overlay:system, iconPack:system, fontPkg:system, com.android.systemui=overlay:system, com.android.systemui.navbar=overlay:system}
 java.lang.RuntimeException: An error occurred while executing doInBackground()
     at android.os.AsyncTask$3.done(AsyncTask.java:309)
     at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:354)
     at java.util.concurrent.FutureTask.setException(FutureTask.java:223)
     at java.util.concurrent.FutureTask.run(FutureTask.java:242)
     at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234)
     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
     at java.lang.Thread.run(Thread.java:818)
  Caused by: java.lang.IllegalAccessError: Method 'void android.support.v4.net.ConnectivityManagerCompat.<init>()' is inaccessible to class 'com.facebook.react.modules.netinfo.NetInfoModule' (declaration of 'com.facebook.react.modules.netinfo.NetInfoModule' appears in /data/app/*****.debug-2/base.apk)
     at com.facebook.react.modules.netinfo.NetInfoModule.<init>(NetInfoModule.java:55)
     at com.facebook.react.shell.MainReactPackage.createNativeModules(MainReactPackage.java:67)
     at com.facebook.react.ReactInstanceManagerImpl.processPackage(ReactInstanceManagerImpl.java:793)
     at com.facebook.react.ReactInstanceManagerImpl.createReactContext(ReactInstanceManagerImpl.java:730)
     at com.facebook.react.ReactInstanceManagerImpl.access$600(ReactInstanceManagerImpl.java:91)
     at com.facebook.react.ReactInstanceManagerImpl$ReactContextInitAsyncTask.doInBackground(ReactInstanceManagerImpl.java:184)
     at com.facebook.react.ReactInstanceManagerImpl$ReactContextInitAsyncTask.doInBackground(ReactInstanceManagerImpl.java:169)
     at android.os.AsyncTask$2.call(AsyncTask.java:295)
     at java.util.concurrent.FutureTask.run(FutureTask.java:237)
     at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234) 
     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113) 
     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588) 
     at java.lang.Thread.run(Thread.java:818) 

Steps to Reproduce / Code Snippets

  1. Following the integration tutorial with an existing Android application.
  2. Run the app and open the Activity with the ReactRootView.

Expected Results

Appear the activity with the react native component.

Additional Information

  • React Native version: 0.35.0
  • Platform(s) (iOS, Android, or both?): Android
  • Operating System (macOS, Linux, or Windows?): macOS
@SandroMachado
Copy link
Contributor Author

The problem was that React Native was downloaded from node_modules, not maven central or otherwhere. So I was using an older version of React Native.

@StefanoCremona
Copy link

@SandroMachado hello.
What have you changed in your configuration for solving the issue?
Thank you

@SandroMachado
Copy link
Contributor Author

@StefanoCremona looks like you find the solution here.

@StefanoCremona
Copy link

@SandroMachado Yes, thank you anyway. It seems there are hundreds of developers with the same problem. May be we could suggest an improvement to the original documentation.

@alexblack
Copy link

I'm hitting this with React Native 0.41.2, any suggestions? Its not clear to me what the fix is here:

#6152 (comment)

I currently have:

maven { url "$rootDir/../node_modules/react-native/android" } // All of React Native (JS, Android binaries) is installed from npm

is that not correct?

@grtickle
Copy link

@alexblack Did you find a solution to this?

@facebook facebook locked as resolved and limited conversation to collaborators May 24, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Jul 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

6 participants