我是React-native的新手。我尝试使用npm i react-native-maps --save
我引用此https://github.com/react-community/react-native-maps/blob/master/docs/installation.md并按照所有步骤进行操作。我获得了Google API,并将其放入 AndroidManifest 。我的 Google Play服务版本是 14.5.74 。我还添加了android/app/build.gradle
。在这里
ext {
buildToolsVersion =“ 27.0.3”
minSdkVersion = 16
compileSdkVersion = 27
targetSdkVersion = 26
supportLibVersion =“ 27.1.1”
googlePlayServicesVersion =“ 14.5.74”
androidMapsUtilsVersion =“ 0.5+” }
我曾经
“依赖项”:{
“ @ babel / runtime”:“ ^ 7.1.5”,
“反应”:“ 16.5.0”,
“ native-native”:“ 0.57.0”,
“ react-native-maps”:“ ^ 0.22.1”},
但是我得到一个错误
询问:反应本机映射:compileDebugJavaWithJavac FAILED D:_reactNative \ MSB \ LocationMap \ node_modules \ react-native-maps \ lib \ android \ src \ main \ java \ com \ airbnb \ android \ react \ maps \ AirMapPolyline.java:8: 错误:找不到符号
导入 com.google.android.gms.maps.model.Cap; ^符号:类Cap位置:包com.google.android.gms.maps.model D:_reactNative \ MSB \ LocationMap \ node_modules \ react-native-maps \ lib \ android \ src \ main \ java \ com \ airbnb \ android \ react \ maps \ AirMapPolyline.java:12: 错误:找不到符号导入 com.google.android.gms.maps.model.RoundCap; ^符号:类RoundCap位置:包com.google.android.gms.maps.model D:_reactNative \ MSB \ LocationMap \ node_modules \ react-native-maps \ lib \ android \ src \ main \ java \ com \ airbnb \ android \ react \ maps \ AirMapPolyline.java:27: 错误:找不到符号私有上限lineCap = new RoundCap(); ^符号:类Cap位置:类AirMapPolyline D:_reactNative \ MSB \ LocationMap \ node_modules \ react-native-maps \ lib \ android \ src \ main \ java \ com \ airbnb \ android \ react \ maps \ AirMapPolyline.java:73 : 错误:找不到符号public void setLineCap(Cap cap){ ^符号:类盖帽位置:类AirMapPolyline D:_reactNative \ MSB \ LocationMap \ node_modules \ react-native-maps \ lib \ android \ src \ main \ java \ com \ airbnb \ android \ react \ maps \ AirMapPolylineManager.java:15: 错误:找不到符号导入 com.google.android.gms.maps.model.ButtCap; ^符号:类ButtCap位置:包com.google.android.gms.maps.model D:_reactNative \ MSB \ LocationMap \ node_modules \ react-native-maps \ lib \ android \ src \ main \ java \ com \ airbnb \ android \ react \ maps \ AirMapPolylineManager.java:16: 错误:找不到符号导入 com.google.android.gms.maps.model.Cap; ^符号:类Cap位置:包com.google.android.gms.maps.model D:_reactNative \ MSB \ LocationMap \ node_modules \ react-native-maps \ lib \ android \ src \ main \ java \ com \ airbnb \ android \ react \ maps \ AirMapPolylineManager.java:17: 错误:找不到符号导入 com.google.android.gms.maps.model.RoundCap; ^符号:类RoundCap位置:包com.google.android.gms.maps.model D:_reactNative \ MSB \ LocationMap \ node_modules \ react-native-maps \ lib \ android \ src \ main \ java \ com \ airbnb \ android \ react \ maps \ AirMapPolylineManager.java:18: 错误:找不到符号导入 com.google.android.gms.maps.model.SquareCap; ^符号:SquareCap类的位置:包com.google.android.gms.maps.model D:_reactNative \ MSB \ LocationMap \ node_modules \ react-native-maps \ lib \ android \ src \ main \ java \ com \ airbnb \ android \ react \ maps \ AirMapPolyline.java:27: 错误:找不到符号私有上限lineCap = new RoundCap(); ^符号:类RoundCap位置:类AirMapPolyline D:_reactNative \ MSB \ LocationMap \ node_modules \ react-native-maps \ lib \ android \ src \ main \ java \ com \ airbnb \ android \ react \ maps \ AirMapPolylineManager.java:77: 错误:找不到符号 Cap cap =空; ^符号:类盖帽位置:类AirMapPolylineManager D:_reactNative \ MSB \ LocationMap \ node_modules \ react-native-maps \ lib \ android \ src \ main \ java \ com \ airbnb \ android \ react \ maps \ AirMapPolylineManager.java:80 : 错误:找不到符号 cap = new ButtCap(); ^符号:类ButtCap位置:类AirMapPolylineManager D:_reactNative \ MSB \ LocationMap \ node_modules \ react-native-maps \ lib \ android \ src \ main \ java \ com \ airbnb \ android \ react \ maps \ AirMapPolylineManager.java:83: 错误:找不到符号 cap = new RoundCap(); ^符号:类RoundCap位置:类AirMapPolylineManager D:_reactNative \ MSB \ LocationMap \ node_modules \ react-native-maps \ lib \ android \ src \ main \ java \ com \ airbnb \ android \ react \ maps \ AirMapPolylineManager.java:86: 错误:找不到符号 cap = new SquareCap(); ^符号:类SquareCap位置:类AirMapPolylineManager D:_reactNative \ MSB \ LocationMap \ node_modules \ react-native-maps \ lib \ android \ src \ main \ java \ com \ airbnb \ android \ react \ maps \ AirMapPolylineManager.java:89: 错误:找不到符号 cap = new RoundCap(); ^符号:类RoundCap位置:类AirMapPolylineManager注意:某些输入文件使用或覆盖 不推荐使用的API。注意:有关详细信息,请使用-Xlint:deprecation重新编译。 注意:某些输入文件使用未经检查或不安全的操作。注意: 使用-Xlint重新编译:未经检查以获取详细信息。 14个错误
- 出了什么问题:任务':react-native-maps:compileDebugJavaWithJavac'的执行失败。
编译失败;有关详细信息,请参见编译器错误输出。
请告知如何解决此问题?
答案 0 :(得分:5)
react-native-maps
依赖项不适用于react-native version 0.57.0
。请更新到0.57.4或最新版本。