我添加了用于验证手机号码的 Fabric Digit 套件。手机号码已成功验证,但是当我单击验证按钮时应用程序崩溃并且当我重新打开应用程序时,数字会话已成功创建,我在许多应用程序中使用了数字但没有得到问题所在。可能是特定版本或其他?
崩溃日志:
#0. Crashed: IntentService[ATTRIBUTABLE_INVITE_DOWNLOAD_WORKER]: 0 0 0x0000000000000000
at java.util.concurrent.ConcurrentHashMap.get(ConcurrentHashMap.java:772)
at java.util.concurrent.ConcurrentHashMap.containsKey(ConcurrentHashMap.java:800)
at com.digits.sdk.android.DigitsApiClientManager.getUserAuthClient(DigitsApiClientManager.java:53)
at com.digits.sdk.android.AttributableInviteDownloadService.onHandleIntent(AttributableInviteDownloadService.java:55)
at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:66)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.os.HandlerThread.run(HandlerThread.java:61)
--
Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.Object.hashCode()' on a null object reference
at java.util.concurrent.ConcurrentHashMap.get(ConcurrentHashMap.java:772)
at java.util.concurrent.ConcurrentHashMap.containsKey(ConcurrentHashMap.java:800)
at com.digits.sdk.android.DigitsApiClientManager.getUserAuthClient(DigitsApiClientManager.java:53)
at com.digits.sdk.android.AttributableInviteDownloadService.onHandleIntent(AttributableInviteDownloadService.java:55)
at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:66)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.os.HandlerThread.run(HandlerThread.java:61)
Crashalytics在此处添加了更详细的日志
在应用程序中实现的代码:
创建
authCallback = new AuthCallback() {
@Override
public void success(DigitsSession session, String phoneNumber) {
Log.d("msg", "session : " + session.toString() + " " + phoneNumber);
MOBILE_NO = phoneNumber;
storeUserData.setString(Constants.USER_MOBILE, phoneNumber);
Digits.clearActiveSession();
startActivity(new Intent(activity, RegisterActivity.class)
.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK));
}
@Override
public void failure(DigitsException error) {
error.printStackTrace();
}
};
用于验证
binding.authButton.setCallback(authCallback);
binding.authButton.setAuthTheme(R.style.CustomDigitsTheme);
AuthConfig.Builder authConfigBuilder = new AuthConfig.Builder()
.withAuthCallBack(authCallback)
.withPhoneNumber("+91");
Digits.authenticate(authConfigBuilder.build());