-
Notifications
You must be signed in to change notification settings - Fork 24.4k
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
Android java.lang.IllegalAccessError Method void android.support.v4.net.ConnectivityManagerCompat #6152
Comments
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 :
|
I am also hitting this error |
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 |
@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 |
@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. |
I has same problem when i upgrade android support package to |
+1 Tried with android support package v23.1 & v23.2 |
cc @bestander |
The issue is that the |
Oh snap, I'll look into that tomorrow |
+1 same issue here |
1 similar comment
+1 same issue here |
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) |
@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. |
If you are using the |
to property downgrade your support version download this https://dl-ssl.google.com/android/repository/support_r23.0.1.zip and extract it into $ANDROID_HOME/extras/android/support |
One temporary fix you can do is exclude the package from your other dependencies in your app/gradle.build. This is an example of ours.
You should be able to go to your android folder and run
and all of the support packages should be listed as version 23.0.1. You might have to be a clean before that. |
@Anthonyzou we don't instantiate ConnectivityManagerCompat, so constructor visibility should not make a difference. |
Looks like it is a breaking change in android support library. |
@tuneZola Using a resolutionStrategy is a cleaner approach to force the version across all sub-projects. subprojects {
configurations.all {
resolutionStrategy {
// https://github.com/facebook/react-native/issues/6152
force 'com.android.support:support-v4:23.0.1'
}
}
} |
Should be fixed with 3640080 |
Closing based on @astuetz's comment. Let's reopen of its still not working |
@Traviskn It's fixed in 0.22.0-rc already :) |
@knowbody I think the fix for this Android-specific bug should be included in the 0.22.0-rc release notes as well. (Although the commit message doesn't really sound like a major bugfix) |
@astuetz done |
This gives me a lot of compilation errors: Error:(11, 26) error: cannot find symbol class LifecycleState
Trying:
followed by
Then a project refresh, then a build. I get the same errors. Essentially, the process lined out in this doc is broken I believe... Unless maybe I need to update react version number too? (Which comes back to what I was saying earlier about a table of compatible version numbers) |
@LiamInJapan New package name for LifecycleState class: |
Thanks @ishan-dhingra I still have these: Error:(33, 34) error: cannot find symbol method onPause() |
@LiamInJapan This seems to be a Compile time Java error, check if you are extending class and overriding function properly. |
Ok, I'll check (although this is what is in the documents... Actually come On Wed, Nov 16, 2016 at 6:26 PM, Ishan Dhingra notifications@github.com
Liam Conroy |
So replacing with onHostPause, onHostResume e.t.c. gets it compiling, though there is a strikethrough on these function names (deprecated?). Then I get a "Seem's you're trying to access 'ReactNative.Component' from the 'react-native' package "throwOnWrongReactAPI" exception... Again these are using samples from the documentation... I am following the instructions now |
Ok I am finally at Hello World, though I think this is the longest "Hello World" I've ever experienced. I still have the depreciated issue mind regarding the onHostXXXX functions (onDestroy e.t.c. don't work) which makes me think I still have a versioning issue:
Any advice appreciated! |
I am facing the same issue. Can someone help? |
I've solved the problem changing In my project's build.gradle file what follows Then you have to solve some compiling errors related to the OnPause, OnResume...that are changed in onHostPause, onHostResume and that's it. A pain in the ass anyway! |
@StefanoCremona I was able to get rid of the error with this, however when I run the app I get
I did this |
Excuse me? Thank you ! |
I solved this problem by using the complete maven path in the app's build.gradle. I had put this maven path in the Projects build.gradle before by mistake. Putting it into app's build.gradle worked. |
I am also hitting this error app gradle
package.json
|
keep the supportV7 version with the compileSdkVersion version |
I'm hitting this with React Native 0.41.2, I don't have a appcompat-v4 dependency in my build.gradle file, I do have:
ah, but one of my dependencies uses:
|
@NoTraceOfSnow I can't implement Am I missing something?
|
@haemi your project has download this about the reactnative file? i have a good idea ,you can init a Official project ,View all files and you can find difference in the project,copy the difference file to you self project.if you can improt reactnative in you project you can link me , i will try my beast .my QQ email 2371479117@qq.com and you project has this picture files |
@NoTraceOfSnow thanks for your quick response! I can import React into my project, I also have the Then I wanted to try what you wrote here (#6152 (comment)), but I can't do the |
@haemi eee.... do you start your server? and i think you lost some file . |
is this in
shouldn't it be |
so sorry i am sleep last night ,yes,you should it be . i will tell you how to lead reactnative into your project. |
I suspect this is caused by gradle picking up the wrong version of react-native, |
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" />
The text was updated successfully, but these errors were encountered: