weboscket在安卓7.0下闪退

creator版本:1.4.0
NDK版本:r13b
手机:华为mate8 android7.0
发布examples项目的调试版本apk,装上之后闪退,日志如下,麻烦看下是什么问题:

02-26 11:11:08.072 26899-26921/? D/cocos2d-x debug info: Success to load scene: db://assets/cases/05_scripting/11_network/network.fire
02-26 11:11:08.074 1029-1146/? D/InputDispatcher: Dispatch frozen.  Waiting some more. last for 1006ms
02-26 11:11:08.075 26899-26921/? D/cocos2d-x debug info: Please set label text key in Text Key property.
02-26 11:11:08.075 26899-26921/? D/cocos2d-x debug info: Please set label text key in Text Key property.
02-26 11:11:08.075 1029-1053/? I/WindowManager: ignore hidden app list for com.tencent.news/com.tencent.news.push.alive.offactivity.OffActivity
02-26 11:11:08.075 26899-26921/? D/cocos2d-x debug info: Please set label text key in Text Key property.
02-26 11:11:08.075 26899-26921/? D/cocos2d-x debug info: Please set label text key in Text Key property.
02-26 11:11:08.075 26899-26921/? D/cocos2d-x: In the constructor of HttpClient!
02-26 11:11:08.075 26899-26921/? D/cocos2d-x debug info: Please set label text key in Text Key property.
02-26 11:11:08.076 26899-26921/? D/cocos2d-x debug info: Please set label text key in Text Key property.
02-26 11:11:08.076 26899-26921/? D/WebSocket.cpp: [WebSocket::init] _host: echo.websocket.org, _port: 80, _path: /
02-26 11:11:08.077 26899-26957/? D/WebSocket.cpp: WebSocket thread start, helper instance: 0xc9fc7eb8
02-26 11:11:08.077 26899-26957/? D/libwebsockets: NOTICE: Initial logging level 967
02-26 11:11:08.077 26899-26957/? D/libwebsockets: NOTICE: Libwebsockets version: 1.7.8 linwenhai@LindeMacBook-Pro.local-v3.4-49-g9369eea
02-26 11:11:08.077 26899-26957/? D/libwebsockets: NOTICE: IPV6 compiled in and enabled
02-26 11:11:08.077 26899-26957/? D/libwebsockets: NOTICE: libev support not compiled in
02-26 11:11:08.078 1440-1440/? V/PhoneStatusBar: setLightsOn(true)
02-26 11:11:08.078 1029-1146/? D/InputDispatcher: Dispatch frozen.  Waiting some more. last for 1010ms
                                                  
                                                  --------- beginning of crash
02-26 11:11:08.078 26899-26957/? A/libc: Fatal signal 11 (SIGSEGV), code 2, fault addr 0xc76cfff4 in tid 26957 (GLThread 23988)
02-26 11:11:08.078 1029-1053/? I/WindowManager: ignore hidden app list for com.tencent.news/com.tencent.news.push.alive.offactivity.OffActivity
                                                
                                                [ 02-26 11:11:08.079   422:  422 W/         ]
                                                debuggerd: handling request: pid=26899 uid=10619 gid=10619 tid=26957
02-26 11:11:08.079 1440-1440/? V/PhoneStatusBar: setLightsOn(true)
02-26 11:11:08.080 26899-26921/? D/cocos2d-x: JSB SocketIO.connect method called
02-26 11:11:08.080 26899-26921/? D/cocos2d-x: Calling native SocketIO.connect method
02-26 11:11:08.080 26899-26921/? D/cocos2d-x: JSB SocketIO.on method called
02-26 11:11:08.081 26899-26921/? D/cocos2d-x: JSB SocketIO eventName to: 'connect'
02-26 11:11:08.081 26899-26921/? D/cocos2d-x: JSB SocketIO.on method called
02-26 11:11:08.081 26899-26921/? D/cocos2d-x: JSB SocketIO eventName to: 'message'
02-26 11:11:08.081 26899-26921/? D/cocos2d-x: JSB SocketIO.on method called
02-26 11:11:08.081 26899-26921/? D/cocos2d-x: JSB SocketIO eventName to: 'echotest'
02-26 11:11:08.081 26899-26921/? D/cocos2d-x: JSB SocketIO.on method called
02-26 11:11:08.081 26899-26921/? D/cocos2d-x: JSB SocketIO eventName to: 'testevent'
02-26 11:11:08.081 26899-26921/? D/cocos2d-x: JSB SocketIO.on method called
02-26 11:11:08.081 26899-26921/? D/cocos2d-x: JSB SocketIO eventName to: 'disconnect'



