Description
Description
I am following the guide here to integrate React Native with a pre-existing app.
I am doing this via a normal native button. I press this and I execute the setup code in the article.
I see a spinner on the screen and it informs me that the app is "fetching JS bundle".
Output in the command line bundler also confirms this:
[11/14/2016, 4:54:42 PM] Requesting bundle url: /index.android.bundle?platform=android&dev=true&hot=false (327ms)
Unfortunately I then get a crash with the following logcat output:
W/unknown:React(13970): You seem to be running on device. Run 'adb reverse tcp:8081 tcp:8081' to forward the debug server's port to the device. E/AndroidRuntime(13970): FATAL EXCEPTION: AsyncTask #3 E/AndroidRuntime(13970): Process: com.xxxxxxxx, PID: 13970 E/AndroidRuntime(13970): java.lang.RuntimeException: An error occured while executing doInBackground() E/AndroidRuntime(13970): at android.os.AsyncTask$3.done(AsyncTask.java:304) E/AndroidRuntime(13970): at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355) E/AndroidRuntime(13970): at java.util.concurrent.FutureTask.setException(FutureTask.java:222) E/AndroidRuntime(13970): at java.util.concurrent.FutureTask.run(FutureTask.java:242) E/AndroidRuntime(13970): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231) E/AndroidRuntime(13970): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) E/AndroidRuntime(13970): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) E/AndroidRuntime(13970): at java.lang.Thread.run(Thread.java:818) E/AndroidRuntime(13970): 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/data/com.xxxx/files/instant-run/dex/slice-com.facebook.react-react-native-0.20.1_b45e38dcf4b17e67a28c8f304d2b842bb0467fc3-classes.dex) E/AndroidRuntime(13970): at com.facebook.react.modules.netinfo.NetInfoModule.<init>(NetInfoModule.java:55) E/AndroidRuntime(13970): at com.facebook.react.shell.MainReactPackage.createNativeModules(MainReactPackage.java:67) E/AndroidRuntime(13970): at com.facebook.react.ReactInstanceManagerImpl.processPackage(ReactInstanceManagerImpl.java:793) E/AndroidRuntime(13970): at com.facebook.react.ReactInstanceManagerImpl.createReactContext(ReactInstanceManagerImpl.java:730) E/AndroidRuntime(13970): at com.facebook.react.ReactInstanceManagerImpl.access$600(ReactInstanceManagerImpl.java:91) E/AndroidRuntime(13970): at com.facebook.react.ReactInstanceManagerImpl$ReactContextInitAsyncTask.doInBackground(ReactInstanceManagerImpl.java:184) E/AndroidRuntime(13970): at com.facebook.react.ReactInstanceManagerImpl$ReactContextInitAsyncTask.doInBackground(ReactInstanceManagerImpl.java:169) E/AndroidRuntime(13970): at android.os.AsyncTask$2.call(AsyncTask.java:292) E/AndroidRuntime(13970): at java.util.concurrent.FutureTask.run(FutureTask.java:237) E/AndroidRuntime(13970): ... 4 more W/ActivityManager( 523): Force finishing activity 1 com.xxxx/com.xxxxxxx.LoginActivity
I have tried:
- running 'adb reverse tcp:8081 tcp:8081' before and after the npm start invocation
- modifying my app gradle file with various variations of the following:
compile 'com.android.support:appcompat-v7:23.2.1'
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.android.support:appcompat-v4:23.0.1'
compile 'com.facebook.react:react-native:+'
compile 'com.facebook.react:react-native:0.20.+'
I'm at a bit of a loss as to how to proceed/debug this issue.
Reproduction
Follow guide above.
Hook up guides code to a button is a fairly typical login view.
Press button. Watch spinner popup saying "Requesting JS Bundle"
Confirm in npm start/packager console output.
Watch it crash. Check output in logcat
Additional Information
- React Native version: compile 'com.facebook.react:react-native:+'
- Platform: Android Nexus 7 5.1.1
- Operating System: MacOS