调用userRegister时总提示网络错误

标签: #<Tag:0x00007f65823deb38>

在uni-app里使用IM的 SDK调用userRegister时总返回这个error:

{“errorMsg”:“Request failed.please check your network connection.”,“errorCode”:871102} at App.vue:70

userLogin正常,获取message list好像也是正常的。

App Key:e9cfd3c024418bf53d30fd08

Channel:HBuilderX

在之前已经call过init方法,SDK版本2.9.0

1、先在 AndroidManifest 里面配置一下进程,可以尝试去掉多进程服务
2、确保JMessageClient.init必须在manifest中声明的Application类中调用
3、切换下别的网络试一下。

我们是uni-app,所以只有manifest, 这里面也有多进程的设置吗

有call init,然后有print出来version

jpushIM.init();

     jpushIM.getVersion((string) => {
         uni.showModal({
             title: '当前IM版本信息',
             content: string,
             showCancel: false,
             cancelText: '',
             confirmText: '确定',
         });
     });

有切换到4G网络,还是不行

android:process

这个是配置进程的,你看下

我们并没有配置process。

{
"name" : "My Surro 宝宝营",
"appid" : "__UNI__98FED55",
"description" : "My Surro",
"versionName" : "1.0.16",
"versionCode" : 16,
"transformPx" : false,
/* 5+App特有相关 */
"app-plus" : {
    "usingComponents" : true,
    /* 模块配置 */
    "modules" : {
        "Push" : {},
        "VideoPlayer" : {}
    },
    /* 应用发布信息 */
    "distribute" : {
        /* android打包配置 */
        "android" : {
            "permissions" : [
                "<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
                "<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
                "<uses-permission android:name=\"android.permission.READ_CONTACTS\"/>",
                "<uses-permission android:name=\"android.permission.VIBRATE\"/>",
                "<uses-permission android:name=\"android.permission.READ_LOGS\"/>",
                "<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>",
                "<uses-feature android:name=\"android.hardware.camera.autofocus\"/>",
                "<uses-permission android:name=\"android.permission.WRITE_CONTACTS\"/>",
                "<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>",
                "<uses-permission android:name=\"android.permission.CAMERA\"/>",
                "<uses-permission android:name=\"android.permission.RECORD_AUDIO\"/>",
                "<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>",
                "<uses-permission android:name=\"android.permission.MODIFY_AUDIO_SETTINGS\"/>",
                "<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>",
                "<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>",
                "<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
                "<uses-permission android:name=\"android.permission.CALL_PHONE\"/>",
                "<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
                "<uses-permission android:name=\"android.permission.ACCESS_COARSE_LOCATION\"/>",
                "<uses-feature android:name=\"android.hardware.camera\"/>",
                "<uses-permission android:name=\"android.permission.ACCESS_FINE_LOCATION\"/>",
                "<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
            ],
            "abiFilters" : [ "armeabi-v7a", "arm64-v8a", "x86" ],
            "minSdkVersion" : 24,
            "targetSdkVersion" : 28
        },
        /* ios打包配置 */
        "ios" : {},
        /* SDK配置 */
        "sdkConfigs" : {
            "push" : {
                "unipush" : {}
            }
        },
        "splashscreen" : {
            "android" : {
                "hdpi" : "unpackage/res/start_images/Android/480_762/Onboarding.png",
                "xhdpi" : "unpackage/res/start_images/Android/720_1242/Onboarding.png",
                "xxhdpi" : "unpackage/res/start_images/Android/1080_1882/Onboarding.png"
            },
            "ios" : {
                "iphone" : {
                    "portrait-896h@3x" : "unpackage/res/start_images/ios/1242_2688/Onboarding.png",
                    "iphonex" : "unpackage/res/start_images/ios/1125_2436/Onboarding.png",
                    "retina55" : "unpackage/res/start_images/ios/1242_2208/Onboarding.png",
                    "retina47" : "unpackage/res/start_images/ios/750_1334/Onboarding.png",
                    "portrait-896h@2x" : "unpackage/res/start_images/ios/828_1792/Onboarding.png"
                }
            }
        },
        // "android" : {
        //     "hdpi" : "C:/Users/Administrator/Desktop/宝宝营/启动页面/Android/480_762/Onboarding.png",
        //     "xhdpi" : "C:/Users/Administrator/Desktop/宝宝营/启动页面/Android/720_1242/Onboarding.png",
        //     "xxhdpi" : "C:/Users/Administrator/Desktop/宝宝营/启动页面/Android/1080_1882/Onboarding.png"
        // },
        // "ios" : {
        //     "iphone" : {
        //         "iphonex" : "C:/Users/Administrator/Desktop/宝宝营/启动页面/ios/1125_2436/Onboarding.png",
        //         "retina55" : "C:/Users/Administrator/Desktop/宝宝营/启动页面/ios/1242_2208/Onboarding.png",
        //         "portrait-896h@3x" : "C:/Users/Administrator/Desktop/宝宝营/启动页面/ios/1242_2688/iPhone XS Max(1242px_2688px).png",
        //         "retina47" : "C:/Users/Administrator/Desktop/宝宝营/启动页面/ios/750_1334/Onboarding.png"
        //     }
        // }
        "icons" : {
            "android" : {
                "hdpi" : "unpackage/res/icons/72x72.png",
                "xhdpi" : "unpackage/res/icons/96x96.png",
                "xxhdpi" : "unpackage/res/icons/144x144.png",
                "xxxhdpi" : "unpackage/res/icons/192x192.png"
            },
            "ios" : {
                "appstore" : "unpackage/res/icons/1024x1024.png",
                "ipad" : {
                    "app" : "unpackage/res/icons/76x76.png",
                    "app@2x" : "unpackage/res/icons/152x152.png",
                    "notification" : "unpackage/res/icons/20x20.png",
                    "notification@2x" : "unpackage/res/icons/40x40.png",
                    "proapp@2x" : "unpackage/res/icons/167x167.png",
                    "settings" : "unpackage/res/icons/29x29.png",
                    "settings@2x" : "unpackage/res/icons/58x58.png",
                    "spotlight" : "unpackage/res/icons/40x40.png",
                    "spotlight@2x" : "unpackage/res/icons/80x80.png"
                },
                "iphone" : {
                    "app@2x" : "unpackage/res/icons/120x120.png",
                    "app@3x" : "unpackage/res/icons/180x180.png",
                    "notification@2x" : "unpackage/res/icons/40x40.png",
                    "notification@3x" : "unpackage/res/icons/60x60.png",
                    "settings@2x" : "unpackage/res/icons/58x58.png",
                    "settings@3x" : "unpackage/res/icons/87x87.png",
                    "spotlight@2x" : "unpackage/res/icons/80x80.png",
                    "spotlight@3x" : "unpackage/res/icons/120x120.png"
                }
            }
        }
    },
    "splashscreen" : {
        "waiting" : true,
        "alwaysShowBeforeRender" : true
    },
    "nativePlugins" : {
        "YOYO-JPushIM" : {
            "channel" : "",
            "app_key" : "e9cfd3c024418bf53d30fd08",
            "__plugin_info__" : {
                "name" : "极光IM原生SDK整合 - Android/iOS",
                "description" : "即时通讯聊天",
                "platforms" : "Android,iOS",
                "url" : "https://ext.dcloud.net.cn/plugin?id=886",
                "android_package_name" : "io.dcloud.mysurro",
                "ios_bundle_id" : "io.dcloud.mysurro",
                "isCloud" : true,
                "bought" : 1,
                "pid" : "886",
                "parameters" : {
                    "channel" : {
                        "des" : "渠道,如:any channel",
                        "key" : "YOYO-JPushIM:channel",
                        "value" : ""
                    },
                    "app_key" : {
                        "des" : "极光IM的key",
                        "key" : "YOYO-JPushIM:app_key",
                        "value" : ""
                    }
                }
            }
        }
    }
},
/* 快应用特有相关 */
"quickapp" : {},
/* 小程序特有相关 *///    "mp-weixin" : {
//        "appid" : "wxd28c1e653a98fe11",
//        "setting" : {
//            "urlCheck" : false
//        },
//        "usingComponents" : true
//    },
"mp-alipay" : {
    "usingComponents" : false
},
"mp-baidu" : {
    "usingComponents" : true
},
"mp-toutiao" : {
    "usingComponents" : true
},
"h5" : {
    "title" : "My Surro",
    "domain" : "api.mysurro.com",
    "router" : {
        "mode" : "hash",
        "base" : "/"
    }
}

}

