question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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>

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:9
  • Comments:9

github_iconTop GitHub Comments

34reactions
natantmartinscommented, Sep 15, 2019

solved just adding this on ./android/gradde.properties

android.useAndroidX=true
android.enableJetifier=true
25reactions
SamiChabcommented, Oct 18, 2019

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
Read more comments on GitHub >

github_iconTop Results From Across the Web

error: cannot find symbol import androidx.annotation.Nullable
To solve these two new errors, I tried adding the line implementation "com.android.support:support-annotations:+" to my gradle.build ...
Read more >
Re: errorprone_plugin androidx update - Google Groups
I currently run into the error seen below error I was wondering: ... error: package android.support.annotation does not exist ... symbol: class IntDef...
Read more >
Support Annotations - Android Studio Project Site
When you're using Android Studio and IntelliJ, the IDE will flag calls where you are passing the wrong type of parameter to methods...
Read more >
cannot find symbol viewmanagerresolver ... - You.com
A "Cannot find symbol" error means that the compiler cannot do this. ... I tried to build the app using the GitLab pipeline...
Read more >
cannot find symbol import androidx.annotation.NonNull flutter ...
The following errors are solved by this video:1. cannot find symbol import androidx. annotation.NonNull;2. cannot find symbol import ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found