当前位置: 首页 > 知识库问答 >
问题:

React本机映射错误编译debugJavaWithJavac

傅自明
2023-03-14

我刚开始使用React-Native。我尝试使用npm i React-Native-Maps--Save在我的应用程序中添加google map

我参考了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”,
“React”:“16.5.0”,
“React-Native”:“0.57.0”,
“React-Native-Maps”:“^0.22.1”},

但我有个错误

问:react-native-maps:compiledebugjavawithjavac失败d:_reactnative\msb\locationmap\node_modules\react-native-Maps\lib\android\src\main\Java\com\爱彼迎\android\react\maps\airmappolyline.Java:8:错误:找不到符号
import com.google.android.gms.maps.model.cap;^symbol:class Cap location:package com.google.android.gms.maps.model D:_reactnative\msb\locationmap\node_module\react-native-Maps\lib\android\src\main\Java\com\爱彼迎\android\react\maps\airmappolyline.Java:12:错误:找不到symbol import com.google.android.gms.maps.model.roundcap;^symbol:class RoundCap location:package.com.google.android.gms.maps.model d:_reactnative\msb\locationmap\node_module\react-native-Maps\lib\android\src\main\Java\com\爱彼迎\android\react\maps\airmappolyline.Java:27错误:找不到symbol private Cap lineCap=new RoundCap();^symbol:class Cap location:class AirMapPolyline d:_reactNative\MSB\LocationMap\node_module\react-native-Maps\lib\android\src\main\Java\com\爱彼迎\android\react\maps\node_module\react-native-Maps\lib\android\src\main\Java\com\爱彼迎\android\react\maps\AirMapPolyline.Java:73:错误:找不到符号public void setLineCap.Cap{roid\react\maps\airmappolylineManager.java:17:错误:找不到符号import com.google.android.gms.maps.model.roundcap;^symbol:类RoundCap位置:包com.google.android.gms.maps.model D:_reactnative\msb\locationmap\node_module\react-native-Maps\lib\android\src\main\Java\com\爱彼迎\android\react\maps\airmapolylineManager.Java:18:错误:找不到符号import com.google.android.gms.maps.squarecap;^symbol:class SquareCap location:package com.google.android.gms.maps.model d:_reactnative\msb\locationmap\node_module\react-native-Maps\lib\android\src\main\Java\com\爱彼迎\android\react\maps\airmappolyline.Java:27:错误:找不到符号private Cap lineCap=new RoundCap();^symbol:class RoundCap location:class AirMapPolyline d:_reactNative\msb\locationmap\node_modules\react-native-Maps\lib\android\src\main\Java\com\爱彼迎\android\react\maps\AirMapPolylineManager.Java:77:错误:找不到符号Cap Cap=null;^symbol:class Cap location:class AirMapPolylineManager d:_reactnative\msb\locationmap\node_modules\react-native-Maps\lib\android\src\main\Java\com\爱彼迎\android\react\maps\AirMapPolylineManager.Java:80:错误:找不到symbolcap=new ButtCap();^symbol:class ButtCap location:class AirMapPolylineManager d:_reactnative\msb\locationmap\node_modules\react-native-Maps\lib\android\src\main\Java\com\爱彼迎\android\react\maps\AirMapPolylineManager.Java:83:错误:找不到symbolcap=new RoundCap();^symbol:class RoundCap location:class AirMapPolylineManager d:_reactNative\msb\locationmap\node_modules\react-native-Maps\lib\android\src\main\Java\com\爱彼迎\android\react\maps\AirMapPolylineManager.Java:86:错误:找不到symbolcap=new SquareCap();^symbol:class SquareCap location:class AirMapPolylineManager d:_reactNative\msb\locationmap\node_modules\react-native-Maps\lib\android\src\main\Java\com\爱彼迎\android\react\maps\AirMapPolylineManager.Java:89:错误:找不到symbolcap=new RoundCap();^Symbol:class RoundCap location:class AirMapPolylineManager注意:某些输入文件使用或重写不推荐使用的API。注意:有关详细信息,请使用-xlint:deprecation重新编译。注意:有些输入文件使用未经检查或不安全的操作。注意:有关详细信息,请使用-xlint:unchecked重新编译。14个错误

>

  • 错误:任务“:React-Native-Maps:CompileDebugJavaWithJavac”执行失败。

    编译失败;有关详细信息,请参阅编译器错误输出。

    请说说怎样才能解决这个问题?

  • 共有1个答案

    李胡媚
    2023-03-14

    React-Native-Maps依赖项不适用React-Native version 0.57.0。请将其更新到0.57.4或最新版本。

     类似资料: