プロジェクトにはこのコードだけがあり、この説明に従うだけです。https://developers.google.com/games/services/android/initにアクセスしてください
プロジェクトを作成し、ライブラリ「google-play-services_lib」と「BaseGameUtiles」を追加します
「extends Activity」を「BaseGameActivity」に変更し、いくつかのコードを追加します。
ビルドして実行します...アプリがクラッシュしますJava.lang.illegal
どうすればこれを修正できますか?
public class MainActivity extends BaseGameActivity implements View.OnClickListener{
Button btnLogin;
ImageView profilePic;
TextView profileName;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
btnLogin = (Button)findViewById(R.id.btn_login);
profilePic = (ImageView)findViewById(R.id.img_userprofile);
profileName = (TextView)findViewById(R.id.txt_user_name);
btnLogin.setOnClickListener(this);
}
@Override
public void onSignInFailed() {
profileName.setText("LOGIN FAILED");
}
@Override
public void onSignInSucceeded() {
profileName.setText("LOGIN SUCCESS");
}
@Override
public void onClick(View v) {
switch(v.getId())
{
case R.id.btn_login:
beginUserInitiatedSignIn();
break;
}
}
}
エラーログ:
09-15 11:06:09.420: I/dalvikvm(1753): Could not find method android.view.View.getDisplay, referenced from method com.google.android.gms.internal.bv$b.b
09-15 11:06:09.420: W/dalvikvm(1753): VFY: unable to resolve virtual method 3183: Landroid/view/View;.getDisplay ()Landroid/view/Display;
09-15 11:06:09.420: D/dalvikvm(1753): VFY: replacing opcode 0x6e at 0x0009
09-15 11:06:09.505: W/PopupManager(1753): You have not specified a View to use as content view for popups. Falling back to the Activity content view which may not work properly in future versions of the API. Use setViewForPopups() to set your content view.
09-15 11:06:09.635: D/libEGL(1753): loaded /system/lib/egl/libEGL_mali.so
09-15 11:06:09.650: D/libEGL(1753): loaded /system/lib/egl/libGLESv1_CM_mali.so
09-15 11:06:09.655: D/libEGL(1753): loaded /system/lib/egl/libGLESv2_mali.so
09-15 11:06:09.660: D/(1753): Device driver API match
09-15 11:06:09.660: D/(1753): Device driver API version: 10
09-15 11:06:09.660: D/(1753): User space API version: 10
09-15 11:06:09.660: D/(1753): mali: REVISION=Linux-r2p4-02rel0 BUILD_DATE=Fri Oct 12 13:25:41 KST 2012
09-15 11:06:09.710: D/OpenGLRenderer(1753): Enabling debug mode 0
09-15 11:06:10.080: D/AndroidRuntime(1753): Shutting down VM
09-15 11:06:10.080: W/dalvikvm(1753): threadid=1: thread exiting with uncaught exception (group=0x418412a0)
09-15 11:06:10.095: E/AndroidRuntime(1753): FATAL EXCEPTION: main
09-15 11:06:10.095: E/AndroidRuntime(1753): java.lang.IllegalStateException: A fatal developer error has occurred. Check the logs for further information.
09-15 11:06:10.095: E/AndroidRuntime(1753): at com.google.android.gms.internal.u$f.a(Unknown Source)
09-15 11:06:10.095: E/AndroidRuntime(1753): at com.google.android.gms.internal.u$f.a(Unknown Source)
09-15 11:06:10.095: E/AndroidRuntime(1753): at com.google.android.gms.internal.u$b.A(Unknown Source)
09-15 11:06:10.095: E/AndroidRuntime(1753): at com.google.android.gms.internal.u$a.handleMessage(Unknown Source)
09-15 11:06:10.095: E/AndroidRuntime(1753): at android.os.Handler.dispatchMessage(Handler.java:99)
09-15 11:06:10.095: E/AndroidRuntime(1753): at android.os.Looper.loop(Looper.java:137)
09-15 11:06:10.095: E/AndroidRuntime(1753): at android.app.ActivityThread.main(ActivityThread.java:4946)
09-15 11:06:10.095: E/AndroidRuntime(1753): at java.lang.reflect.Method.invokeNative(Native Method)
09-15 11:06:10.095: E/AndroidRuntime(1753): at java.lang.reflect.Method.invoke(Method.java:511)
09-15 11:06:10.095: E/AndroidRuntime(1753): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1036)
09-15 11:06:10.095: E/AndroidRuntime(1753): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:803)
09-15 11:06:10.095: E/AndroidRuntime(1753): at dalvik.system.NativeStart.main(Native Method)