Closed
Description
It appears that the NetInfo Module is trying to access ( com.facebook.react.modules.netinfo.NetInfoModule ) ConnectivityManagerCompat ( java.lang.IllegalAccessError: Method 'void android.support.v4.net.ConnectivityManagerCompat ) method of android support lib v4 and that method is private?
java.lang.IllegalAccessError: Method 'void android.support.v4.net.ConnectivityManagerCompat. I am using RN .18, so I am not sure if this is not an issue in RN .20, but I wanted to post it just incase someone else is running across this issue. Stack Trace 🎱
Also I do have the network permission in the manifest.
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
02-25 10:51:50.355 23140-23174/? E/AndroidRuntime: FATAL EXCEPTION: AsyncTask #4
Process: package.name, PID: 23140
java.lang.RuntimeException: An error occurred while executing doInBackground()
at android.os.AsyncTask$3.done(AsyncTask.java:307)
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/package.name-2/base.apk)
at com.facebook.react.modules.netinfo.NetInfoModule.<init>(NetInfoModule.java:55)
at com.facebook.react.shell.MainReactPackage.createNativeModules(MainReactPackage.java:62)
at com.facebook.react.ReactInstanceManagerImpl.processPackage(ReactInstanceManagerImpl.java:751)
at com.facebook.react.ReactInstanceManagerImpl.createReactContext(ReactInstanceManagerImpl.java:688)
at com.facebook.react.ReactInstanceManagerImpl.access$600(ReactInstanceManagerImpl.java:84)
at com.facebook.react.ReactInstanceManagerImpl$ReactContextInitAsyncTask.doInBackground(ReactInstanceManagerImpl.java:177)
at com.facebook.react.ReactInstanceManagerImpl$ReactContextInitAsyncTask.doInBackground(ReactInstanceManagerImpl.java:162)
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) ```
Metadata
Metadata
Assignees
Type
Projects
Milestone
Relationships
Development
No branches or pull requests
Activity
Traviskn commentedon Feb 28, 2016
I am also hitting this error when I try to run my app on android. The app crashes right after fetching the js bundle. Running on iOS has no problems.
Even checking out older versions of my app that are deployed and working in production still does not fix the issue, I simply cannot run android! Strangely, one of my co-workers has no problems running android. Also, if I react-native init a brand new project it also has no problems running on android. I'm completely mystified as to what could be going on.
I've included logcat output if that helps. It appears to be hitting the same error as described by @tuneZola :
ronanhardiman commentedon Feb 28, 2016
I am also hitting this error
pdiaz commentedon Feb 29, 2016
I found this issue only after I updated com.android.support:appcompat-v7 from 23.1.1 to 23.2.0 in app/build.gradle
Traviskn commentedon Feb 29, 2016
@pdiaz Interesting! I had com.android.support:appcompat-v7:23.0.1 listed in my app/build.gradle dependencies. I tried updating that to 23.1.1 to see if that would help resolve my issue, but unfortunately I am still getting the crash caused by the IllegalAccessError
tuneZola commentedon Feb 29, 2016
@pdiaz I noticed that also with the support version update, but I didn't want to have a specific build version dependency. Most people have something like this in there dependency list "com.android.support:support-v4:23.+". Also, this is an issue that will start to show up for more people once they upgrade or use RN for the first time. Changing to a specific build version is just a temporary solution.
jinzhaoyu commentedon Mar 2, 2016
I has same problem when i upgrade android support package to
23.2
gabygandrade commentedon Mar 2, 2016
+1 Tried with android support package v23.1 & v23.2
satya164 commentedon Mar 2, 2016
cc @bestander
Anthonyzou commentedon Mar 2, 2016
The issue is that the
ConnectivityManagerCompat
constructor is now private in version 23.2bestander commentedon Mar 2, 2016
Oh snap, I'll look into that tomorrow
ceichinger commentedon Mar 3, 2016
+1 same issue here
cedoucette commentedon Mar 3, 2016
+1 same issue here
Traviskn commentedon Mar 3, 2016
Has anyone been able to fix the issue by changing their version of the android support package? I cannot get around the issue no matter which version I use (23.0.1, 23.1, 23.2)
tuneZola commentedon Mar 3, 2016
@Traviskn No, I was not able to fix it either by specifying those earlier version. I did a gradle clean, but it still seems to import the new version. I think its because I have other dependencies like the FB SDK that always imports the latest.
97 remaining items