[TencentCloudSDKException]code: message:java.io.IOException-Canceled requestId:

问题

腾讯获取短信验证码提示
[TencentCloudSDKException]code: message:java.io.IOException-Canceled requestId:

详细问题

2022-09-04 18:19:17.549 27959-27959/com.example.electronicmall W/System.err: [TencentCloudSDKException]code:  message:java.io.IOException-Canceled requestId:
2022-09-04 18:19:17.549 27959-27959/com.example.electronicmall W/System.err:     at com.example.electronicmall.common.http.HttpConnection.doRequest(HttpConnection.java:62)
2022-09-04 18:19:17.549 27959-27959/com.example.electronicmall W/System.err:     at com.example.electronicmall.common.http.HttpConnection.postRequest(HttpConnection.java:99)
2022-09-04 18:19:17.549 27959-27959/com.example.electronicmall W/System.err:     at com.example.electronicmall.common.AbstractClient.doRequest(AbstractClient.java:412)
2022-09-04 18:19:17.549 27959-27959/com.example.electronicmall W/System.err:     at com.example.electronicmall.common.AbstractClient.internalRequest(AbstractClient.java:356)
2022-09-04 18:19:17.549 27959-27959/com.example.electronicmall W/System.err:     at com.example.electronicmall.sms.v20210111.SmsClient.SendSms(SmsClient.java:403)
2022-09-04 18:19:17.549 27959-27959/com.example.electronicmall W/System.err:     at com.example.electronicmall.Util.SendSms.main(SendSms.java:118)
2022-09-04 18:19:17.549 27959-27959/com.example.electronicmall W/System.err:     at com.example.electronicmall.test.User.UserCompleteValidationActivity$2.onClick(UserCompleteValidationActivity.java:52)
2022-09-04 18:19:17.549 27959-27959/com.example.electronicmall W/System.err:     at android.view.View.performClick(View.java:7317)
2022-09-04 18:19:17.549 27959-27959/com.example.electronicmall W/System.err:     at android.view.View.performClickInternal(View.java:7291)
2022-09-04 18:19:17.549 27959-27959/com.example.electronicmall W/System.err:     at android.view.View.access$3600(View.java:838)
2022-09-04 18:19:17.549 27959-27959/com.example.electronicmall W/System.err:     at android.view.View$PerformClick.run(View.java:28247)
2022-09-04 18:19:17.550 27959-27959/com.example.electronicmall W/System.err:     at android.os.Handler.handleCallback(Handler.java:900)
2022-09-04 18:19:17.550 27959-27959/com.example.electronicmall W/System.err:     at android.os.Handler.dispatchMessage(Handler.java:103)
2022-09-04 18:19:17.550 27959-27959/com.example.electronicmall W/System.err:     at android.os.Looper.loop(Looper.java:219)
2022-09-04 18:19:17.550 27959-27959/com.example.electronicmall W/System.err:     at android.app.ActivityThread.main(ActivityThread.java:8668)
2022-09-04 18:19:17.550 27959-27959/com.example.electronicmall W/System.err:     at java.lang.reflect.Method.invoke(Native Method)
2022-09-04 18:19:17.550 27959-27959/com.example.electronicmall W/System.err:     at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:513)
2022-09-04 18:19:17.550 27959-27959/com.example.electronicmall W/System.err:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1109)
2022-09-04 18:19:17.550 27959-27959/com.example.electronicmall I/System.out: SendSmsnum0244
2022-09-04 18:19:36.158 27959-27959/com.example.electronicmall I/HwViewRootImpl: removeInvalidNode all the node in jank list is out of time
2022-09-04 18:19:45.940 27959-27959/com.example.electronicmall W/InputMethodManager: startInputReason = 8
2022-09-04 18:19:45.942 27959-27959/com.example.electronicmall W/HwRemoteInputMethodManager: isCasting false because IHwDistributedWindowManager is invalid.
2022-09-04 18:19:45.974 27959-27959/com.example.electronicmall W/IInputConnectionWrapper: getTextBeforeCursor on inactive InputConnection
2022-09-04 18:19:45.978 27959-27959/com.example.electronicmall W/IInputConnectionWrapper: getTextBeforeCursor on inactive InputConnection
2022-09-04 18:19:46.016 27959-27959/com.example.electronicmall W/IInputConnectionWrapper: getTextBeforeCursor on inactive InputConnection
2022-09-04 18:19:46.224 27959-27959/com.example.electronicmall E/RtgSchedManager: endActivityTransaction: margin state not match
2022-09-04 18:19:46.230 27959-27959/com.example.electronicmall E/RtgSchedManager: endActivityTransaction: margin state not match
2022-09-04 18:19:46.257 27959-27959/com.example.electronicmall E/RtgSchedManager: endActivityTransaction: margin state not match
2022-09-04 18:19:46.274 27959-27989/com.example.electronicmall D/ZrHung.AppEyeUiProbe: not watching, wait.
2022-09-04 18:19:46.537 27959-27959/com.example.electronicmall I/ActivityThread: Handle window ActivityRecord{51c7ff2 token=android.os.BinderProxy@ce46ae2 {com.example.electronicmall/com.example.electronicmall.test.User.UserCompleteValidationActivity}} visibility: false
2022-09-04 18:19:46.539 27959-27959/com.example.electronicmall E/RtgSchedManager: endActivityTransaction: margin state not match
2022-09-04 18:19:46.539 27959-27959/com.example.electronicmall D/DecorView: showOrHideHighlightView: hasFocus=false; winMode=1; isMrgNull=true
2022-09-04 18:19:46.541 27959-27959/com.example.electronicmall W/HwRemoteInputMethodManager: isCasting false because IHwDistributedWindowManager is invalid.
2022-09-04 18:19:46.797 27959-27959/com.example.electronicmall I/RmeSchedManager: init Rme, version is: v1.0
2022-09-04 18:19:51.232 27959-27959/com.example.electronicmall I/AwareBitmapCacher: handleReleaseCache: pid=27959
2022-09-04 18:19:51.233 27959-27959/com.example.electronicmall I/AwareBitmapCacher: init lrucache size: 2097152 pid=27959
2022-09-04 18:19:51.328 27959-27975/com.example.electronicmall W/System: A resource failed to call close. 
2022-09-04 18:19:51.331 27959-27975/com.example.electronicmall W/System: A resource failed to call close.

解决

sendSms.main()

改为

new Thread(new Runnable() {
    @Override
    public void run() {
        SendSms.main(strs);
    }
}).start();

请添加图片描述

原因

错误message:java.io.IOException-Canceled requestId:表示IO请求过程中受阻, 由于TencentCloudSDK (占用主进程)的网络请求未完成,而观察者(抢占主进程, 抢占成功, 取消TencentCloudSDK相关任务)已经取消了TencentCloudSDKIO流监听,就会报出这个异常。因此, 需要另外开辟一个进程, 进行短信发送(TencentCloudSDK)服务, 避免进程间冲突。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

飞滕人生TYF

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值