App don’t run: BUILD FAILED error: cannot find symbol import androidx.annotation.Nullable

When run ‘react-native run-android’ i got this BUILD FAILED. i’ve tried many things but no one worked out and i don’t know what is this androidx.

Previously, the ‘gesture manager’ compiled without problems. I think it was after I ran the commands that I saw on github:

npm i jetifier
npx jetify

trying to solve a problem with ‘Firebase’. But I don’t even know what the functions of these commands were.

The problem:

PS G:\ProjetoAndroid\CantinaFacil-master> react-native run-android
info JS server already running.
info Building and installing the app on the device (cd android && gradlew.bat app:installDebug)...

> Configure project :react-native-orientation
WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html

> Task :react-native-gesture-handler:compileDebugJavaWithJavac FAILED
G:\ProjetoAndroid\CantinaFacil-master\node_modules\react-native-gesture-handler\android\src\main\java\com\swmansion\gesturehandler\react\RNGestureHandlerEnabledRootView.java:10: error: cannot find symbol
import androidx.annotation.Nullable;
                          ^
  symbol:   class Nullable
  location: package androidx.annotation
G:\ProjetoAndroid\CantinaFacil-master\node_modules\react-native-gesture-handler\android\lib\src\main\java\com\swmansion\gesturehandler\GestureHandlerOrchestrator.java:14: error: cannot find symbol
import androidx.annotation.Nullable;
                          ^
  symbol:   class Nullable
  location: package androidx.annotation
G:\ProjetoAndroid\CantinaFacil-master\node_modules\react-native-gesture-handler\android\src\main\java\com\swmansion\gesturehandler\react\RNGestureHandlerEvent.java:3: error: package androidx.core.util does not exist
import androidx.core.util.Pools;
                         ^
G:\ProjetoAndroid\CantinaFacil-master\node_modules\react-native-gesture-handler\android\src\main\java\com\swmansion\gesturehandler\react\RNGestureHandlerEvent.java:11: error: cannot find symbol
import androidx.annotation.Nullable;
                          ^
  symbol:   class Nullable
  location: package androidx.annotation
G:\ProjetoAndroid\CantinaFacil-master\node_modules\react-native-gesture-handler\android\src\main\java\com\swmansion\gesturehandler\react\RNGestureHandlerEvent.java:19: error: package Pools does not exist
  private static final Pools.SynchronizedPool<RNGestureHandlerEvent> EVENTS_POOL =
                            ^
G:\ProjetoAndroid\CantinaFacil-master\node_modules\react-native-gesture-handler\android\src\main\java\com\swmansion\gesturehandler\react\RNGestureHandlerModule.java:36: error: cannot find symbol
import androidx.annotation.Nullable;
                          ^
  symbol:   class Nullable
  location: package androidx.annotation
G:\ProjetoAndroid\CantinaFacil-master\node_modules\react-native-gesture-handler\android\src\main\java\com\swmansion\gesturehandler\react\RNGestureHandlerRegistry.java:11: error: cannot find symbol
import androidx.annotation.Nullable;
                          ^
  symbol:   class Nullable
  location: package androidx.annotation
G:\ProjetoAndroid\CantinaFacil-master\node_modules\react-native-gesture-handler\android\src\main\java\com\swmansion\gesturehandler\react\RNGestureHandlerPackage.java:16: error: cannot find symbol
import androidx.annotation.Nullable;
                          ^
  symbol:   class Nullable
  location: package androidx.annotation
G:\ProjetoAndroid\CantinaFacil-master\node_modules\react-native-gesture-handler\android\src\main\java\com\swmansion\gesturehandler\react\RNGestureHandlerRootInterface.java:3: error: cannot find symbol
import androidx.annotation.Nullable;
                          ^
  symbol:   class Nullable
  location: package androidx.annotation
G:\ProjetoAndroid\CantinaFacil-master\node_modules\react-native-gesture-handler\android\src\main\java\com\swmansion\gesturehandler\react\RNGestureHandlerRootView.java:10: error: cannot find symbol
import androidx.annotation.Nullable;
                          ^
  symbol:   class Nullable
  location: package androidx.annotation
G:\ProjetoAndroid\CantinaFacil-master\node_modules\react-native-gesture-handler\android\src\main\java\com\swmansion\gesturehandler\react\RNGestureHandlerRootViewManager.java:10: error: cannot find symbol
import androidx.annotation.Nullable;
                          ^
  symbol:   class Nullable
  location: package androidx.annotation
