我的应用程序是无法打开OpenFeint的仪表板的方法。 本地C ++库的实现使用了cocos2d-x作为一个图形库,但它有一个处理器和一个包装允许使用OpenFeint的功能。 OpenFeint的初始化和非活性的方法正常工作。
当UI仪表板的功能,例如openLaderBoards或openAchievements要么从JNI调用或在Java的onCreate初始化,应用程序崩溃调用。
编辑:我已经测试和它发生任何变化的活动我试试,连我自己的新类。
EDIT2:我有一个类似的问题+100赏金,谁的答案上来得到它。
码
活动:
public class App extends Cocos2dxActivity{
private Cocos2dxGLSurfaceView mGLView;
OpenFeintX m_kOpenFeintX;
protected void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
// get the packageName,it's used to set the resource path
String packageName = getApplication().getPackageName();
super.setPackageName(packageName);
InternetConnection.setM_kActivity(this);
m_kOpenFeintX = new OpenFeintX( this);
setContentView(R.layout.applayout);
mGLView = (Cocos2dxGLSurfaceView) findViewById(R.id.game_gl_surfaceview);
mGLView.setTextField((EditText)findViewById(R.id.textField));
// Testspace for new Activities, OpenFeint or self-made
//
// Intent myIntent = new Intent(this, TestActivity.class);
// startActivityForResult(myIntent, 0);
// Dashboard.open();
// Cocos2d-x scene opens after this
}
static {
System.loadLibrary("TestProject");
// Native library loaded for cocos2d-x
}
包装:
public class OpenFeintX {
private static OpenFeintXHandler ms_kOpenFeintHandler;
public OpenFeintX(Activity kActivity) {
initializeOpenFeint("TestApp", "derp",
"hurr", "6546516516541",
kActivity, ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
ms_kOpenFeintHandler = new OpenFeintXHandler();
}
public static void openLeaderBoards() {
Message msg = new Message();
msg.what = OpenFeintXHandler.SHOW_LEADERBOARDS;
ms_kOpenFeintHandler.sendMessage(msg);
}
处理器openDashboard功能:
private void openLeaderBoards() {
System.out.println("Opening Dashboard");
Dashboard.openLeaderboards();
}
表现:
<application
android:debuggable="true"
android:label="@string/app_name">
<activity
android:configChanges="orientation"
android:label="@string/app_name"
android:name=".App"
android:screenOrientation="portrait"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >
<intent-filter >
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.openfeint.internal.ui.IntroFlow"
android:label=".IntroFlow"
android:configChanges="orientation|keyboardHidden"
android:theme="@style/OFNestedWindow" />
<activity android:name="com.openfeint.api.ui.Dashboard"
android:label=".Dashboard"
android:configChanges="orientation|keyboardHidden"
android:theme="@style/OFNestedWindow"/>
<activity android:name="com.openfeint.internal.ui.Settings"
android:label=".Settings"
android:configChanges="orientation|keyboardHidden"
android:theme="@style/OFNestedWindow"/>
<activity android:name="com.openfeint.internal.ui.NativeBrowser"
android:label=".NativeBrowser"
android:configChanges="orientation|keyboardHidden"
android:theme="@style/OFNestedWindow"/>
</application>
堆栈跟踪(不会缩进SO):
http://pastebin.com/jsmSbgw4