title: Sending an SMS with SmsManager keeps crashing
body: <p>I am attempting to create a button to send an SMS to a specific number. However, even though Android Studio has no issue with it, the app crashes on both the emulator and a physical device when the button is pressed. </p>
  
  <p>The error does not make sense, given that the AndroidManifest.xml gives the correct permissions.</p>
  
  <p>Any ideas? Thanks in advance.</p>
  
  <p><strong>MainActivity.java</strong></p>
  
  <pre><code>package saluta.salutapanicandreporter;
  
  import android.support.v7.app.AppCompatActivity;
  import android.os.Bundle;
  import android.telephony.SmsManager;
  import android.view.View;
  import android.widget.Button;
  
  public class MainActivity extends AppCompatActivity {
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
  
          Button panicButton = (Button) findViewById(R.id.panicButton);
  
          panicButton.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                  SmsManager smsManager = SmsManager.getDefault();
                  smsManager.sendTextMessage("111-111-111", null, "RED ALERT. Reply SAFE when safe", null, null);
              }
          });
      }
  }
  </code></pre>
  
  <p><strong>AndroidManifest.xml</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="saluta.salutapanicandreporter"&gt;
  
      &lt;uses-permission android:name="android.permission.SEND_SMS" /&gt;
      &lt;uses-permission android:name="android.permission.READ_SMS" /&gt;
      &lt;uses-permission android:name="android.permission.RECEIVE_SMS" /&gt;
      &lt;application
          android:allowBackup="true"
          android:icon="@mipmap/ic_launcher"
          android:label="@string/app_name"
          android:roundIcon="@mipmap/ic_launcher_round"
          android:supportsRtl="true"
          android:theme="@style/AppTheme"&gt;
          &lt;activity android:name=".MainActivity"&gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="android.intent.action.MAIN" /&gt;
  
                  &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
              &lt;/intent-filter&gt;
          &lt;/activity&gt;
  
          &lt;receiver android:name=".IncomingSms"&gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="android.provider.Telephony.SMS_RECEIVED" /&gt;
              &lt;/intent-filter&gt;
          &lt;/receiver&gt;
  
      &lt;/application&gt;
  
  &lt;/manifest&gt;
  </code></pre>
  
  <p><strong>Error</strong></p>
  
  <pre><code>08-10 17:52:55.723 2436-2436/saluta.salutapanicandreporter E/AndroidRuntime: FATAL EXCEPTION: main
                                                                               Process: saluta.salutapanicandreporter, PID: 2436
                                                                               java.lang.SecurityException: Sending SMS message: uid 10079 does not have android.permission.SEND_SMS.
                                                                                   at android.os.Parcel.readException(Parcel.java:1683)
                                                                                   at android.os.Parcel.readException(Parcel.java:1636)
                                                                                   at com.android.internal.telephony.ISms$Stub$Proxy.sendTextForSubscriber(ISms.java:768)
                                                                                   at android.telephony.SmsManager.sendTextMessageInternal(SmsManager.java:310)
                                                                                   at android.telephony.SmsManager.sendTextMessage(SmsManager.java:293)
                                                                                   at saluta.salutapanicandreporter.MainActivity.sendSMS(MainActivity.java:16)
                                                                                   at saluta.salutapanicandreporter.MainActivity.access$000(MainActivity.java:11)
                                                                                   at saluta.salutapanicandreporter.MainActivity$1.onClick(MainActivity.java:31)
                                                                                   at android.view.View.performClick(View.java:5610)
                                                                                   at android.view.View$PerformClick.run(View.java:22265)
                                                                                   at android.os.Handler.handleCallback(Handler.java:751)
                                                                                   at android.os.Handler.dispatchMessage(Handler.java:95)
                                                                                   at android.os.Looper.loop(Looper.java:154)
                                                                                   at android.app.ActivityThread.main(ActivityThread.java:6077)
                                                                                   at java.lang.reflect.Method.invoke(Native Method)
                                                                                   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866)
                                                                                   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:756)
  </code></pre>