有没有大哥可以帮忙看一下,从cocos2.4.3中原生构建出来的代码,但是江工程导入到android studio中就不能运行了,构建报错
sdk-api | gradle | android-gradle-plugin | ndk | jdk |
28 | 4.10.3 | 3.2.0 | 18 | 1.8 |
报错的代码就是这一段代码,就是不能构建成功,在本地运行也不行,本地都没有办法启动,这段代码还是cocos构建导出的工程代码
private void addDebugInfo(Cocos2dxRenderer renderer) {
LinearLayout.LayoutParams linearLayoutParam = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT,
LinearLayout.LayoutParams.WRAP_CONTENT);
linearLayoutParam.setMargins(30, 0, 0, 0);
Cocos2dxHelper.setOnGameInfoUpdatedListener(new Cocos2dxHelper.OnGameInfoUpdatedListener() {
@Override
public void onFPSUpdated(float fps) {
Cocos2dxActivity.this.runOnUiThread(new Runnable() {
@Override
public void run() {
if (mFPSTextView != null) {
mFPSTextView.setText("FPS:" + (int)Math.ceil(fps));
}
}
});
}
@Override
public void onJSBInvocationCountUpdated(int count) {
Cocos2dxActivity.this.runOnUiThread(new Runnable() {
@Override
public void run() {
if (mJSBInvocationTextView != null) {
mJSBInvocationTextView.setText("JSB: " + count);
}
}
});
}
@Override
public void onOpenDebugView() {
Cocos2dxActivity.this.runOnUiThread(new Runnable() {
@Override
public void run() {
if (mLinearLayoutForDebugView != null || mFrameLayout == null) {
Log.e(TAG, "onOpenDebugView: failed!");
return;
}
mLinearLayoutForDebugView = new LinearLayout(Cocos2dxActivity.this);
mLinearLayoutForDebugView.setOrientation(LinearLayout.VERTICAL);
mFrameLayout.addView(mLinearLayoutForDebugView);
mFPSTextView = new TextView(Cocos2dxActivity.this);
mFPSTextView.setBackgroundColor(Color.RED);
mFPSTextView.setTextColor(Color.WHITE);
mLinearLayoutForDebugView.addView(mFPSTextView, linearLayoutParam);
mJSBInvocationTextView = new TextView(Cocos2dxActivity.this);
mJSBInvocationTextView.setBackgroundColor(Color.GREEN);
mJSBInvocationTextView.setTextColor(Color.WHITE);
mLinearLayoutForDebugView.addView(mJSBInvocationTextView, linearLayoutParam);
mGLOptModeTextView = new TextView(Cocos2dxActivity.this);
mGLOptModeTextView.setBackgroundColor(Color.BLUE);
mGLOptModeTextView.setTextColor(Color.WHITE);
mGLOptModeTextView.setText("GL Opt: Enabled");
mLinearLayoutForDebugView.addView(mGLOptModeTextView, linearLayoutParam);
mGameInfoTextView_0 = new TextView(Cocos2dxActivity.this);
mGameInfoTextView_0.setBackgroundColor(Color.RED);
mGameInfoTextView_0.setTextColor(Color.WHITE);
mLinearLayoutForDebugView.addView(mGameInfoTextView_0, linearLayoutParam);
mGameInfoTextView_1 = new TextView(Cocos2dxActivity.this);
mGameInfoTextView_1.setBackgroundColor(Color.GREEN);
mGameInfoTextView_1.setTextColor(Color.WHITE);
mLinearLayoutForDebugView.addView(mGameInfoTextView_1, linearLayoutParam);
mGameInfoTextView_2 = new TextView(Cocos2dxActivity.this);
mGameInfoTextView_2.setBackgroundColor(Color.BLUE);
mGameInfoTextView_2.setTextColor(Color.WHITE);
mLinearLayoutForDebugView.addView(mGameInfoTextView_2, linearLayoutParam);
}
});
renderer.showFPS();
}
@Override
public void onDisableBatchGLCommandsToNative() {
Cocos2dxActivity.this.runOnUiThread(new Runnable() {
@Override
public void run() {
if (mGLOptModeTextView != null) {
mGLOptModeTextView.setText("GL Opt: Disabled");
}
}
});
}
@Override
public void onGameInfoUpdated_0(final String text) {
Cocos2dxActivity.this.runOnUiThread(new Runnable() {
@Override
public void run() {
if (mGameInfoTextView_0 != null) {
mGameInfoTextView_0.setText(text);
}
}
});
}
@Override
public void onGameInfoUpdated_1(String text) {
Cocos2dxActivity.this.runOnUiThread(new Runnable() {
@Override
public void run() {
if (mGameInfoTextView_1 != null) {
mGameInfoTextView_1.setText(text);
}
}
});
}
@Override
public void onGameInfoUpdated_2(String text) {
Cocos2dxActivity.this.runOnUiThread(new Runnable() {
@Override
public void run() {
if (mGameInfoTextView_2 != null) {
mGameInfoTextView_2.setText(text);
}
}
});
}
});
}
本地运行还多一个报错
有谁可以帮忙解决一下,顺便接一下sdk,有偿,谢谢大哥们