02-26 11:11:08.154 26959-26959/? A/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
02-26 11:11:08.154 26959-26959/? A/DEBUG: Build fingerprint: 'HUAWEI/NXT-AL10/HWNXT:7.0/HUAWEINXT-AL10/C00B575:user/release-keys'
02-26 11:11:08.154 26959-26959/? A/DEBUG: Revision: '0'
02-26 11:11:08.154 26959-26959/? A/DEBUG: ABI: 'arm'
02-26 11:11:08.155 26959-26959/? A/DEBUG: pid: 26899, tid: 26957, name: GLThread 23988  >>> org.cocos2d.examplecases <<<
02-26 11:11:08.155 26959-26959/? A/DEBUG: signal 11 (SIGSEGV), code 2 (SEGV_ACCERR), fault addr 0xc76cfff4
02-26 11:11:08.155 26959-26959/? A/DEBUG:     r0 0000000d  r1 ccd06dbd  r2 cc05a0c9  r3 cc05a0c9
02-26 11:11:08.155 26959-26959/? A/DEBUG:     r4 cd4ee9c4  r5 c77cd7e8  r6 c77cd920  r7 c76d0000
02-26 11:11:08.155 26959-26959/? A/DEBUG:     r8 c9e76788  r9 c9e6dc4c  sl cd18e62d  fp c77cd89c
02-26 11:11:08.155 26959-26959/? A/DEBUG:     ip 00ff0000  sp c76d0000  lr cc05a125  pc cc05a0c8  cpsr a00b0030
02-26 11:11:08.176 447-479/? I/gralloc: alloc_device_free:586: Free handle(0x7beae0f500)
02-26 11:11:08.176 447-479/? I/gralloc: alloc_device_free:586: Free handle(0x7beae0f600)
02-26 11:11:08.176 447-479/? I/gralloc: alloc_device_free:586: Free handle(0x7beae0fe00)
02-26 11:11:08.177 26959-26959/? A/DEBUG: backtrace:
02-26 11:11:08.177 26959-26959/? A/DEBUG:     #00 pc 0092b0c8  /data/app/org.cocos2d.examplecases-1/lib/arm/libcocos2djs.so
02-26 11:11:08.177 26959-26959/? A/DEBUG:     #01 pc 0092b123  /data/app/org.cocos2d.examplecases-1/lib/arm/libcocos2djs.so (bsd_signal+90)
02-26 11:11:08.177 26959-26959/? A/DEBUG:     #02 pc 0092b123  /data/app/org.cocos2d.examplecases-1/lib/arm/libcocos2djs.so (bsd_signal+90)
02-26 11:11:08.177 26959-26959/? A/DEBUG:     #03 pc 0092b123  /data/app/org.cocos2d.examplecases-1/lib/arm/libcocos2djs.so (bsd_signal+90)
02-26 11:11:08.177 26959-26959/? A/DEBUG:     #04 pc 0092b123  /data/app/org.cocos2d.examplecases-1/lib/arm/libcocos2djs.so (bsd_signal+90)
02-26 11:11:08.177 26959-26959/? A/DEBUG:     #05 pc 0092b123  /data/app/org.cocos2d.examplecases-1/lib/arm/libcocos2djs.so (bsd_signal+90)
02-26 11:11:08.177 26959-26959/? A/DEBUG:     #06 pc 0092b123  /data/app/org.cocos2d.examplecases-1/lib/arm/libcocos2djs.so (bsd_signal+90)
02-26 11:11:08.177 26959-26959/? A/DEBUG:     #07 pc 0092b123  /data/app/org.cocos2d.examplecases-1/lib/arm/libcocos2djs.so (bsd_signal+90)
02-26 11:11:08.177 26959-26959/? A/DEBUG:     #08 pc 0092b123  /data/app/org.cocos2d.examplecases-1/lib/arm/libcocos2djs.so (bsd_signal+90)

