gpt4 book ai didi

ubuntu - 构建时运行 android react native maps 失败

转载 作者:行者123 更新时间:2023-12-04 19:10:04 39 4
gpt4 key购买 nike

我正在尝试配置在android中运行一个react native项目,启动节点js并准备运行我运行的“构建”

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 设备时,它会正确列出模拟器设备)

最佳答案

解决了!
当前版本的 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",

关于ubuntu - 构建时运行 android react native maps 失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58310777/

39 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com