2016-08-26 34 views
0

我正在使用平板電腦android應用程序,但發送短信時使用smsManager。我已添加權限清單和平板電腦也有電話服務。看我的日誌貓錯誤我的應用程序崩潰lenevo瑜伽900發送短信android?

java.lang.SecurityException異常:從UID 10412 空不允許執行SEND_SMS 08-26 15:33:36.370 24856-24856/test.in.smarttab E/AndroidRuntime: 在android.os.Parcel.readException(Parcel.java:1472) 08-26 15:33:36.370 24856-24856/test.in.smarttab E/AndroidRuntime: at android.os.Parcel.readException(Parcel.java :1426) 08-26 15:33:36.370 24856-24856/test.in.smarttab E/AndroidRuntime: at com.android.internal.telephony.ISms $ Stub $ Proxy.sendText(ISms.java:485)

這是我的清單代碼

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

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

    <!-- 
     The ACCESS_COARSE/FINE_LOCATION permissions are not required to use 
     Google Maps Android API v2, but you must specify either coarse or fine 
     location permissions for the 'MyLocation' functionality. 
    --> 
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> 
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> 
    <uses-permission android:name="com.truiton.mapfragment.permission.MAPS_RECEIVE" /> 
    <uses-permission android:name="android.permission.INTERNET" /> 
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> 
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> 
    <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" /> 
    <uses-permission android:name="android.permission.READ_PHONE_STATE" /> 
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> 
    <uses-permission android:name="com.android.alarm.permission.SET_ALARM"/> 
    <uses-permission android:name="android.permission.SEND_SMS"/> 

    <application 
     android:allowBackup="true" 
     android:icon="@mipmap/ic_launcher" 
     android:label="@string/app_name" 
     android:largeHeap="true" 
     android:supportsRtl="true" 
     android:theme="@style/Theme.AppCompat.Light.NoActionBar.FullScreen"> 
     <receiver 
      android:name=".BootUpReceiver" 
      android:enabled="true" 
      android:permission="android.permission.RECEIVE_BOOT_COMPLETED"> 
      <intent-filter> 
       <action android:name="android.intent.action.BOOT_COMPLETED" /> 

       <category android:name="android.intent.category.DEFAULT" /> 
      </intent-filter> 
     </receiver> 
     <receiver android:name=".AlarmReceiver"/> 
     <service android:name=".Service.AlarmService"/> 
     <service android:name=".location.LocationService" /> 
     <activity 
      android:name=".welcomeScreen.WelcomeActivity" 
      android:screenOrientation="portrait"> 
      <intent-filter> 
       <action android:name="android.intent.action.MAIN" /> 

       <category android:name="android.intent.category.LAUNCHER" /> 
      </intent-filter> 
     </activity> 
     <!-- 
      The API key for Google Maps-based APIs is defined as a string resource. 
      (See the file "res/values/google_maps_api.xml"). 
      Note that the API key is linked to the encryption key used to sign the APK. 
      You need a different API key for each encryption key, including the release key that is used to 
      sign the APK for publishing. 
      You can define the keys for the debug and release targets in src/debug/ and src/release/. 
     --> 
     <meta-data 
      android:name="com.google.android.geo.API_KEY" 
      android:value="@string/google_maps_key" /> 

    </application> 

</manifest> 
+0

你確定你在清單中的正確的地方的權限?它必須超出''標記。 –

+0

是的,它在應用程序之外。我有許多權限,這些工作正常。我的平板電腦上的 –

+0

默認的短信應用程序已安裝,它正在工作。 –

回答

0

添加權限在manifest文件發送短信

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

我已將此權限添加到清單中。 –