G:\ProjetoAndroid\CantinaFacil-master\node_modules\react-native-gesture-handler\android\src\main\java\com\swmansion\gesturehandler\react\RNGestureHandlerStateChangeEvent.java:3: error: package androidx.core.util does not exist
import androidx.core.util.Pools;
                         ^
G:\ProjetoAndroid\CantinaFacil-master\node_modules\react-native-gesture-handler\android\src\main\java\com\swmansion\gesturehandler\react\RNGestureHandlerStateChangeEvent.java:11: error: cannot find symbol
import androidx.annotation.Nullable;
                          ^
  symbol:   class Nullable
  location: package androidx.annotation
G:\ProjetoAndroid\CantinaFacil-master\node_modules\react-native-gesture-handler\android\src\main\java\com\swmansion\gesturehandler\react\RNGestureHandlerStateChangeEvent.java:19: error: package Pools does not exist
  private static final Pools.SynchronizedPool<RNGestureHandlerStateChangeEvent> EVENTS_POOL =
                            ^
G:\ProjetoAndroid\CantinaFacil-master\node_modules\react-native-gesture-handler\android\src\main\java\com\swmansion\gesturehandler\react\RNGestureHandlerEnabledRootView.java:14: error: cannot find symbol
  private @Nullable ReactInstanceManager mReactInstanceManager;
           ^
  symbol:   class Nullable
  location: class RNGestureHandlerEnabledRootView
G:\ProjetoAndroid\CantinaFacil-master\node_modules\react-native-gesture-handler\android\src\main\java\com\swmansion\gesturehandler\react\RNGestureHandlerEnabledRootView.java:15: error: cannot find symbol
  private @Nullable RNGestureHandlerRootHelper mGestureRootHelper;
           ^
  symbol:   class Nullable
  location: class RNGestureHandlerEnabledRootView
