创建原生模块集成时报错,请大侠解救!



  • 报错信息如下:
    03-21 01:59:42.727 12698-12725/? E/AndroidRuntime: FATAL EXCEPTION: AsyncTask #1
    Process: com.joy, PID: 12698
    java.lang.RuntimeException: An error occured while executing doInBackground()
    at android.os.AsyncTask$3.done(AsyncTask.java:300)
    at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355)
    at java.util.concurrent.FutureTask.setException(FutureTask.java:222)
    at java.util.concurrent.FutureTask.run(FutureTask.java:242)
    at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
    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/com.joy-1/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:814)
    at com.facebook.react.ReactInstanceManagerImpl.createReactContext(ReactInstanceManagerImpl.java:742)
    at com.facebook.react.ReactInstanceManagerImpl.access$600(ReactInstanceManagerImpl.java:92)
    at com.facebook.react.ReactInstanceManagerImpl$ReactContextInitAsyncTask.doInBackground(ReactInstanceManagerImpl.java:185)
    at com.facebook.react.ReactInstanceManagerImpl$ReactContextInitAsyncTask.doInBackground(ReactInstanceManagerImpl.java:170)
    at android.os.AsyncTask$2.call(AsyncTask.java:288)
    at java.util.concurrent.FutureTask.run(FutureTask.java:237)
    at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231) 
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) 
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) 
    at java.lang.Thread.run(Thread.java:818)



  • 请问你解决没有? 解决了告诉我一声可否?多谢多谢 QQ:2225 226



  • @wsamuel 说:

    ConnectivityManagerCompat

    主要是依赖问题,ReactNative 依赖于 23.0.1 的兼容包,一旦你的版本对不上就会出这个问题。

    集成过程你可以参考这个 https://github.com/Kennytian/embedded


登录后回复