React-native: 3rd party lib compile failed after upgrading to 0.57.2 or newer

Created on 28 Oct 2018  ·  15Comments  ·  Source: facebook/react-native

Environment

[skip envinfo]
"react": "16.6.0-alpha.8af6728",
"react-native": "0.57.4",
Android Platform.

`react-native info` stuck

Description

All 3rd-party library compile failed after upgrading from 0.57.1 to newer version

One of these lib.

Task :react-native-gesture-handler:compileReleaseJavaWithJavac FAILED
/Users/dengguo/dev/novelsearcher/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerModule.java:16: error: package com.facebook.react.module.annotations does not exist
import com.facebook.react.module.annotations.ReactModule;
^
/Users/dengguo/dev/novelsearcher/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerModule.java:19: error: cannot find symbol
import com.facebook.react.uimanager.UIBlock;
^
symbol: class UIBlock
location: package com.facebook.react.uimanager
/Users/dengguo/dev/novelsearcher/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerModule.java:40: error: cannot find symbol
@ReactModule(name=RNGestureHandlerModule.MODULE_NAME)
^
symbol: class ReactModule
/Users/dengguo/dev/novelsearcher/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerRootViewManager.java:4: error: package com.facebook.react.module.annotations does not exist
import com.facebook.react.module.annotations.ReactModule;
^
/Users/dengguo/dev/novelsearcher/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerRootViewManager.java:17: error: cannot find symbol
@ReactModule(name = RNGestureHandlerRootViewManager.REACT_CLASS)
^
symbol: class ReactModule
/Users/dengguo/dev/novelsearcher/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerButtonViewManager.java:196: error: cannot find symbol
@ReactProp(name = ViewProps.BORDER_RADIUS)
^
symbol: variable BORDER_RADIUS
location: class ViewProps
/Users/dengguo/dev/novelsearcher/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerModule.java:574: error: cannot find symbol
final int rootViewTag = uiManager.resolveRootTagFromReactTag(ancestorViewTag);
^
symbol: method resolveRootTagFromReactTag(int)
location: variable uiManager of type UIManagerModule
/Users/dengguo/dev/novelsearcher/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerModule.java:582: error: cannot find symbol
if (root.getRootView().getRootViewTag() == rootViewTag) {
^
symbol: method getRootViewTag()
location: class ReactRootView
/Users/dengguo/dev/novelsearcher/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerModule.java:598: error: cannot find symbol
uiManager.addUIBlock(new UIBlock() {
^
symbol: class UIBlock
location: class RNGestureHandlerModule
/Users/dengguo/dev/novelsearcher/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerModule.java:634: error: cannot find symbol
int rootViewTag = uiManager.resolveRootTagFromReactTag(viewTag);
^
symbol: method resolveRootTagFromReactTag(int)
location: variable uiManager of type UIManagerModule
/Users/dengguo/dev/novelsearcher/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerModule.java:641: error: cannot find symbol
if (root.getRootView().getRootViewTag() == rootViewTag) {
^
symbol: method getRootViewTag()
location: class ReactRootView
/Users/dengguo/dev/novelsearcher/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerEvent.java:41: error: method init in class Event cannot be applied to given types;
super.init(handler.getView().getId());
^
required: int,long
found: int
reason: actual and formal argument lists differ in length
where T is a type-variable:
T extends Event declared in class Event
/Users/dengguo/dev/novelsearcher/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerStateChangeEvent.java:45: error: method init in class Event cannot be applied to given types;
super.init(handler.getView().getId());
^
required: int,long
found: int
reason: actual and formal argument lists differ in length
where T is a type-variable:
T extends Event declared in class Event
/Users/dengguo/dev/novelsearcher/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerPackage.java:18: error: RNGestureHandlerPackage is not abstract and does not override abstract method createJSModules() in ReactPackage
public class RNGestureHandlerPackage implements ReactPackage {
^
/Users/dengguo/dev/novelsearcher/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/react/RNViewConfigurationHelper.java:44: error: cannot find symbol
return parent.getChildAt(((ReactViewGroup) parent).getZIndexMappedChildIndex(index));
^
symbol: method getZIndexMappedChildIndex(int)
location: class ReactViewGroup
Note: /Users/dengguo/dev/novelsearcher/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.
15 errors

Ran Commands Locked

All 15 comments

Can you run react-native info and edit your issue to include these results under the Environment section?

If you believe this information is irrelevant to the reported issue, you may write [skip envinfo] under Environment to let us know.

Same issue. Did you find a solution?

I am closing this issue because it does not contain the necessary environment info, and there has been no followup in a while.

If you found this thread after encountering the same issue in the latest release, please feel free to create a new issue with up-to-date information by clicking here.

@eyalabadi98 no, still using 0.57.1.
you ?

I was on react-native 0.57.4 and upgraded to 0.57.5 with react-native-git-upgrade (with help from this) and got exactly this error.

After running a complete clearing of cache everything worked as expected.

EDIT:
oh, and react-native-git-upgrade did not upgrade my react-test-renderer dependency automatically, So I ran a manual upgrade of that package yarn upgrade [email protected]

@micnil thanks!

Its not working anymore

react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerModule.java:16: error: package com.facebook.react.module.annotations does not exist
import com.facebook.react.module.annotations.ReactModule;
^
/Users/c-kunal.chugh/Desktop/bizmanager-react/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerModule.java:19: error: cannot find symbol
import com.facebook.react.uimanager.UIBlock;
^
symbol: class UIBlock

Same issue as @kunal886496

i dont know why React Native have so many problems.

I managed to fix this @kunal886496.
You need to add reference to node modules in android/build.gradle
allprojects { repositories { maven { url "$rootDir/../node_modules/react-native/android" }}}
And I also used this version of react-native-gesture-handler : "react-native-gesture-handler": "1.0.16"

Hi ,

Thanks for your reply.
Well what you told didn't work.
I am using the library react native image crop picker.
The root cause of the problem is this library.
Their latest version has some problem.

On Tue, Mar 19, 2019, 15:00 Anur Becirovic notifications@github.com wrote:

I managed to fix this @kunal886496 https://github.com/kunal886496.
You need to add reference to node modules in android/build.gradle
allprojects { repositories { ... maven { url
"$rootDir/../node_modules/react-native/android" }}}
And I also used this version of react-native-gesture-handler >
"react-native-gesture-handler": "1.0.16"


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/facebook/react-native/issues/21981#issuecomment-474262039,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AbE9Bh_mNkEkOJJI-vsg9GkQuHn6N85qks5vYK5NgaJpZM4X-BGA
.

node_modules/@react-native-community/async-storage/android/src/main/java/com/reactnativecommunity/asyncstorage/AsyncStorageModule.java:26: error: package com.facebook.react.module.annotations does not exist
import com.facebook.react.module.annotations.ReactModule;
^
node_modules/@react-native-community/async-storage/android/src/main/java/com/reactnativecommunity/asyncstorage/AsyncStorageModule.java:37: error: cannot find symbol
@ReactModule(name = AsyncStorageModule.NAME)
^
symbol: class ReactModule

After struggling a couple of hours with it I removed node_modules folder, deleted yarn.lock file and reinstalled dependencies and it worked!
Still, don't know what exactly was going on but I hope it helps...

"react": "16.8.3",
"react-native": "0.59.2",
"react-native-gesture-handler": "^1.1.0",

In android/build.gradle, add below code than it becomes working

allprojects {
    repositories {
        mavenLocal()
        google()
        jcenter()
      maven {
                        // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
                        url "$rootDir/../node_modules/react-native/android"
            }
    }
}
Was this page helpful?
0 / 5 - 0 ratings