image
回调一直进不来,其他的方法 login ,logout,getUserInfo 等 都是正常的

你这里发的信息里面我没有看到有关于极光 Android 要求的 AndroidManifest 的配置,所以你们是怎么集成的?

<!--极光IM-->
<permission
    android:name="${applicationId}.permission.JPUSH_MESSAGE"
    android:protectionLevel="signature"/>
<!-- Required -->
<!--JPUSH_MESSAGE 官方定义的权限,允许应用接收JPUSH内部代码发送的广播消息。-->
<uses-permission android:name="${applicationId}.permission.JPUSH_MESSAGE" />
<!--RECEIVE_USER_PRESENT 允许应用可以接收点亮屏幕或解锁广播。-->
<uses-permission android:name="android.permission.RECEIVE_USER_PRESENT" />
<!--INTERNET允许应用可以访问网络。-->
<uses-permission android:name="android.permission.INTERNET" />
<!--WAKE_LOCK 允许应用在手机屏幕关闭后后台进程仍然运行-->
<uses-permission android:name="android.permission.WAKE_LOCK" />
<!--READ_PHONE_STATE允许应用访问手机状态-->
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<!--WRITE_EXTERNAL_STORAGE允许应用写入外部存储-->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<!--READ_EXTERNAL_STORAGE允许应用读取外部存储-->
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<!--VIBRATE允许应用震动-->
<uses-permission android:name="android.permission.VIBRATE" />
<!--ACCESS_NETWORK_STATE允许应用获取网络信息状态,如当前的网络连接是否有效-->
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<!--极光IM权限配置 end-->

