0

私はアンドロイドが初めてです。場所の詳細を取得しようとしていました。マニフェスト ファイルでは、適切なアクセス許可 (Access_Fine_Location) を使用しました。

それでもアプリを実行すると、クライアントには細かい位置情報のアクセス許可が必要であるというエラーが表示されます。

私のマニフェストファイル:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="androidfactory.rageshkr.com.iamsafe" >

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

        <activity
            android:name=".MainActivity"
            android:label="@string/app_name" >

            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>

Logcat ログ:

06-21 23:24:50.969  13542-13542/? I/MainActivity﹕ Location Service Connected
06-21 23:24:50.975  13542-13542/? E/AndroidRuntime﹕ FATAL EXCEPTION: main
    Process: androidfactory.rageshkr.com.iamsafe, PID: 13542
    java.lang.SecurityException: Client must have ACCESS_FINE_LOCATION permission to request PRIORITY_HIGH_ACCURACY locations.
            at android.os.Parcel.readException(Parcel.java:1465)
            at android.os.Parcel.readException(Parcel.java:1419)
            at com.google.android.gms.internal.ni$a$a.a(Unknown Source)
            at com.google.android.gms.internal.nj.a(Unknown Source)
            at com.google.android.gms.internal.nk.a(Unknown Source)
            at com.google.android.gms.internal.nf$1.a(Unknown Source)
            at com.google.android.gms.internal.nf$1.a(Unknown Source)
            at com.google.android.gms.common.api.BaseImplementation$a.b(Unknown Source)
            at com.google.android.gms.common.api.c.a(Unknown Source)
            at com.google.android.gms.common.api.c.b(Unknown Source)
            at com.google.android.gms.internal.nf.requestLocationUpdates(Unknown Source)
            at androidfactory.rageshkr.com.iamsafe.MainActivity.onConnected(MainActivity.java:93)
            at com.google.android.gms.internal.jm.f(Unknown Source)
            at com.google.android.gms.common.api.c.gJ(Unknown Source)
            at com.google.android.gms.common.api.c.d(Unknown Source)
            at com.google.android.gms.common.api.c$2.onConnected(Unknown Source)
            at com.google.android.gms.internal.jm.f(Unknown Source)
            at com.google.android.gms.internal.jm.dU(Unknown Source)
            at com.google.android.gms.internal.jl$h.b(Unknown Source)
            at com.google.android.gms.internal.jl$h.g(Unknown Source)
            at com.google.android.gms.internal.jl$b.hy(Unknown Source)
            at com.google.android.gms.internal.jl$a.handleMessage(Unknown Source)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:136)
            at android.app.ActivityThread.main(ActivityThread.java:5086)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:515)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
            at dalvik.system.NativeStart.main(Native Method)
4

2 に答える 2

9

はタグの<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />外側にある必要があります。<application>

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="androidfactory.rageshkr.com.iamsafe" >

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

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >

        <activity
            android:name=".MainActivity"
            android:label="@string/app_name" >

            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>
于 2015-06-21T18:06:09.170 に答える