2

So I have a pretty robust android application and I want to add some code from a react-native only application in one activity. I've gone through the docs on the site and it turned out to be a lot more complicated to integrate a react-native app into an existing android native app. Among the may errors, this is the one I'm current stuck on, does anyone know where this comes from?

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 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.NoClassDefFoundError: com.facebook.react.CoreModulesPackage$1
                                                                                                                     at com.facebook.react.CoreModulesPackage.getNativeModules(CoreModulesPackage.java:96)
                                                                                                                     at com.facebook.react.LazyReactPackage.createNativeModules(LazyReactPackage.java:71)
                                                                                                                     at com.facebook.react.NativeModuleRegistryBuilder.processPackage(NativeModuleRegistryBuilder.java:97)
                                                                                                                     at com.facebook.react.ReactInstanceManager.processPackage(ReactInstanceManager.java:950)
                                                                                                                     at com.facebook.react.ReactInstanceManager.createReactContext(ReactInstanceManager.java:880)
                                                                                                                     at com.facebook.react.ReactInstanceManager.access$600(ReactInstanceManager.java:104)
                                                                                                                     at com.facebook.react.ReactInstanceManager$ReactContextInitAsyncTask.doInBackground(ReactInstanceManager.java:218)
                                                                                                                     at com.facebook.react.ReactInstanceManager$ReactContextInitAsyncTask.doInBackground(ReactInstanceManager.java:197)
                                                                                                                     at android.os.AsyncTask$2.call(AsyncTask.java:295)
                                                                                                                     at java.util.concurrent.FutureTask.run(FutureTask.java:237)
                                                                                                                     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) 

It's currently fetching the bundle and it gets to 100 percent but then the activity crashes with the error output above about CoreModulesPackages.

It's been pretty frustrating trying to get this thing up and running, there seems to be a bunch of errors from many sides, I had to import react native manually through an aar since the version on maven is archaic(0.20), download okhttp web socket support, FLog and .so loader stuff. Among also having to exclude architecture specific code. If anyone knows of an easier way to integrate a RN app into an existing codebase, I'd really appreciate it.

I'm coming from the native side trying to understand this thing. I set up npm, bundle up the js before staring the server and then run my app. After which i forward to the proper 8081 port. If I'm doing the sequence of steps wrong then someone please correct me. It's been 3 days. Halp.

1
  • 1
    a bit late... anyways can you attach the build.gradle file for better understanding Commented May 5, 2017 at 11:26

2 Answers 2

2

I encountered this same error in my react native app on Android 5.x devices -- no issues on 6 or 7.

The issue ceased to occur after I removed Fabric.io Crashlytics as a dependency from my app.

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

1 Comment

Thanks for the input but I need those in my app. :/
0

I got same error. Probles has been solved by properly configuration of multidex for old android In my case I forgot to inherit my application class from MultiDexApplication

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.