3
votes

I'm new to React-native.I try to add google map on my App using npm i react-native-maps --save

I refer this https://github.com/react-community/react-native-maps/blob/master/docs/installation.md and follow the all step. I get the Google API and put it to the AndroidManifest. My Google Play Services version is 14.5.74. I also add it android/app/build.gradle. Here it is

ext {
buildToolsVersion = "27.0.3"
minSdkVersion = 16
compileSdkVersion = 27
targetSdkVersion = 26
supportLibVersion = "27.1.1"
googlePlayServicesVersion = "14.5.74"
androidMapsUtilsVersion = "0.5+" }

and I used to

"dependencies": {
"@babel/runtime": "^7.1.5",
"react": "16.5.0",
"react-native": "0.57.0",
"react-native-maps": "^0.22.1" },

But I get a error

ask :react-native-maps:compileDebugJavaWithJavac FAILED D:_reactNative\MSB\LocationMap\node_modules\react-native-maps\lib\android\src\main\java\com\airbnb\android\react\maps\AirMapPolyline.java:8: error: cannot find symbol
import com.google.android.gms.maps.model.Cap; ^ symbol: class Cap location: package 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: error: cannot find 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_modules\react-native-maps\lib\android\src\main\java\com\airbnb\android\react\maps\AirMapPolyline.java:27: error: cannot find symbol private Cap lineCap = new RoundCap(); ^ symbol: class Cap location: class AirMapPolyline D:_reactNative\MSB\LocationMap\node_modules\react-native-maps\lib\android\src\main\java\com\airbnb\android\react\maps\AirMapPolyline.java:73: error: cannot find symbol public void setLineCap(Cap cap) { ^ symbol: class Cap location: class AirMapPolyline D:_reactNative\MSB\LocationMap\node_modules\react-native-maps\lib\android\src\main\java\com\airbnb\android\react\maps\AirMapPolylineManager.java:15: error: cannot find symbol import com.google.android.gms.maps.model.ButtCap; ^ symbol: class ButtCap location: package 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: error: cannot find symbol import com.google.android.gms.maps.model.Cap; ^ symbol: class Cap location: package 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: error: cannot find 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_modules\react-native-maps\lib\android\src\main\java\com\airbnb\android\react\maps\AirMapPolylineManager.java:18: error: cannot find symbol import com.google.android.gms.maps.model.SquareCap; ^ symbol: class SquareCap location: package 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: error: cannot find symbol 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\airbnb\android\react\maps\AirMapPolylineManager.java:77: error: cannot find symbol Cap cap = null; ^ symbol: class Cap location: class AirMapPolylineManager D:_reactNative\MSB\LocationMap\node_modules\react-native-maps\lib\android\src\main\java\com\airbnb\android\react\maps\AirMapPolylineManager.java:80: error: cannot find symbol cap = new ButtCap(); ^ symbol: class ButtCap location: class AirMapPolylineManager D:_reactNative\MSB\LocationMap\node_modules\react-native-maps\lib\android\src\main\java\com\airbnb\android\react\maps\AirMapPolylineManager.java:83: error: cannot find symbol cap = new RoundCap(); ^ symbol: class RoundCap location: class AirMapPolylineManager D:_reactNative\MSB\LocationMap\node_modules\react-native-maps\lib\android\src\main\java\com\airbnb\android\react\maps\AirMapPolylineManager.java:86: error: cannot find symbol cap = new SquareCap(); ^ symbol: class SquareCap location: class AirMapPolylineManager D:_reactNative\MSB\LocationMap\node_modules\react-native-maps\lib\android\src\main\java\com\airbnb\android\react\maps\AirMapPolylineManager.java:89: error: cannot find symbol cap = new RoundCap(); ^ symbol: class RoundCap location: class AirMapPolylineManager 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. 14 errors

  • What went wrong: Execution failed for task ':react-native-maps:compileDebugJavaWithJavac'.

    Compilation failed; see the compiler error output for details.

Please tell how can solve this problem?

1

1 Answers

5
votes

react-native-maps dependency is not working with react-native version 0.57.0. Please update it to 0.57.4 or latest version.