react-navigation安装后运行报错



  • "react-native-gesture-handler": "^1.3.0",
    "react-navigation": "^3.11.0"
    装了上面这两个插件后报错,弄了一天了,求大神帮忙看看
    Task :react-native-gesture-handler: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
    14 actionable tasks: 2 executed, 12 up-to-date
    D:\rn\node_modules\react-native-gesture-handler\android\src\main\java\com\swmansion\gesturehandler\react\RNGestureHandlerEvent.java:3: 锟斤拷锟斤拷: 锟斤拷锟斤拷锟絘ndroid.support.v4.util锟斤拷锟斤拷锟斤拷
    import android.support.v4.util.Pools;
    ^
    D:\rn\node_modules\react-native-gesture-handler\android\src\main\java\com\swmansion\gesturehandler\react\RNGestureHandlerEvent.java:19: 锟斤拷锟斤拷: 锟斤拷锟斤拷锟絇ools锟斤拷锟斤拷锟斤拷
    private static final Pools.SynchronizedPool<RNGestureHandlerEvent> EVENTS_POOL =
    ^
    D:\rn\node_modules\react-native-gesture-handler\android\src\main\java\com\swmansion\gesturehandler\react\RNGestureHandlerStateChangeEvent.java:3: 锟斤拷锟斤拷: 锟斤拷锟斤拷锟絘ndroid.support.v4.util锟斤拷锟斤拷锟斤拷
    import android.support.v4.util.Pools;
    ^
    D:\rn\node_modules\react-native-gesture-handler\android\src\main\java\com\swmansion\gesturehandler\react\RNGestureHandlerStateChangeEvent.java:19: 锟斤拷锟斤拷: 锟斤拷锟斤拷锟絇ools锟斤拷锟斤拷锟斤拷
    private static final Pools.SynchronizedPool<RNGestureHandlerStateChangeEvent> EVENTS_POOL =
    ^
    D:\rn\node_modules\react-native-gesture-handler\android\src\main\java\com\swmansion\gesturehandler\react\RNGestureHandlerEvent.java:20: 锟斤拷锟斤拷: 锟斤拷锟斤拷锟絇ools锟斤拷锟斤拷锟斤拷
    new Pools.SynchronizedPool<>(TOUCH_EVENTS_POOL_SIZE);
    ^
    D:\rn\node_modules\react-native-gesture-handler\android\src\main\java\com\swmansion\gesturehandler\react\RNGestureHandlerStateChangeEvent.java:20: 锟斤拷锟斤拷: 锟斤拷锟斤拷锟絇ools锟斤拷锟斤拷锟斤拷
    new Pools.SynchronizedPool<>(TOUCH_EVENTS_POOL_SIZE);
    ^
    注: D:\rn\node_modules\react-native-gesture-handler\android\src\main\java\com\swmansion\gesturehandler\react\RNGestureHandlerButtonViewManager.java使锟矫或覆革拷锟斤拷锟窖癸拷时锟斤拷 API锟斤拷
    注: 锟叫癸拷锟斤拷细锟斤拷息, 锟斤拷使锟斤拷 -Xlint:deprecation 锟斤拷锟铰憋拷锟诫。
    注: 某些锟斤拷锟斤拷锟侥硷拷使锟斤拷锟斤拷未锟斤拷锟斤拷锟津不帮拷全锟侥诧拷锟斤拷锟斤拷
    注: 锟叫癸拷锟斤拷细锟斤拷息, 锟斤拷使锟斤拷 -Xlint:unchecked 锟斤拷锟铰憋拷锟诫。
    6 锟斤拷锟斤拷锟斤拷

    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 4s

    errorError: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
    Failed to install the app. Make sure you have the Android development environment set up: D:\rn\node_modules\react-native-gesture-handler\android\src\main\java\com\swmansion\gesturehandler\react\RNGestureHandlerEvent.java:3: 锟斤拷锟斤拷: 锟斤拷锟斤拷锟絘ndroid.support.v4.util锟斤拷锟斤拷锟斤拷https://facebook.github.io/react-native/docs/getting-started.html#android-development-environment
    . Run CLI with import android.support.v4.util.Pools;--verbose
    flag for more details. ^

    D:\rn\node_modules\react-native-gesture-handler\android\src\main\java\com\swmansion\gesturehandler\react\RNGestureHandlerEvent.java:19: 锟斤拷锟斤拷: 锟斤拷锟斤拷锟絇ools锟斤拷锟斤拷锟斤拷
    private static final Pools.SynchronizedPool<RNGestureHandlerEvent> EVENTS_POOL =
    ^
    D:\rn\node_modules\react-native-gesture-handler\android\src\main\java\com\swmansion\gesturehandler\react\RNGestureHandlerStateChangeEvent.java:3: 锟斤拷锟斤拷: 锟斤拷锟斤拷锟絘ndroid.support.v4.util锟斤拷锟斤拷锟斤拷
    import android.support.v4.util.Pools;
    ^
    D:\rn\node_modules\react-native-gesture-handler\android\src\main\java\com\swmansion\gesturehandler\react\RNGestureHandlerStateChangeEvent.java:19: 锟斤拷锟斤拷: 锟斤拷锟斤拷锟絇ools锟斤拷锟斤拷锟斤拷
    private static final Pools.SynchronizedPool<RNGestureHandlerStateChangeEvent> EVENTS_POOL =
    ^
    D:\rn\node_modules\react-native-gesture-handler\android\src\main\java\com\swmansion\gesturehandler\react\RNGestureHandlerEvent.java:20: 锟斤拷锟斤拷: 锟斤拷锟斤拷锟絇ools锟斤拷锟斤拷锟斤拷
    new Pools.SynchronizedPool<>(TOUCH_EVENTS_POOL_SIZE);
    ^
    D:\rn\node_modules\react-native-gesture-handler\android\src\main\java\com\swmansion\gesturehandler\react\RNGestureHandlerStateChangeEvent.java:20: 锟斤拷锟斤拷: 锟斤拷锟斤拷锟絇ools锟斤拷锟斤拷锟斤拷
    new Pools.SynchronizedPool<>(TOUCH_EVENTS_POOL_SIZE);
    ^
    注: D:\rn\node_modules\react-native-gesture-handler\android\src\main\java\com\swmansion\gesturehandler\react\RNGestureHandlerButtonViewManager.java使锟矫或覆革拷锟斤拷锟窖癸拷时锟斤拷 API锟斤拷
    注: 锟叫癸拷锟斤拷细锟斤拷息, 锟斤拷使锟斤拷 -Xlint:deprecation 锟斤拷锟铰憋拷锟诫。
    注: 某些锟斤拷锟斤拷锟侥硷拷使锟斤拷锟斤拷未锟斤拷锟斤拷锟津不帮拷全锟侥诧拷锟斤拷锟斤拷
    注: 锟叫癸拷锟斤拷细锟斤拷息, 锟斤拷使锟斤拷 -Xlint:unchecked 锟斤拷锟铰憋拷锟诫。
    6 锟斤拷锟斤拷锟斤拷

    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 4s

    at checkExecSyncError (child_process.js:629:11)
    at execFileSync (child_process.js:647:13)
    at runOnAllDevices (D:\rn\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:75:39)
    at buildAndRun (D:\rn\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\index.js:137:41)
    at then.result (D:\rn\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\index.js:103:12)
    at process._tickCallback (internal/process/next_tick.js:68:7)


  • gesture handler(以及所有还没有从support库迁移到androidx库的第三方安卓原生组件)暂时还不能直接支持rn 0.60,需要用jetifier转换一下androidx相关的包

    https://github.com/mikehardy/jetifier#usage-for-source-files



  • @晴明 你降低RN 版本 不要用3.X的插件 多试几次



  • @晴明 谢谢大神,果然有用,搞了一天了,终于好了



  • @1036850584 确实是版本问题,不过用上门那位大神的方法解决了,谢谢



  • @liyuhui653139137 你好,请问这个怎么解决?没有看明白