what is this error I have in using GPS API in android?
I have this error . even I have set the persmmissinos for GPS >> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
07-29 10:29:10.468: ERROR/AndroidRuntime(759): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.adhamenaya.android/com.adhamenaya.android.MapApp}: java.lang.SecurityException: Requires ACCESS_FINE_LOCATION permission
07-29 10:29:10.468: ERROR/AndroidRuntime(759): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2268)
07-29 10:29:10.468: ERROR/AndroidRuntime(759): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2284)
07-29 10:29:10.468: ERROR/AndroidRuntime(759): at android.app.ActivityThread.access$1800(ActivityThread.java:112)
07-29 10:29:10.468: ERROR/AndroidRuntime(759): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1692)
07-29 10:29:10.468: ERROR/AndroidRuntime(759): at android.os.Handler.dispatchMessage(Handler.java:99)
07-29 10:29:10.468: ERROR/AndroidRuntime(759): at android.os.Looper.loop(Looper.java:123)
07-29 10:29:10.468: ERROR/AndroidRuntime(759): at android.app.ActivityThread.main(ActivityThread.java:3948)
07-29 10:29:10.468: ERROR/AndroidRuntime(759): at java.lang.reflect.Method.invokeNative(Native Method)
07-29 10:29:10.468: ERROR/AndroidRuntime(759): at java.lang.reflect.Method.invoke(Method.java:521)
07-29 10:29:10.468: ERROR/AndroidRuntime(759): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:782)
07-29 10:29:10.468: ERROR/AndroidRuntime(759): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:540)
开发者_Go百科07-29 10:29:10.468: ERROR/AndroidRuntime(759): at dalvik.system.NativeStart.main(Native Method)
07-29 10:29:10.468: ERROR/AndroidRuntime(759): Caused by: java.lang.SecurityException: Requires ACCESS_FINE_LOCATION permission
07-29 10:29:10.468: ERROR/AndroidRuntime(759): at android.os.Parcel.readException(Parcel.java:1234)
07-29 10:29:10.468: ERROR/AndroidRuntime(759): at android.os.Parcel.readException(Parcel.java:1222)
07-29 10:29:10.468: ERROR/AndroidRuntime(759): at android.location.ILocationManager$Stub$Proxy.requestLocationUpdates(ILocationManager.java:512)
07-29 10:29:10.468: ERROR/AndroidRuntime(759): at android.location.LocationManager._requestLocationUpdates(LocationManager.java:710)
07-29 10:29:10.468: ERROR/AndroidRuntime(759): at android.location.LocationManager.requestLocationUpdates(LocationManager.java:629)
07-29 10:29:10.468: ERROR/AndroidRuntime(759): at com.adhamenaya.android.MapApp.initMap(MapApp.java:37)
07-29 10:29:10.468: ERROR/AndroidRuntime(759): at com.adhamenaya.android.MapApp.onCreate(MapApp.java:25)
07-29 10:29:10.468: ERROR/AndroidRuntime(759): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1123)
07-29 10:29:10.468: ERROR/AndroidRuntime(759): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2231)
07-29 10:29:10.468: ERROR/AndroidRuntime(759): ... 11 more
Edit : this is the AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.adhamenaya.android"
android:versionCode="1"
android:versionName="1.0">
<application android:icon="@drawable/icon" android:label="@string/app_name">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<activity android:name=".MapApp"
android:label="@string/app_name"
android:theme="@android:style/Theme.NoTitleBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<uses-library android:name="com.google.android.maps" />
</application>
</manifest>
You need to put your uses-permission
tags before your application
tag in your manifest
EDIT: for a full list of tags and what order they must appear, see http://developer.android.com/guide/topics/manifest/manifest-intro.html
精彩评论