title: Android Firebase authentication not receiving SMS with SDK above 11.8.0
body: <p>I'm implementing Android app that use Firebase to authenticate my users,</p>
  
  <p>My problem is that after changing the Gradle dependency from:</p>
  
  <pre><code>implementation 'com.google.firebase:firebase-auth:11.8.0'
  </code></pre>
  
  <p>To any higher <a href="https://firebase.google.com/support/release-notes/android" rel="noreferrer">SDK version</a>, My code stop sending SMS authentication messages..</p>
  
  <p>My code:</p>
  
  <pre><code>public class AuthenticationActivity extends AppCompatActivity {
      private PhoneAuthProvider.OnVerificationStateChangedCallbacks mCallbacks;
      private EditText phoneNum;
      private PinView verifyCodeET;
      private String mVerificationId;
      private FirebaseAuth mAuth;
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_authentication);
          mAuth = FirebaseAuth.getInstance();
          Button sendCodeButton = findViewById(R.id.submit1);
          Button verifyCodeButton = findViewById(R.id.submit2);
          phoneNum = findViewById(R.id.phonenumber);
          verifyCodeET = findViewById(R.id.pinView);
          sendCodeButton.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View view) {
                  String phoneNumber = phoneNum.getText().toString();
                  PhoneAuthProvider.getInstance().verifyPhoneNumber(
                          phoneNumber, // Phone number to verify
                          60, // Timeout duration
                          TimeUnit.SECONDS, // Unit of timeout
                          AuthenticationActivity.this, // Activity (for callback binding)
                          mCallbacks); // OnVerificationStateChangedCallbacks
              }
          });
          mCallbacks = new PhoneAuthProvider.OnVerificationStateChangedCallbacks() {
              @Override
              public void onVerificationCompleted(PhoneAuthCredential phoneAuthCredential) {
                  signInWithPhoneAuthCredential(phoneAuthCredential);
              }
              @Override
              public void onVerificationFailed(FirebaseException e) {
              }
              @Override
              public void onCodeSent(String verificationId,PhoneAuthProvider.ForceResendingToken token) {
                  mVerificationId = verificationId;
              }
          };
          verifyCodeButton.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View view) {
                  String verificationCode = verifyCodeET.getText().toString();
                  boolean success = true;
                  PhoneAuthCredential credential = null;
                  try {
                      credential = PhoneAuthProvider.getCredential(mVerificationId, verificationCode);
                  } catch (Exception e) {
                      // "Something went wrong"
                      success = false;
                  }
                  if (success) {
                      signInWithPhoneAuthCredential(credential);
                  }
              }
          });
      }
      private void signInWithPhoneAuthCredential(PhoneAuthCredential credential) {
          mAuth.signInWithCredential(credential)
                  .addOnCompleteListener(this, new OnCompleteListener&lt;AuthResult&gt;() {
                      @Override
                      public void onComplete(@NonNull Task&lt;AuthResult&gt; task) {
                          if (task.isSuccessful()) {
                              // Sign in success
                          } else {
                              // "Invalid verification code"
                          }
                      }
                  });
      }
  }
  </code></pre>
  
  <p>This happens for any SDK version available between the current 16.1.0 to 12.0.0,</p>
  
  <p>Once I'm changing back to 11.8.0 everything work as expected...</p>
  
  <p>Any help will be appreciated</p>
  
  <p>.</p>
  
  <p><strong>Edit</strong></p>
  
  <p>With Nouman Ch help I've added printing at onVerificationFailed() and saw the error message:</p>
  
  <blockquote>
    <p>com.google.firebase.auth.FirebaseAuthInvalidCredentialsException: The format of the phone number provided is incorrect. Please enter the phone number in a format that can be parsed into E.164 format. E.164 phone numbers are written in the format [+][country code][subscriber number including area code]. [ Invalid format. ]</p>
  </blockquote>
  
  <p>Using the answer from <a href="https://stackoverflow.com/a/5264810/4678126">here</a></p>
  
  <p>I've added to the Gradle file:</p>
  
  <pre><code>implementation 'com.googlecode.libphonenumber:libphonenumber:7.0.4'
  implementation 'com.google.firebase:firebase-core:16.0.7'
  implementation 'com.google.firebase:firebase-auth:16.1.0'
  </code></pre>
  
  <p>To the Java includes:</p>
  
  <pre><code>import com.google.i18n.phonenumbers.Phonenumber.PhoneNumber;
  import com.google.i18n.phonenumbers.NumberParseException;
  import com.google.i18n.phonenumbers.PhoneNumberUtil;
  </code></pre>
  
  <p>And edit the onClicK() function to be:</p>
  
  <pre><code>@Override
  public void onClick(View view) {
      String phoneNumber = phoneNum.getText().toString();
      // Check phoneNumber.length()
      PhoneNumberUtil phoneUtil = PhoneNumberUtil.getInstance();
      try {
          PhoneNumber numberProto = phoneUtil.parse(phoneNumber, "US");
          PhoneAuthProvider.getInstance().verifyPhoneNumber(
                  phoneUtil.format(numberProto, PhoneNumberUtil.PhoneNumberFormat.E164), // Phone number to verify
                  60, // Timeout duration
                  TimeUnit.SECONDS, // Unit of timeout
                  AuthenticationActivity.this, // Activity (for callback binding)
                  mCallbacks); // OnVerificationStateChangedCallbacks
      } catch (NumberParseException e) {
          // Wrong format
      }
  }
  </code></pre>
  
  <p>Now everything work with the latest SDK version</p>