G:\ProjetoAndroid\CantinaFacil-master\node_modules\react-native-gesture-handler\android\src\main\java\com\swmansion\gesturehandler\react\RNGestureHandlerEnabledRootView.java:63: error: cannot find symbol
          @Nullable Bundle initialProperties) {
           ^
  symbol:   class Nullable
  location: class RNGestureHandlerEnabledRootView
G:\ProjetoAndroid\CantinaFacil-master\node_modules\react-native-gesture-handler\android\lib\src\main\java\com\swmansion\gesturehandler\GestureHandlerOrchestrator.java:321: error: cannot find symbol
  private boolean isViewAttachedUnderWrapper(@Nullable View view) {
                                              ^
  symbol:   class Nullable
  location: class GestureHandlerOrchestrator
G:\ProjetoAndroid\CantinaFacil-master\node_modules\react-native-gesture-handler\android\src\main\java\com\swmansion\gesturehandler\react\RNGestureHandlerEvent.java:24: error: cannot find symbol
          @Nullable RNGestureHandlerEventDataExtractor dataExtractor) {
           ^
  symbol:   class Nullable
  location: class RNGestureHandlerEvent
G:\ProjetoAndroid\CantinaFacil-master\node_modules\react-native-gesture-handler\android\src\main\java\com\swmansion\gesturehandler\react\RNGestureHandlerEvent.java:40: error: cannot find symbol
          @Nullable RNGestureHandlerEventDataExtractor dataExtractor) {
           ^
  symbol:   class Nullable
  location: class RNGestureHandlerEvent
G:\ProjetoAndroid\CantinaFacil-master\node_modules\react-native-gesture-handler\android\src\main\java\com\swmansion\gesturehandler\react\RNGestureHandlerModule.java:529: error: cannot find symbol
  public @Nullable Map getConstants() {
          ^
  symbol:   class Nullable
  location: class RNGestureHandlerModule
G:\ProjetoAndroid\CantinaFacil-master\node_modules\react-native-gesture-handler\android\src\main\java\com\swmansion\gesturehandler\react\RNGestureHandlerModule.java:632: error: cannot find symbol
  private @Nullable RNGestureHandlerRootHelper findRootHelperForViewAncestor(int viewTag) {
           ^
  symbol:   class Nullable
  location: class RNGestureHandlerModule
G:\ProjetoAndroid\CantinaFacil-master\node_modules\react-native-gesture-handler\android\src\main\java\com\swmansion\gesturehandler\react\RNGestureHandlerModule.java:649: error: cannot find symbol
  private @Nullable HandlerFactory findFactoryForHandler(GestureHandler handler) {
           ^
  symbol:   class Nullable
  location: class RNGestureHandlerModule
G:\ProjetoAndroid\CantinaFacil-master\node_modules\react-native-gesture-handler\android\src\main\java\com\swmansion\gesturehandler\react\RNGestureHandlerRegistry.java:23: error: cannot find symbol
  public synchronized @Nullable GestureHandler getHandler(int handlerTag) {
                       ^
  symbol:   class Nullable
  location: class RNGestureHandlerRegistry
G:\ProjetoAndroid\CantinaFacil-master\node_modules\react-native-gesture-handler\android\src\main\java\com\swmansion\gesturehandler\react\RNGestureHandlerRootInterface.java:6: error: cannot find symbol
  @Nullable RNGestureHandlerRootHelper getRootHelper();
   ^
  symbol:   class Nullable
  location: interface RNGestureHandlerRootInterface
G:\ProjetoAndroid\CantinaFacil-master\node_modules\react-native-gesture-handler\android\src\main\java\com\swmansion\gesturehandler\react\RNGestureHandlerRootView.java:14: error: cannot find symbol
  private @Nullable RNGestureHandlerRootHelper mRootHelper;
           ^
  symbol:   class Nullable
  location: class RNGestureHandlerRootView
G:\ProjetoAndroid\CantinaFacil-master\node_modules\react-native-gesture-handler\android\src\main\java\com\swmansion\gesturehandler\react\RNGestureHandlerRootViewManager.java:42: error: cannot find symbol
  public @Nullable Map getExportedCustomDirectEventTypeConstants() {
          ^
  symbol:   class Nullable
  location: class RNGestureHandlerRootViewManager
G:\ProjetoAndroid\CantinaFacil-master\node_modules\react-native-gesture-handler\android\src\main\java\com\swmansion\gesturehandler\react\RNGestureHandlerStateChangeEvent.java:26: error: cannot find symbol
          @Nullable RNGestureHandlerEventDataExtractor dataExtractor) {
           ^
  symbol:   class Nullable
  location: class RNGestureHandlerStateChangeEvent
G:\ProjetoAndroid\CantinaFacil-master\node_modules\react-native-gesture-handler\android\src\main\java\com\swmansion\gesturehandler\react\RNGestureHandlerStateChangeEvent.java:44: error: cannot find symbol
          @Nullable RNGestureHandlerEventDataExtractor dataExtractor) {
           ^
  symbol:   class Nullable
  location: class RNGestureHandlerStateChangeEvent
G:\ProjetoAndroid\CantinaFacil-master\node_modules\react-native-gesture-handler\android\lib\src\main\java\com\swmansion\gesturehandler\GestureHandlerOrchestrator.java:328: error: cannot find symbol
    @Nullable ViewParent parent = view.getParent();
     ^
  symbol:   class Nullable
  location: class GestureHandlerOrchestrator
G:\ProjetoAndroid\CantinaFacil-master\node_modules\react-native-gesture-handler\android\src\main\java\com\swmansion\gesturehandler\react\RNGestureHandlerEvent.java:20: error: package Pools does not exist
          new Pools.SynchronizedPool<>(TOUCH_EVENTS_POOL_SIZE);
                   ^
G:\ProjetoAndroid\CantinaFacil-master\node_modules\react-native-gesture-handler\android\src\main\java\com\swmansion\gesturehandler\react\RNGestureHandlerStateChangeEvent.java:20: error: package Pools does not exist
          new Pools.SynchronizedPool<>(TOUCH_EVENTS_POOL_SIZE);
                   ^
Note: G:\ProjetoAndroid\CantinaFacil-master\node_modules\react-native-gesture-handler\android\src\main\java\com\swmansion\gesturehandler\react\RNGestureHandlerButtonViewManager.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
32 errors

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':react-native-gesture-handler: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 2s
19 actionable tasks: 1 executed, 18 up-to-date
error Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/getting-started.html
error Command failed: gradlew.bat app:installDebug. Run CLI with --verbose flag for more details.
PS G:\ProjetoAndroid\CantinaFacil-master>

3 thoughts on “App don’t run: BUILD FAILED error: cannot find symbol import androidx.annotation.Nullable

  1. I finally made it work…
    What I did:

    • unlinked react-native-gesture-handler
    • uninstalled and reinstalled react-native-gesture-handler
    • linked react-native-gesture-handler

    Then I just followed some of the installation steps of the react navigation docs

    • yarn add --dev jetifier
    • in package.json->scripts, add "postinstall": "jetifier -r"
    • yarn postinstall