Comments (25)
if you have the same problem with me
> Task :@react-native-community_netinfo:compileDebugJavaWithJavac FAILED C:\Users\Com02\Desktop\GTD SHOPS\node_modules\@react-native-community\netinfo\android\src\main\java\com\reactnativecommunity\netinfo\ConnectivityReceiver.java:14: error: package android.support.v4.net does not exist import android.support.v4.net.ConnectivityManagerCompat; ^ C:\Users\Com02\Desktop\GTD SHOPS\node_modules\@react-native-community\netinfo\android\src\main\java\com\reactnativecommunity\netinfo\ConnectivityReceiver.java:78: error: cannot find symbol promise.resolve(ConnectivityManagerCompat.isActiveNetworkMetered(getConnectivityManager())); ^ symbol: variable ConnectivityManagerCompat location: class ConnectivityReceiver 2 errors
how to fix it
npx jetify
in project folder
and run the project
npx jetify
from react-native-netinfo.
After I have migrated to AndroidX and install react-native-community/netinfo
I get the following error when I build
I've obviously not setup something correctly but not sure what it could be?
@matt-oakes you mention running a command after an npm install, what is the command?
I have added the following if that's what you mean
android.enableJetifier=true
android.useAndroidX=true
This has nothing to do with it however thought I would let you know. I noticed when you run the command react-native link @react-native-community/netinfo
This creates an entry in the android/settings.gradle like this
include ':@react-native-community_netinfo'
project(':@react-native-community_netinfo').projectDir = new File(rootProject.projectDir, '../node_modules/@react-native-community/netinfo/android')
However in the documentation it says to add it like this
include ':react-native-community-netinfo'
project(':react-native-community-netinfo').projectDir = new File(rootProject.projectDir, '../node_modules/@react-native-community/netinfo/android')
from react-native-netinfo.
👋 Thanks for the extra information.
- Can you confirm if you followed the full instructions to migrate to AndroidX here: https://developer.android.com/jetpack/androidx/migrate
- Please provide the full contents of
android/settings.gradle
,android/build.gradle
andandroid/app/build.gradle
.
from react-native-netinfo.
Sorry, I should have asked for you gradle.properties
too. It should include these lines:
android.useAndroidX=true
android.enableJetifier=true
If converting back to non-AndroidX is fixing the issue, it sounds like you are not setting up Jetifier correctly. This is the Android build tool which translates any transient dependencies on the old support library to the new AndroidX variants, as described here. If this library is not working when you're making the change, then it's likely that Jetifier is not set up correctly.
Just to note though, that I've not yet tried this process myself, so I could be mistaken. This is based off the reading of the migration document from Google.
I'm going to close this issue now, but I'll look into converting this library to AndroidX.
from react-native-netinfo.
@matt-oakes @mikehardy I re ran npx jetifier
and it built successfully locally and on CI which is great. Thanks for this useful tool - great work!
My only concern is that It is not ideal to keep running this tool on every yarn
or deployment on CI. I guess the only solution is to wait for various package dependencies to migrate over to the new mappings.
I see theres an outstanding PR (https://github.com/react-native-community/react-native-netinfo/pull/115/files) to replace import android.support.v4.net.ConnectivityManagerCompat
. This is the last package giving me problems so I hope once this is released, i can remove the npx jetifier
step.
Big thanks again guys for all your time and effort :)
from react-native-netinfo.
Hi guys, has anyone found a solution to this error? error: package android.support.v4.net does not exist error: cannot find symbol variable ConnectivityManagerCompat
from react-native-netinfo.
I have gone through the migration steps, I believe it's all correct. Here are the file contents:
settings.gradle.txt
build.gradle.txt
app-build.gradle.txt
from react-native-netinfo.
I've tried a few other things. Given the error was for ConnectivityManagerCompat I tried adding support-compat and also androidx.core to the app/build.gradle. Still didn't do anything, it can't find the library.
from react-native-netinfo.
So the source of my problems seems to be that the @react-native-communit/slider module requires the root supportLibVersion to be an androidx version. This seems to break things with other apps (specifically netinfo using the support libs).
I'm rolling back things to see if this fixes the problems.
from react-native-netinfo.
I rolled back @react-native-community/slider to 1.0.4 which didn't include androidx and fixed up a few other items related to running the migration and I'm building again.
from react-native-netinfo.
I'm getting this same error but I'm not using AndroidX. For me it shows up when I add @react-native-firebase/[email protected] to the project.
from react-native-netinfo.
Hi @ryanlntn ! I faced up the same issue like you. After I added the latest alpha version of the @react-native-firebase/app I got the same error message. Did you find any solution for this issue?
from react-native-netinfo.
@betko I just ended up downgrading to 5.x for now. I'll likely give it another go once it's out of alpha.
from react-native-netinfo.
I got exactly the same issue. Needed to update to androidX because of react-native-video.
from react-native-netinfo.
same error
from react-native-netinfo.
A tool has been built which might help with these issues. Can you all have a look at the instructions here and let me know if it fixes the issue for you:
https://github.com/mikehardy/jetifier#usage-for-source-files
from react-native-netinfo.
Same issue for me - I just migrated to compileSdkVersion 28 for react-native-video. I've successfully migrated the project across to android X and this appears to be the last barrier to a successful build (for now at least). Im using react-native 0.57.8
and and react-native-netinfo 2.0.10
.
@matt-oakes I've tried using the steps on jetifier without success. Any ideas?
Build.gradle:
buildscript {
ext {
minSdkVersion = 16
compileSdkVersion = 28
targetSdkVersion = 28
supportLibVersion = "28.0.0"
}
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath 'com.google.gms:google-services:4.1.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
from react-native-netinfo.
@jamesmcn1 Make sure you run the Jetifier command after every npm install
or yarn add
. It changes the files in your node_modules
and running those will override it changes.
You can also run ./gradlew app:dependencies
in your android
folder to see what dependencies you have. You can search for "androidx" and "support" to see if there is still a mixture of both.
It's possible that the Jetifier tool is not working for you as it's pretty experimental. If it doesn't work for one of the libraries you use, you can open an issue on the dependency over there and @mikehardy will take a look.
from react-native-netinfo.
So I don't get buried, I added a troubleshooting section on jetifier: https://github.com/mikehardy/jetifier#troubleshooting - there are a couple of classes of issue that will always be problems in the underlying libraries, and you'll need to open pull requests with them - please use that section before opening jetifier issues.
I recommend running jetify as a postinstall hook (after patch-package if you use it) so you don't forget to re-apply
from react-native-netinfo.
As of yesterday jetifier has a reverse mode, which gives libraries like this an avenue to support their support-library users (via education to use jetifier -r, mostly) without branching. So libraries should be able to "safely" convert at this point. "Safely" is in scare-quotes because there will be inevitable github issues as library consumers require education
from react-native-netinfo.
I am familiar with that error.
Without details I'd only be speculating on why you're getting it.
Are you still on support libraries and using jetifier -r, or are you AndroidX and your dependencies are messed up? No idea
from react-native-netinfo.
I am familiar with that error.
Without details I'd only be speculating on why you're getting it.
Are you still on support libraries and using jetifier -r, or are you AndroidX and your dependencies are messed up? No idea
@mikehardy our project is using androidX and the dependancies seems to be messed up, some use andoidX, some don't.
from react-native-netinfo.
Okay, then you've got to get them all aligned, and pointed to AndroidX. There are a bunch of ways that can go wrong, but in general you can diagnose by running cd android && ./gradlew :app:dependencies
and examining the output to see what module is calling in the support library, then investigating that module to see how you can make it stop doing that. This is out of scope for netinfo though I think - it should be working here...
from react-native-netinfo.
Yes. This library has been updated to work with AndroidX. The issue is likely coming from another library which has not been updated.
from react-native-netinfo.
sorry ***
Run the project
react-native run-android
from react-native-netinfo.
Related Issues (20)
- The listener did not execute when WiFi seamlessly reconnected on Android HOT 1
- Android's WiFi seamless switching network seamless recovery HOT 1
- Huawei's listing was rejected, obtaining SSID, IP, and BSSID before calling the privacy protocol HOT 10
- Wrong pending request abort
- Sending request problem HOT 6
- NetInfo.configure is not working, HOT 1
- ID of the CellTower in use HOT 1
- Execution failed for task `:react-native-community_netinfo:compileReleaseJavaWithJavac`. HOT 1
- "SSID, BSSID, IP" not compliant with Huawei App market Policies HOT 4
- getting logout/crash application when switch the network HOT 1
- Can't get wifi ssid on IOS HOT 1
- I keep getting this error when i install the package, how can i fix it HOT 4
- isInternetReachable returns true while there is no data connection but my wifi is on and connected HOT 5
- let me explain clearly I connected my device to another device's hotspot and the device I connected to has no access to the internet however Netinfo.isInternetReachable returns true. HOT 1
- Fix TypeSafety for useNetInfo hook results
- NetworkCallbackConnectivityReceiver.register android.net.ConnectivityManager$TooManyRequestsException HOT 2
- Execution failed for task ':react-native-community_netinfo:compileDebugJavaWithJavac' HOT 6
- Invalid hook call
- NetInfo Library: isConnected Value Not Updating After Reconnecting to Internet HOT 5
- errors as a when using the netinfo fetch command when I had a javascript fetch in my component
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-native-netinfo.