你或许会看到很多行这样的log
...
Cocos js error:(3822): <no filename=“filename”> line:0 msg:too much recursion
Cocos js error:(3822): <no filename=“filename”> line:0 msg:too much recursion
Cocos js error:(3822): <no filename=“filename”> line:0 msg:too much recursion
...
你在心中大骂Creator垃圾
其实这是个android系统的bug。。。
有很多android应用(没有对这个问题处理过的)第一次安装进入程序也会有这个问题
下面给出解决方案:
打开你的android-studio工程,在Cocos2dxActivety里的onCreate方法里的super.onCreate(saveInstanceState);的下面加上如下代码:
if(!this.isTaskRoot()) {
Intent mainIntent=getIntent();
String action=mainIntent.getAction();
if(mainIntent.hasCategory(Intent.CATEGORY_LAUNCHER) && action.equals(Intent.ACTION_MAIN)) {
finish();
return;
}
}
参考下图
如果你也报了很多
Cocos js error:(3822): <no filename=“filename”> line:0
的错误,但又不是这个问题,我猜你很有可能是微信登录分享那里出了问题,你是不是没有在gl 线程里执行Cocos2dxJavascriptJavaBridge的回调方法?
Cocos2dxGLSurfaceView.getInstance().queueEvent(new Runnable() {
@Override
public void run() {
Cocos2dxJavascriptJavaBridge.evalString("cc.log(\"potato47\")");
}
});