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

[TencentCloudSDKException]code: message:java.io.IOException-Canceled requestId:_第1张图片

原因

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

你可能感兴趣的:(android项目开发,java,android,android,studio)