我的应用程序工作正常,直到我在 Android Studio 中生成一个签名的 APK,当我对签名的 Apk 进行身份验证时,它只显示一个 Toast“无法验证电话并创建帐户”。它在调试模式下运行良好。当我制作调试 APK 时,它在其中也运行良好,但在签名 APK 中却运行良好。我无法弄清楚导致此错误的原因是身份验证在仅签名的 APK 中不起作用
我的代码
public class Register2 extends AppCompatActivity {
FirebaseAuth auth;
DatabaseReference reference;
String otpCode;
String verificationId;
MaterialEditText phone, optEnter;
Button next;
CountryCodePicker countryCodePicker;
PhoneAuthCredential credential;
Boolean verificationOnProgress = false;
ProgressBar progressBar;
TextView resend;
PhoneAuthProvider.ForceResendingToken token;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_register2);
phone = findViewById(R.id.phone);
optEnter = findViewById(R.id.codeEnter);
countryCodePicker = findViewById(R.id.ccp);
next = findViewById(R.id.nextBtn);
auth = FirebaseAuth.getInstance();
progressBar = findViewById(R.id.progressBar);
resend = findViewById(R.id.resendOtpBtn);
resend.setOnClickListener(new View.OnClickListener() { …Run Code Online (Sandbox Code Playgroud)