我也出现了这问题 兄弟 你怎么解决的?

试试1.5版本的creator,看看是否还有问题。1.5版本有更新libwebsockets第三方库。

@dumganhar 大神你好 我遇到的问题是 ws 连接时 断开网络 例如直接关闭wifi 或者 4G 等. ws 不会发生onclose. 点击发送数据也没有反应,也不报错.
请问该如何处理这样的情况,心跳计数都不工作!! 好无奈啊

请问楼主解决这个问题了吗?
我的升级到creator1.7也出现这个问题了,用weboscket就报错
在creator1.5.2上都是正常的
手机:小米6,android7.1.1
但是另外一台手机android5.1能正常使用
@dumganhar 开发组的大大能帮忙看下吗

日志:
01-02 17:28:09.086 8250-8556/com.qbkj.pb D/WebSocket.cpp: WebSocket thread start, helper instance: 0xcbd550c0
01-02 17:28:09.086 8250-8556/com.qbkj.pb D/WebSocket.cpp: NOTICE: Initial logging level 911
01-02 17:28:09.086 8250-8556/com.qbkj.pb D/WebSocket.cpp: NOTICE: Libwebsockets version: 2.1.0 james@James-Chen.local-v3.4-139-gbdcf7f8
01-02 17:28:09.086 8250-8556/com.qbkj.pb D/WebSocket.cpp: NOTICE: IPV6 compiled in and enabled
01-02 17:28:09.087 8250-8556/com.qbkj.pb D/WebSocket.cpp: NOTICE: libev support not compiled in
01-02 17:28:09.087 8250-8556/com.qbkj.pb D/WebSocket.cpp: NOTICE: libuv support not compiled in
01-02 17:28:09.087 8250-8556/com.qbkj.pb A/libc: Fatal signal 11 (SIGSEGV), code 2, fault addr 0xc5e02ffc in tid 8556 (GLThread 5386)
[ 01-02 17:28:09.088 627: 627 W/ ]
debuggerd: handling request: pid=8250 uid=10638 gid=10638 tid=8556

试试,改一下API level,看看。

改成多少呢?

试试改为26看看。

不行再改为16看看。

在不行,你可以手动改一下
build.gradle 中的 compileSDkVersion, minSDkVersion, targetSdkVersion
建议 compileSDKVersion 和 targetSdkVersion 都为 26,minSdkVersion 为14
然后重新编译看看。

构建的时候选不到26,是不是哪里可以设置?
我现在选的16,构建完,编译的时候报错了,日志如下:
FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ‘:libcocos2dx:verifyReleaseResources’.

java.util.concurrent.ExecutionException: java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --debug option to get more log output.

删除 引擎目录的 cocos/platform/android/libcocos2dx/build目录再重新编译看看。

build.gradle 里面 arguments ‘APP_PLATFORM=android-’+PROP_TARGET_SDK_VERSION 也记得改为:
arguments ‘APP_PLATFORM=android-14’

    minSdkVersion 14
    targetSdkVersion 26

compileSdkVersion 26
buildToolsVersion ‘26.0.2’

刚才吃饭去了。。
回来试了一下,按照你说的改了一下,编译到最后的时候报错了。。

报错信息:

@dumganhar 大大麻烦再帮忙看下哇:cry:。。

已经解决啦。。用@dumganhar 大大的方法果然成功了。
刚才编译的问题我用Android Studio Clean了一下再重新构建编译就可以了。
谢谢@dumganhar 大大的帮助

1赞

build.gradle是哪个文件?我有项目的,还有引擎的,两个build.gradle