Android应用第一次安装,点击Home键挂起再进入程序崩溃或无法交互问题的解决方案
问题描述
或许会在控制台中看到这么一段log:JS: <no filename="filename">:0:too much recursion
其实这是个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;
}
}