1

.I have simple map applicaiton.First simply my map is working.then i allow to develop my application i got Force close.When i run my application i got following error:

08-14 20:57:26.855: E/AndroidRuntime(207): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.mapss/com.example.mapss.MainActivity}: java.lang.SecurityException: Requires ACCESS_FINE_LOCATION permission
08-14 20:57:26.855: E/AndroidRuntime(207):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2401)
08-14 20:57:26.855: E/AndroidRuntime(207):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2417)
08-14 20:57:26.855: E/AndroidRuntime(207):  at android.app.ActivityThread.access$2100(ActivityThread.java:116)
08-14 20:57:26.855: E/AndroidRuntime(207):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1794)
08-14 20:57:26.855: E/AndroidRuntime(207):  at android.os.Handler.dispatchMessage(Handler.java:99)
08-14 20:57:26.855: E/AndroidRuntime(207):  at android.os.Looper.loop(Looper.java:123)
08-14 20:57:26.855: E/AndroidRuntime(207):  at android.app.ActivityThread.main(ActivityThread.java:4203)
08-14 20:57:26.855: E/AndroidRuntime(207):  at java.lang.reflect.Method.invokeNative(Native Method)
08-14 20:57:26.855: E/AndroidRuntime(207):  at java.lang.reflect.Method.invoke(Method.java:521)
08-14 20:57:26.855: E/AndroidRuntime(207):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791)
08-14 20:57:26.855: E/AndroidRuntime(207):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:549)
08-14 20:57:26.855: E/AndroidRuntime(207):  at dalvik.system.NativeStart.main(Native Method)
08-14 20:57:26.855: E/AndroidRuntime(207): Caused by: java.lang.SecurityException: Requires ACCESS_FINE_LOCATION permission
08-14 20:57:26.855: E/AndroidRuntime(207):  at android.os.Parcel.readException(Parcel.java:1218)
08-14 20:57:26.855: E/AndroidRuntime(207):  at android.os.Parcel.readException(Parcel.java:1206)
08-14 20:57:26.855: E/AndroidRuntime(207):  at android.location.ILocationManager$Stub$Proxy.getLastKnownLocation(ILocationManager.java:776)
08-14 20:57:26.855: E/AndroidRuntime(207):  at android.location.LocationManager.getLastKnownLocation(LocationManager.java:945)
08-14 20:57:26.855: E/AndroidRuntime(207):  at com.example.mapss.MainActivity.onCreate(MainActivity.java:36)
08-14 20:57:26.855: E/AndroidRuntime(207):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1123)
08-14 20:57:26.855: E/AndroidRuntime(207):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2364)
08-14 20:57:26.855: E/AndroidRuntime(207):  ... 11 more
Ram
  • 1,687
  • 3
  • 18
  • 28
  • it clearly indicate that you have to declare "ACCESS_FINE_LOCATION" uses permission in AndroidManifest.xml file – rajpara Aug 14 '12 at 15:36
  • See the documentation for permissions [here](https://developer.android.com/guide/topics/manifest/manifest-intro.html#perms) – Jan Gerlinger Aug 14 '12 at 15:38

2 Answers2

3

add this line to your AndroidManifest.xml

 <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
ColdFire
  • 6,764
  • 6
  • 35
  • 51
1

When using Maps or other types of services, you need to make sure that you add appropriate permissions to your manifest, in this case:

<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>

You will need to add permissions when you use things like the internet and calling.

BlackHatSamurai
  • 23,275
  • 22
  • 95
  • 156