React Native任务:React Native映射:compileDebugJavaWithJavac失败



我安装了react原生地图,但当我运行react原生运行android时,我得到了这个错误:

C:UsersEmreexamplenode_modulesreact-native-mapslibandroidsrcmainjavacomairbnbandroidreactmapsAirMapView.java:12: error: package androidx.core.view does not exist
import androidx.core.view.GestureDetectorCompat;
^
C:UsersEmreexamplenode_modulesreact-native-mapslibandroidsrcmainjavacomairbnbandroidreactmapsAirMapView.java:13: error: package androidx.core.view does not exist
import androidx.core.view.MotionEventCompat;
^
C:UsersEmreexamplenode_modulesreact-native-mapslibandroidsrcmainjavacomairbnbandroidreactmapsAirMapView.java:22: error: package androidx.core.content.PermissionChecker does not exist
import androidx.core.content.PermissionChecker.checkSelfPermission;
^
C:UsersEmreexamplenode_modulesreact-native-mapslibandroidsrcmainjavacomairbnbandroidreactmapsAirMapView.java:74: error: package androidx.core.content does not exist
import static androidx.core.content.PermissionChecker.checkSelfPermission;
^
C:UsersEmreexamplenode_modulesreact-native-mapslibandroidsrcmainjavacomairbnbandroidreactmapsAirMapView.java:74: error: static import only from classes and interfaces
import static androidx.core.content.PermissionChecker.checkSelfPermission;
^
C:UsersEmreexamplenode_modulesreact-native-mapslibandroidsrcmainjavacomairbnbandroidreactmapsAirMapView.java:109: error: cannot find symbol
private final GestureDetectorCompat gestureDetector;
^
symbol:   class GestureDetectorCompat
location: class AirMapView
C:UsersEmreexamplenode_modulesreact-native-mapslibandroidsrcmainjavacomairbnbandroidreactmapsAirMapView.java:161: error: cannot find symbol
gestureDetector = new GestureDetectorCompat(reactContext, new GestureDetector.SimpleOnGestureListener() {
^
symbol:   class GestureDetectorCompat
location: class AirMapView
C:UsersEmreexamplenode_modulesreact-native-mapslibandroidsrcmainjavacomairbnbandroidreactmapsAirMapView.java:422: error: cannot find symbol
return checkSelfPermission(getContext(), PERMISSIONS[0]) == PackageManager.PERMISSION_GRANTED
^
symbol:   method checkSelfPermission(Context,String)
location: class AirMapView
C:UsersEmreexamplenode_modulesreact-native-mapslibandroidsrcmainjavacomairbnbandroidreactmapsAirMapView.java:423: error: cannot find symbol
|| checkSelfPermission(getContext(), PERMISSIONS[1]) == PackageManager.PERMISSION_GRANTED;
^
symbol:   method checkSelfPermission(Context,String)
location: class AirMapView
C:UsersEmreexamplenode_modulesreact-native-mapslibandroidsrcmainjavacomairbnbandroidreactmapsAirMapView.java:956: 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.
10 errors
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
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
BU¦LD FAILED in 3s
19 actionable tasks: 2 executed, 17 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.

react原生链接react原生映射仅适用于ios。我手动链接了它,但它不起作用。

"天然反应":"0.59.9","反应本地地图":"0.26.1",

我需要做什么来解决它?

这是基本的jetify选项错误,您可以在下面的代码片段中尝试

npxjetify会解决的!

尝试拆分您的maven repos:

allprojects {
repositories {
mavenLocal()
jcenter()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
}
maven {
url "https://maven.google.com"
}
}

}

有关更多详细信息,请参阅此处:https://github.com/react-native-community/react-native-maps/issues/2090

最新更新