我在AndEngine GLES2中移植我的项目,使用GLES1版本我使用此tutorial在后台加载资源,现在我收到此错误:
mActivity.onCreateScene failed. @(Thread: 'GLThread 10')
java.lang.ExceptionInInitializerError
这是我的onCreateScene方法
@Override
public Scene onCreateScene() {
this.mEngine.registerUpdateHandler(new FPSLogger());
SplashScene mSplashScene = new SplashScene(this);
IAsyncCallback callback = new IAsyncCallback() {
@Override
public void workToDo() {
//Do something}
@Override
public void onComplete() {
LoadingScene mLoadingScene = new LoadingScene(mActivity.this);
mActivity.this.getEngine().setScene(mLoadingScene);
}
};
new AsyncTaskLoader().execute(callback);
return mSplashScene;
}
答案 0 :(得分:5)
更改
new AsyncTaskLoader().execute(callback);
到
//Fixed variant working with gles1 and gles2
runOnUiThread(new Runnable() {
@Override
public void run() {
new AsyncTaskLoader().execute(callback);
}
});