运行 android 反应原生地图构建失败

Run android react native maps failed on build

我正在尝试在 android 一个 React Native 项目中配置 运行,以启动节点 js 并准备 运行 "build" i 运行

cd android && ./gradlew clean && cd .. && react-native start

在另一个终端我 运行

react-native run-android

我的package.json:

"react-native": "0.59.0",
"react-native-maps": "git://github.com/react-native-community/react-native-maps.git#master",

在第一个终端出现后,我收到以下错误:

    > Task :react-native-maps:compileDebugJavaWithJa
    vac FAILED
    warning: [options] source value 7 is obsolete and will be removed in a future release
    warning: [options] target value 7 is obsolete and will be removed in a future release
    warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
    /node_modules/react-native-maps/lib/android/src/main/java/com/airbnb/android/react/maps/AirMapView.java:12: error: package         androidx.core.view does not exist
    import androidx.core.view.GestureDetectorCompat;
                     ^
    /node_modules/react-native-maps/lib/android/src/main/java/com/airbnb/android/react/maps/AirMapView.java:13: error: package androidx.core.view does not exist
    import androidx.core.view.MotionEventCompat;
                     ^
   /node_modules/react-native-maps/lib/android/src/main/java/com/airbnb/android/react/maps/AirMapView.java:73: error: package androidx.core.content does not exist
    import static androidx.core.content.PermissionChecker.checkSelfPermission;
                               ^
    /node_modules/react-native-maps/lib/android/src/main/java/com/airbnb/android/react/maps/AirMapView.java:73: error: static            
    import only from classes and interfaces
    import static androidx.core.content.PermissionChecker.checkSelfPermission;
    ^
    /node_modules/react-native-maps/lib/android/src/main/java/com/airbnb/android/react/maps/AirMapView.java:108: error: cannot find symbol
      private final GestureDetectorCompat gestureDetector;
            ^
      symbol:   class GestureDetectorCompat
      location: class AirMapView
    /node_modules/react-native-maps/lib/android/src/main/java/com/airbnb/android/react/maps/AirMapView.java:165: error: cannot find symbol
            new GestureDetectorCompat(reactContext, new GestureDetector.SimpleOnGestureListener() {
        ^
      symbol:   class GestureDetectorCompat
      location: class AirMapView

    /node_modules/react-native-maps/lib/android/src/main/java/com/airbnb/android/react/maps/AirMapView.java:421: error: cannot find symbol
        return checkSelfPermission(getContext(), PERMISSIONS[0]) == PackageManager.PERMISSION_GRANTED ||
       ^
      symbol:   method checkSelfPermission(Context,String)
      location: class AirMapView
    /node_modules/react-native-maps/lib/android/src/main/java/com/airbnb/android/react/maps/AirMapView.java:422: error: cannot find symbol
            checkSelfPermission(getContext(), PERMISSIONS[1]) == PackageManager.PERMISSION_GRANTED;
    ^
      symbol:   method checkSelfPermission(Context,String)
      location: class AirMapView

    /node_modules/react-native-maps/lib/android/src/main/java/com/airbnb/android/react/maps/AirMapView.java:949: error: cannot find symbol
        int action = MotionEventCompat.getActionMasked(ev);
                     ^
      symbol:   variable MotionEventCompat
      location: class AirMapView
    Note: Some input files use or override 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.
    9 errors
    3 warnings

    FAILURE: Build failed with an exception.

    * What went wrong:
    Execution failed for task ':react-native-maps: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 1s
    186 actionable tasks: 1 executed, 185 up-to-date
    error Could not install the app on the device, r
    ead 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 app:installDebug

这个错误是react-native-maps插件的错误还是识别设备的问题? (当我 运行 adb devices 时,它会正确列出模拟器设备)

已解决! 当前版本的 react-native-maps 仅与 0.60.+ react-native 版本兼容。

我在 package.json 中更改了 react-native-maps 版本 来自

"react-native-maps": "git://github.com/react-native-community/react-native-maps.git#master",

"react-native-maps": "^0.25.0",