2015-08-27 23 views
-1

我已經添加了訪問phone_state的權限,但我仍然得到這個異常「引發:java.lang.SecurityException:需要READ_PHONE_STATE:用戶10052或當前進程都沒有android.permission.READ_PHONE_STATE 「。android.permission.read_phone_state不起作用

  <?xml version="1.0" encoding="utf-8"?> 
      <manifestxmlns:android="http://schemas.android.com/apk/res/android" 
      package="com.example.goh2.pronoornotepad" > 
      <uses-permission android:name="android.permission.read_phone_state" /> 
      <uses-permission android:name="android.permission.INTERNET" /> 
      <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/> 
<application 

    android:allowBackup="true" 
    android:icon="@drawable/pronoorpng" 
    android:label="@string/app_name" 
    android:theme="@android:style/Theme.Light" > 
    <activity 
     android:name=".Login" 
     android:label="@string/app_name" > 
     <intent-filter> 
      <action android:name="android.intent.action.MAIN" /> 

      <category android:name="android.intent.category.LAUNCHER" /> 
     </intent-filter> 
    </activity> 
    <activity 
     android:theme="@style/Theme.AppCompat.Light.NoActionBar" 
     android:name=".MainScreen" 
     android:label="@string/title_activity_main_screen" > 
    </activity> 


</application> 

回答

0

你必須這樣聲明的權限:

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

的而不是

<uses-permission android:name="android.permission.read_phone_state" /> 
+0

它的工作......非常感謝你們對我的幫助:) –