<application
    android:label="@string/app_name">
    <!-- Required SDK 核心功能-->
    <!-- 如果JCore使用的是2.0.0及以上版本可移除本配置 -->
    <service
        android:name="cn.jpush.android.service.PushService"
        android:enabled="true"
        android:exported="false">
        <intent-filter>
            <action android:name="cn.jpush.android.intent.REGISTER" />
            <action android:name="cn.jpush.android.intent.REPORT" />
            <action android:name="cn.jpush.android.intent.PushService" />
            <action android:name="cn.jpush.android.intent.PUSH_TIME" />
        </intent-filter>
    </service>

    <!-- Since JCore2.0.0 Required SDK核心功能-->
    <!-- 这个Service要继承JCommonService -->
    <!-- 可配置android:process参数将PushService放在其他进程中 -->
    <service android:name="uni.dcloud.io.uniplugin_jpushim.PushService"
        android:process=":pushcore">
        <intent-filter>
            <action android:name="cn.jiguang.user.service.action" />
        </intent-filter>
    </service>

    <!-- Required SDK核心功能-->
    <receiver
        android:name="cn.jpush.android.service.PushReceiver"
        android:enabled="true"
        android:exported="false">
        <intent-filter android:priority="1000">
            <action android:name="cn.jpush.android.intent.NOTIFICATION_RECEIVED_PROXY" />
            <category android:name="${applicationId}" />
        </intent-filter>
        <intent-filter>
            <action android:name="android.intent.action.USER_PRESENT" />
            <action android:name="android.net.conn.CONNECTIVITY_CHANGE" />
        </intent-filter>
        <!-- Optional -->
        <intent-filter>
            <action android:name="android.intent.action.PACKAGE_ADDED" />
            <action android:name="android.intent.action.PACKAGE_REMOVED" />

            <data android:scheme="package" />
        </intent-filter>
    </receiver>

    <!-- Required SDK核心功能-->
    <receiver
        android:name="cn.jpush.android.service.AlarmReceiver"
        android:exported="false" />

    <!-- Required since JCore 1.1.7. SDK 核心功能-->
    <provider
        android:name="cn.jpush.android.service.DataProvider"
        android:authorities="${applicationId}.DataProvider"
        android:exported="false" />

    <!-- Required since JMessage 2.7.0 SDK 核心功能-->
    <provider
        android:name="cn.jpush.im.android.helpers.ipc.IMProvider"
        android:authorities="${applicationId}.IMProvider"
        android:exported="false" />

    <!-- Required JMessage SDK核心功能-->
    <receiver
        android:name="cn.jpush.im.android.helpers.IMReceiver"
        android:enabled="true"
        android:exported="false">
    </receiver>

    <!-- since JCore 1.8.0 option 可选项。用于同一设备中不同应用的 jiguang 服务相互拉起的功能。 -->
    <!-- 若不启用该功能可删除该组件,或把 enabled 设置成 false ;拉起服务被关闭,App 不会通过拉起服务拉起其他的 App,也不会被其他 App 拉起。 -->
    <service
        android:name="cn.jpush.android.service.DaemonService"
        android:enabled="true"
        android:exported="true">
        <intent-filter >
            <action android:name="cn.jpush.android.intent.DaemonService" />
            <category android:name="${applicationId}"/>
        </intent-filter>
    </service>
