Can't run dev env on android - package androidx.core.net does not exist
Summary
After successfully running yarn install
I ran into an error related to the reactnativecommunity/netinfo package.
Steps to reproduce
yarn install
react-native run-android
Platform information
(Device, Android/iOS version, system stats, screen size) Windows 10, Node 10.16.3, physical android device
App version
latest master branch
What is the current bug behavior?
Build fails and doesn't load onto android device / emulator
What is the expected correct behavior?
Builds correctly and loads onto android device / emulator
Relevant logs and/or screenshots
> Task :@react-native-community_netinfo:compileDebugJavaWithJavac FAILED
Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/5.4.1/userguide/command_line_interface.html#sec:command_line_warnings
19 actionable tasks: 6 executed, 13 up-to-date
C:\Users\letif\dev\mobile-native\node_modules\@react-native-community\netinfo\android\src\main\java\com\reactnativecommunity\netinfo\ConnectivityReceiver.java:12: error: package androidx.core.net does not exist
import androidx.core.net.ConnectivityManagerCompat;
^
C:\Users\letif\dev\mobile-native\node_modules\@react-native-community\netinfo\android\src\main\java\com\reactnativecommunity\netinfo\ConnectivityReceiver.java:154: error: cannot find symbol
ConnectivityManagerCompat.isActiveNetworkMetered(getConnectivityManager());
^
symbol: variable ConnectivityManagerCompat
location: class ConnectivityReceiver
2 errors
FAILURE: Build failed with an exception.
location: class ConnectivityReceiver
2 errors
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':@react-native-community_netinfo:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 5s
at checkExecSyncError (child_process.js:629:11)
at execFileSync (child_process.js:647:13)
at runOnAllDevices (C:\Users\letif\AppData\Roaming\nvm\v10.16.3\node_modules\react-native\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:94:39)
at buildAndRun (C:\Users\letif\AppData\Roaming\nvm\v10.16.3\node_modules\react-native\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\index.js:158:41)
at then.result (C:\Users\letif\AppData\Roaming\nvm\v10.16.3\node_modules\react-native\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\index.js:125:12)
at process._tickCallback (internal/process/next_tick.js:68:7)
Possible fixes
Unsure of possible fixes, posting here for help. It seems to be an issue with upgrading to AndroidX within the reactnativecommunity/netinfo library. I've played around with jetifier (both directions) and neither seem to work. jetify -r
results in complaining about @NonNull
annotation missing. Any insight into the minds team environments would be helpful as this is a fresh install of all dependencies.
- Developer
@msantang78 or @juanmsolaro may be able to assist you here
- Guest
@msantang78 @juanmsolaro any insight?
- Developer
Hey Jim! What I first noticed is that we are not pointing to master branch in our dev env anymore. Try pointing AND updating to release/3.11.0 Then you can run
yarn
and thenyarn android