我目前正在开发一款Android游戏应用程序,差不多已经完成,但偶然发现了一些问题。直到现在,我还不需要在我的游戏中使用Google Play服务,因为我需要实现排行榜和成就。这是问题突然出现的地方。添加所需的库后,我将所有游戏活动扩展为BaseGameActivity。出现的第一个问题是关于
的调用 requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
它说我必须在添加内容之前调用requestFeature(),我认为我这样做了,因为我之后调用setContentView
。我决定通过评论上面的代码解决这个问题(更好的表达将被忽略)。之后运行应用程序后,每次都会在一段随机时间后崩溃,并给出以下错误:
08-17 13:55:43.879: I/dalvikvm(30369): Could not find method android.view.View.getDisplay, referenced from method com.google.android.gms.games.internal.PopupManager$PopupManagerHCMR1.h
08-17 13:55:43.879: W/dalvikvm(30369): VFY: unable to resolve virtual method 9019: Landroid/view/View;.getDisplay ()Landroid/view/Display;
08-17 13:55:43.879: D/dalvikvm(30369): VFY: replacing opcode 0x6e at 0x0009
08-17 13:55:43.910: W/PopupManager(30369): 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.
08-17 13:55:43.940: D/dalvikvm(30369): GC_FOR_ALLOC freed 181K, 14% free 7567K/8711K, paused 22ms, total 22ms
08-17 13:55:43.970: I/dalvikvm-heap(30369): Grow heap (frag case) to 12.105MB for 4008020-byte allocation
08-17 13:55:44.020: D/dalvikvm(30369): GC_CONCURRENT freed 1K, 10% free 11480K/12679K, paused 15ms+2ms, total 52ms
08-17 13:55:44.020: D/dalvikvm(30369): WAIT_FOR_CONCURRENT_GC blocked 7ms
08-17 13:55:44.040: D/dalvikvm(30369): GC_FOR_ALLOC freed 0K, 10% free 11480K/12679K, paused 21ms, total 21ms
08-17 13:55:44.080: I/dalvikvm-heap(30369): Grow heap (frag case) to 13.801MB for 1779572-byte allocation
08-17 13:55:44.140: D/dalvikvm(30369): GC_CONCURRENT freed 0K, 9% free 13218K/14471K, paused 7ms+3ms, total 54ms
08-17 13:55:44.140: D/dalvikvm(30369): WAIT_FOR_CONCURRENT_GC blocked 14ms
08-17 13:55:44.430: D/libEGL(30369): loaded /system/lib/egl/libGLES_rhea.so
08-17 13:55:44.640: D/BRCM_EGL(30369): eglCreateContext() config: 19 context: 0x4a087130, VC context 1, Thread 30369
08-17 13:55:44.640: D/BRCM_EGL(30369): eglCreateWindowSurface() surface: 0x4a0871a8, VC surface: 1, Thread: 30369
08-17 13:55:44.650: D/BRCM_EGL(30369): eglMakeCurrent(0x4a087130, 0x4a0871a8, 0x4a0871a8) Thread: 30369
08-17 13:55:44.680: D/OpenGLRenderer(30369): Enabling debug mode 0
08-17 13:55:44.850: D/dalvikvm(30369): GC_FOR_ALLOC freed 4730K, 38% free 9829K/15687K, paused 47ms, total 47ms
08-17 13:55:44.890: D/dalvikvm(30369): GC_FOR_ALLOC freed <1K, 34% free 10398K/15687K, paused 40ms, total 40ms
08-17 13:55:44.890: I/dalvikvm-heap(30369): Grow heap (frag case) to 12.205MB for 1213956-byte allocation
08-17 13:55:44.981: D/dalvikvm(30369): GC_CONCURRENT freed 0K, 27% free 11583K/15687K, paused 14ms+2ms, total 83ms
08-17 13:55:44.981: D/dalvikvm(30369): WAIT_FOR_CONCURRENT_GC blocked 69ms
08-17 13:55:44.981: D/dalvikvm(30369): WAIT_FOR_CONCURRENT_GC blocked 20ms
08-17 13:55:48.814: D/AndroidRuntime(30369): Shutting down VM
08-17 13:55:48.814: W/dalvikvm(30369): threadid=1: thread exiting with uncaught exception (group=0x415ae2a0)
08-17 13:55:48.864: E/AndroidRuntime(30369): FATAL EXCEPTION: main
08-17 13:55:48.864: E/AndroidRuntime(30369): java.lang.IllegalStateException: A fatal developer error has occurred. Check the logs for further information.
08-17 13:55:48.864: E/AndroidRuntime(30369): at com.google.android.gms.internal.hb$h.b(Unknown Source)
08-17 13:55:48.864: E/AndroidRuntime(30369): at com.google.android.gms.internal.hb$h.d(Unknown Source)
08-17 13:55:48.864: E/AndroidRuntime(30369): at com.google.android.gms.internal.hb$b.fv(Unknown Source)
08-17 13:55:48.864: E/AndroidRuntime(30369): at com.google.android.gms.internal.hb$a.handleMessage(Unknown Source)
08-17 13:55:48.864: E/AndroidRuntime(30369): at android.os.Handler.dispatchMessage(Handler.java:99)
08-17 13:55:48.864: E/AndroidRuntime(30369): at android.os.Looper.loop(Looper.java:137)
08-17 13:55:48.864: E/AndroidRuntime(30369): at android.app.ActivityThread.main(ActivityThread.java:4944)
08-17 13:55:48.864: E/AndroidRuntime(30369): at java.lang.reflect.Method.invokeNative(Native Method)
08-17 13:55:48.864: E/AndroidRuntime(30369): at java.lang.reflect.Method.invoke(Method.java:511)
08-17 13:55:48.864: E/AndroidRuntime(30369): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1038)
08-17 13:55:48.864: E/AndroidRuntime(30369): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805)
08-17 13:55:48.864: E/AndroidRuntime(30369): at dalvik.system.NativeStart.main(Native Method)
我在网上做了一些阅读,我认为这可能是因为我在我的应用中错误地使用了Threads。该应用程序的工作原理是here,即使用Handler,它之前不会出现问题,直到我的活动继承了BaseGameUtils。什么可能导致那里的问题。我知道这些是两个不同的问题,但两者都与同一个问题有关 - BaseGameActivity导致我的应用程序改变了它的行为。谢谢;)
答案 0 :(得分:1)
检查身份验证后生成的应用程序ID。我遇到了同样的问题,因为我错误地复制了ID。