</application>

以上是AndroidManifest 的配置

这个配置,要么都去掉,要么将manifest的DataProvider配置与PushService进程保持一致后再进行测试验证

{“errorMsg”:“Network not available,please check your network connection.”,“errorCode”:871310} 报这个错

1、请你根据我上面的说明处理下android:process=

2、给出详细的客户端log信息

我们用离线安卓SDK试了一下,还是不行。具体来说是北美这边不行,同样的code,国内是可以的。

而且只有注册不行,会卡住,北美登陆登功能是可以的。

试着删掉了android:process=这一行设置,或者不删,北美都不行,请看截图和log

    11-30 01:42:55.472 11127-11359/io.dcloud.UNIE9BF158 D/JIGUANG-JMessage: [RequestingThread] Action - sendRequestInternal - connection:, timeout:60000, threadId:542
11-30 01:42:55.473 11127-11359/io.dcloud.UNIE9BF158 D/JIGUANG-JMessage: [RequestingThread] Action - sendCommand
    [RequestingThread] request is [Requesting] - timeout:50000, times:1, request:cn.jmessage.biz.j.a@8d09144
    [RequestingThread] Request params - cmd:100
11-30 01:42:55.687 11127-11184/io.dcloud.UNIE9BF158 D/JIGUANG-JMessage: [b] processIMData type : im_response
11-30 01:42:55.688 11127-11184/io.dcloud.UNIE9BF158 D/JIGUANG-JMessage: [ResponseProcessor] IMCMD:39
11-30 01:42:55.872 11127-11184/io.dcloud.UNIE9BF158 D/JIGUANG-JMessage: [b] processIMData type : im_response
11-30 01:42:55.876 11127-11184/io.dcloud.UNIE9BF158 D/JIGUANG-JMessage: [ResponseProcessor] IMCMD:40
11-30 01:42:55.880 11127-11184/io.dcloud.UNIE9BF158 D/JIGUANG-JMessage: [SyncRespBaseHandler] sync resp received , uid = 379837060
11-30 01:42:55.880 11127-11184/io.dcloud.UNIE9BF158 I/JIGUANG-JMessage: [SyncRespBaseHandler] [PageReceived] receive page . page no = 1 page = cn.jmessage.biz.j.a.f$m@3e77db0
    [SyncRespBaseHandler] [PageReceived] cached page no[1]
11-30 01:42:55.881 11127-11184/io.dcloud.UNIE9BF158 D/JIGUANG-JMessage: [SyncRespBaseHandler] [PageReceived]start convLocalize conv pages. total page 1
11-30 01:43:01.983 11127-11127/io.dcloud.UNIE9BF158 E/Html5Plus-SplashClosed: 1575106981983
11-30 01:43:01.983 11127-11127/io.dcloud.UNIE9BF158 E/Main_Path: closeSplashScreen0 appid=__UNI__E9BF158;true;closeSplashDid=true
11-30 01:43:10.955 11127-11127/io.dcloud.UNIE9BF158 E/shutao: new -- JSNWindow=_www/__uniappview.html
11-30 01:43:11.409 11127-11127/io.dcloud.UNIE9BF158 I/AssistStructure: Flattened final assist data: 5324 bytes, containing 1 windows, 19 views
11-30 01:43:15.844 11127-11199/io.dcloud.UNIE9BF158 D/EGL_emulation: eglMakeCurrent: 0xec585600: ver 3 0 (tinfo 0xec583a30)
11-30 01:43:15.884 11127-11199/io.dcloud.UNIE9BF158 D/EGL_emulation: eglMakeCurrent: 0xec585600: ver 3 0 (tinfo 0xec583a30)
11-30 01:43:15.945 11127-11199/io.dcloud.UNIE9BF158 I/chatty: uid=10087(io.dcloud.UNIE9BF158) RenderThread identical 2 lines
11-30 01:43:15.958 11127-11199/io.dcloud.UNIE9BF158 D/EGL_emulation: eglMakeCurrent: 0xec585600: ver 3 0 (tinfo 0xec583a30)

请使用这两个 debug 版本替换工程里面的资源,在北美复测下你们这个问题
然后不对日志做任何筛选,将所有的 log 放在 TXT 文件发来。
image
jcore-android-2.2.4-debug-b60.zip (431.1 KB)
jmessage-sdk-android-2.9.0-b995-debug.zip (6.4 MB)