项目只有这个代码,我只是按照这个描述.
访问https://developers.google.com/games/services/android/init
制作项目并添加库’Google-play-services_lib’和’BaseGameUtiles’
将“扩展活动”更改为“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.b09-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 0x000909-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.so09-15 11:06:09.650: D/libEGL(1753): loaded /system/lib/egl/libGLESv1_CM_mali.so09-15 11:06:09.655: D/libEGL(1753): loaded /system/lib/egl/libGLESv2_mali.so09-15 11:06:09.660: D/(1753): Device driver API match09-15 11:06:09.660: D/(1753): Device driver API version: 1009-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 009-15 11:06:10.080: D/AndroIDRuntime(1753): Shutting down VM09-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: main09-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)
解决方法:
您似乎忘记在清单文件中添加APP_ID元数据.
您需要在AndroID Manifest文件的标记内准确添加以下代码:
<Meta-data androID:name="com.Google.androID.gms.games.APP_ID" androID:value="@string/app_ID" />
请确保元标记不在标记内,但标记,并在游戏控制台中使用位于游戏标题右侧的12位数字的APP_ID.
有关更多信息,请查看以下链接:
https://developers.google.com/games/services/android/quickstart#step_3_modify_your_code
以上是内存溢出为你收集整理的android – 我无法初始化Google Play游戏服务全部内容,希望文章能够帮你解决android – 我无法初始化Google Play游戏服务所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)