反应原生地图折线
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了反应原生地图折线相关的知识,希望对你有一定的参考价值。
我正在尝试使用React Native在地图中绘制折线,但每当我编译我的应用程序时,它将给我跟踪。
这是痕迹
`java.lang.SecurityException: Looks like the app doesn't have the permission to access location.`
`Add the following line to your app's androidManifest.xml:`
`<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
at` `com.facebook.react.modules.location.LocationModule.throwLocationPermissionMissing(LocationModule.java:235)
at ``com.facebook.react.modules.location.LocationModule.startObserving(LocationModule.java:174)`
`at java.lang.reflect.Method.invoke(Native Method)
at ``com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:372)
at ``com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:158)
at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)`
`at android.os.Handler.handleCallback(Handler.java:794)`
`at android.os.Handler.dispatchMessage(Handler.java:99)
at ``com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:29)`
`at android.os.Looper.loop(Looper.java:176)
at ``com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:192)`
`at java.lang.Thread.run(Thread.java:764)`
`Caused by: java.lang.SecurityException: "gps" location provider requires ACCESS_FINE_LOCATION permission.`
`at android.os.Parcel.readException(Parcel.java:2013)`
`at android.os.Parcel.readException(Parcel.java:1959)`
at ``android.location.ILocationManager$Stub$Proxy.requestLocationUpdates(ILocationManager.java:691)
at ``android.location.LocationManager.requestLocationUpdates(LocationManager.java:900)
at ``android.location.LocationManager.requestLocationUpdates(LocationManager.java:471)
at ``com.facebook.react.modules.location.LocationModule.startObserving(LocationModule.java:166)`
... 10 more
答案
添加AndroidManifest.xml
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<application>
{...}
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="Add Your Google API" />
</application>
以上是关于反应原生地图折线的主要内容,如果未能解决你的问题,请参考以下文章