gpt4 book ai didi

java - 验证后 Fabric 数字在回调中崩溃

转载 作者:太空狗 更新时间:2023-10-29 13:53:05 25 4
gpt4 key购买 nike

我添加了用于验证手机号码的 Fabric Digit 套件。手机号码验证成功,但是当我点击验证按钮时应用程序崩溃,当我重新打开应用程序时,数字 session 创建成功,我在很多应用程序中使用了数字但没有得到什么问题。可能是特定版本或者其他?

崩溃日志:

#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)

添加了更详细的日志here来自 Crashalytics

应用中实现的代码:

onCreate

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());

最佳答案

你可以试试下面的代码,

DigitsAuthButton digitsButton;
AuthCallback authcallback;
digitsButton = (DigitsAuthButton) view.findViewById(R.id.auth_button);
digitsButton.setAuthTheme(R.style.CustomDigitsTheme);
authcallback = new AuthCallback() {
@Override
public void success(DigitsSession session, String phoneNumber) {
edtMobNumber.setText(phoneNumber);
}

@Override
public void failure(DigitsException exception) {

exception.printStackTrace();

}
};
digitsButton.setCallback(authcallback);
//launching digits activity on click of edit text
edtMobNumber.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Digits.clearActiveSession();
digitsButton.performClick();
}
});

让我知道它是否适合您。

关于java - 验证后 Fabric 数字在回调中崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43353421/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com