Skip to content
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

Method 'void android.support.v4.net.ConnectivityManagerCompat.<init>()' is inaccessible to class 'com.facebook.react.modules.netinfo.NetInfoModule #21200

Closed
3 tasks done
reemtariqq opened this issue Sep 19, 2018 · 7 comments
Labels
🌐Networking Related to a networking API. Platform: Android Android applications. Resolution: Locked This issue was locked by the bot.

Comments

@reemtariqq
Copy link

reemtariqq commented Sep 19, 2018

Environment

Run react-native info in your terminal and paste its contents here.

React Native Environment Info:
System:
OS: Windows 10
CPU: x64 Intel(R) Core(TM) i5-6300U CPU @ 2.40GHz
Memory: 1.15 GB / 7.64 GB
Binaries:
Yarn: 1.9.4 -..\npm\yarn.CMD
npm: 6.2.0 - ..\npm.CMD
IDEs:
Android Studio: Version 3.1.0.0 AI-173.4907809

Description

Describe your issue in detail. Include screenshots if needed. If this is a regression, let us know.
I'm trying to integrate an react native compoentn into an existing android app following this http://facebook.github.io/react-native/docs/integration-with-existing-apps and i've done same steps and i got this error

java.lang.RuntimeException: An error occurred while executing doInBackground()
at android.os.AsyncTask$3.done(AsyncTask.java:354)
at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:383)
at java.util.concurrent.FutureTask.setException(FutureTask.java:252)
at java.util.concurrent.FutureTask.run(FutureTask.java:271)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:245)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:764)
Caused by: java.lang.IllegalAccessError: Method 'void android.support.v4.net.ConnectivityManagerCompat.()' is inaccessible to class 'com.facebook.react.modules.netinfo.NetInfoModule' (declaration of 'com.facebook.react.modules.netinfo.NetInfoModule' appears in /data/app/com.dashboard.myapp-kVuiEi_aGz4O9Va5MDTWfQ==/base.apk)
at com.facebook.react.modules.netinfo.NetInfoModule.(NetInfoModule.java:55)
at com.facebook.react.shell.MainReactPackage.createNativeModules(MainReactPackage.java:67)
at com.facebook.react.ReactInstanceManagerImpl.processPackage(ReactInstanceManagerImpl.java:793)
at com.facebook.react.ReactInstanceManagerImpl.createReactContext(ReactInstanceManagerImpl.java:730)
at com.facebook.react.ReactInstanceManagerImpl.access$600(ReactInstanceManagerImpl.java:91)
at com.facebook.react.ReactInstanceManagerImpl$ReactContextInitAsyncTask.doInBackground(ReactInstanceManagerImpl.java:184)
at com.facebook.react.ReactInstanceManagerImpl$ReactContextInitAsyncTask.doInBackground(ReactInstanceManagerImpl.java:169)
at android.os.AsyncTask$2.call(AsyncTask.java:333)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)

Reproducible Demo

http://facebook.github.io/react-native/docs/integration-with-existing-apps

following the above link in order to make demo of how to call react native component inside a native app (android)

@react-native-bot react-native-bot added 🌐Networking Related to a networking API. Platform: Android Android applications. labels Sep 19, 2018
@hey99xx
Copy link

hey99xx commented Sep 19, 2018

I don't understand what version of RN you used from the environment info, but I found that this issue was already fixed #6152 and 3640080 I guess you're on an older version and need to update.

@sunnylqm
Copy link
Contributor

sunnylqm commented Sep 20, 2018

Usually, this means that you need to update your support library. Before it should be updated in sdk manager, and now it is distributed on remote https://developer.android.com/topic/libraries/support-library/setup

@reemtariqq
Copy link
Author

@hey99xx no this was using latest version of react-native in both

@hey99xx
Copy link

hey99xx commented Sep 22, 2018

In your stacktrace there's a class called ReactInstanceManagerImpl. That class was deleted in 2016 in 1a690d5. I cannot see how this stacktrace can belong to a recent version of RN.

@reemtariqq
Copy link
Author

the :+ in gradle file wasn't placing the latest react native version so i've to add it explicitly in the gradle file and everything worked fine after it

@sandeepsmartest
Copy link

sandeepsmartest commented Aug 12, 2019

Please help!!
@reemtariqq i tried your solution but it did not help me.This is how my gradle looks like

`apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.nsks.nsksappwithreact"
minSdkVersion 19
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
ndk { abiFilters 'armeabi-v7a', 'x86' }
}
packagingOptions {
pickFirst 'lib/x86_64/libjsc.so'
pickFirst 'lib/arm64-v8a/libjsc.so'
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
// buildToolsVersion '28.0.3'
}

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'

testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    implementation "com.facebook.react:react-native:+" // From node_modules
implementation 'com.android.support:preference-v7:28.0.0'

}`

and this is the crash im getting:
--------- beginning of crash 2019-08-12 12:36:59.739 4902-4928/com.nsks.nsksappwithreact E/AndroidRuntime: FATAL EXCEPTION: AsyncTask #1 Process: com.nsks.nsksappwithreact, PID: 4902 java.lang.RuntimeException: An error occurred while executing doInBackground() at android.os.AsyncTask$3.done(AsyncTask.java:354) at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:383) at java.util.concurrent.FutureTask.setException(FutureTask.java:252) at java.util.concurrent.FutureTask.run(FutureTask.java:271) at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:245) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) at java.lang.Thread.run(Thread.java:764) Caused by: java.lang.IllegalAccessError: Method 'void androidx.core.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.nsks.nsksappwithreact-2QG9zR2JcmjJfYEWYO9MfQ==/split_lib_dependencies_apk.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:793) at com.facebook.react.ReactInstanceManagerImpl.createReactContext(ReactInstanceManagerImpl.java:730) at com.facebook.react.ReactInstanceManagerImpl.access$600(ReactInstanceManagerImpl.java:91) at com.facebook.react.ReactInstanceManagerImpl$ReactContextInitAsyncTask.doInBackground(ReactInstanceManagerImpl.java:184) at com.facebook.react.ReactInstanceManagerImpl$ReactContextInitAsyncTask.doInBackground(ReactInstanceManagerImpl.java:169) at android.os.AsyncTask$2.call(AsyncTask.java:333) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:245)  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)  at java.lang.Thread.run(Thread.java:764) 

@aharoldk
Copy link

me too

@facebook facebook locked as resolved and limited conversation to collaborators Sep 26, 2019
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Sep 26, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
🌐Networking Related to a networking API. Platform: Android Android applications. Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

7 participants