Question

It's my first post but I couldn't solve this one on my own or with Google searches. Any insight will be seriously considered and so very appreciated.

I am working with the LibGDX framework and My goal is to have working Achievements & Leaderboards via Google Play Game Services and Ads via AdMob.

I was able to set up functioning Achievements / Leaderboards using Theinvader360's Google Play Game Services Tutorial.

AdMob's early steps calling for a manifest entry gave an error of @integer not being available. The most current version of "google-play-services_lib" fixed this, but revealed that three Classes in BaseGameUtils were depreciated. I then grabbed the latest version of BaseGameUtils Library from the main source. (I'd include more links but I don't have high enough reputation)

What's funny with the current version was the structure was different than the last. I improvised and changed the "main" folder's title to "BaseGameUtils" before importing into Eclipse. I then moved the three classes from their "java" folder into "src". This brought up a FragmentActivity error so I created a "libs" folder and dropped in android-support-v4.jar to alleviate this.

Currently:
-BaseGameUtils has "Is Library" checked and "google-play-services_lib" Added as Reference.
-google-play-services_lib has "Is Library" checked.
-The android game project is Referencing these two Libraries.

I turned to MainActivity to convert things to up-to-date way using this source:
https://developers.google.com/games/services/android/init
and scrolling down to "Using GameHelper without BaseGameActivity"

As is, the application skips it's splash screen and shows a glimpse of the start screen before crashing. Here's the log:

04-17 02:43:28.994: D/dalvikvm(21249): Trying to load lib /data/app-lib/com.crtgames.cavebat-2/libgdx.so 0x424b0c00
04-17 02:43:29.004: D/dalvikvm(21249): Added shared lib /data/app-lib/com.crtgames.cavebat-2/libgdx.so 0x424b0c00
04-17 02:43:29.004: D/dalvikvm(21249): No JNI_OnLoad found in /data/app-lib/com.crtgames.cavebat-2/libgdx.so 0x424b0c00, skipping init
04-17 02:43:29.014: D/libEGL(21249): loaded /system/lib/egl/libEGL_adreno200.so
04-17 02:43:29.014: D/libEGL(21249): loaded /system/lib/egl/libGLESv1_CM_adreno200.so
04-17 02:43:29.014: D/libEGL(21249): loaded /system/lib/egl/libGLESv2_adreno200.so
04-17 02:43:29.024: I/Adreno200-EGL(21249): <qeglDrvAPI_eglInitialize:265>: EGL 1.4 QUALCOMM build:  (CL3544079)
04-17 02:43:29.024: I/Adreno200-EGL(21249): Build Date: 03/28/13 Thu
04-17 02:43:29.024: I/Adreno200-EGL(21249): Local Branch: adreno_20130328
04-17 02:43:29.024: I/Adreno200-EGL(21249): Remote Branch: 
04-17 02:43:29.024: I/Adreno200-EGL(21249): Local Patches: 
04-17 02:43:29.024: I/Adreno200-EGL(21249): Reconstruct Branch: 
04-17 02:43:29.094: D/dalvikvm(21249): GC_FOR_ALLOC freed 210K, 7% free 16805K/18028K, paused 19ms, total 19ms
04-17 02:43:29.104: I/dalvikvm-heap(21249): Grow heap (frag case) to 19.648MB for 2359312-byte allocation
04-17 02:43:29.134: D/dalvikvm(21249): GC_FOR_ALLOC freed <1K, 7% free 19108K/20336K, paused 24ms, total 24ms
04-17 02:43:29.144: D/dalvikvm(21249): GC_CONCURRENT freed <1K, 7% free 19111K/20336K, paused 2ms+1ms, total 14ms
04-17 02:43:29.144: D/GameHelper(21249): GameHelper: Debug log enabled.
04-17 02:43:29.144: D/GameHelper(21249): GameHelper: Setup: requested clients: 7
04-17 02:43:29.154: W/PopupManager(21249): 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.
04-17 02:43:29.154: D/GameHelper(21249): GameHelper: onStart
04-17 02:43:29.154: D/GameHelper(21249): GameHelper: Connecting client.
04-17 02:43:29.154: W/ResourceType(21249): Failure getting entry for 0x7f06000d (t=5 e=13) in package 0 (error -75)
04-17 02:43:29.154: E/GooglePlayServicesUtil(21249): The Google Play services resources were not found. Check your project configuration to ensure that the resources are included.
04-17 02:43:29.174: W/ResourceType(21249): Failure getting entry for 0x7f06000d (t=5 e=13) in package 0 (error -75)
04-17 02:43:29.174: E/GooglePlayServicesUtil(21249): The Google Play services resources were not found. Check your project configuration to ensure that the resources are included.
04-17 02:43:29.184: W/ResourceType(21249): Failure getting entry for 0x7f06000d (t=5 e=13) in package 0 (error -75)
04-17 02:43:29.184: E/GooglePlayServicesUtil(21249): The Google Play services resources were not found. Check your project configuration to ensure that the resources are included.
04-17 02:43:29.194: I/AndroidInput(21249): sensor listener setup
04-17 02:43:29.234: I/Adreno200-EGL(21249): <qeglDrvAPI_eglInitialize:265>: EGL 1.4 QUALCOMM build:  (CL3544079)
04-17 02:43:29.234: I/Adreno200-EGL(21249): Build Date: 03/28/13 Thu
04-17 02:43:29.234: I/Adreno200-EGL(21249): Local Branch: adreno_20130328
04-17 02:43:29.234: I/Adreno200-EGL(21249): Remote Branch: 
04-17 02:43:29.234: I/Adreno200-EGL(21249): Local Patches: 
04-17 02:43:29.234: I/Adreno200-EGL(21249): Reconstruct Branch: 
04-17 02:43:29.264: D/OpenGLRenderer(21249): Enabling debug mode 0
04-17 02:43:29.274: W/GL2JNIView(21249): creating OpenGL ES 2.0 context
04-17 02:43:29.284: D/AndroidRuntime(21249): Shutting down VM
04-17 02:43:29.284: W/dalvikvm(21249): threadid=1: thread exiting with uncaught exception (group=0x41355ac8)
04-17 02:43:29.284: E/AndroidRuntime(21249): FATAL EXCEPTION: main
04-17 02:43:29.284: E/AndroidRuntime(21249): java.lang.IllegalStateException: A fatal developer error has occurred. Check the logs for further information.
04-17 02:43:29.284: E/AndroidRuntime(21249):    at com.google.android.gms.internal.eh$h.b(Unknown Source)
04-17 02:43:29.284: E/AndroidRuntime(21249):    at com.google.android.gms.internal.eh$h.a(Unknown Source)
04-17 02:43:29.284: E/AndroidRuntime(21249):    at com.google.android.gms.internal.eh$b.ec(Unknown Source)
04-17 02:43:29.284: E/AndroidRuntime(21249):    at com.google.android.gms.internal.eh$a.handleMessage(Unknown Source)
04-17 02:43:29.284: E/AndroidRuntime(21249):    at android.os.Handler.dispatchMessage(Handler.java:99)
04-17 02:43:29.284: E/AndroidRuntime(21249):    at android.os.Looper.loop(Looper.java:137)
04-17 02:43:29.284: E/AndroidRuntime(21249):    at android.app.ActivityThread.main(ActivityThread.java:5293)
04-17 02:43:29.284: E/AndroidRuntime(21249):    at java.lang.reflect.Method.invokeNative(Native Method)
04-17 02:43:29.284: E/AndroidRuntime(21249):    at java.lang.reflect.Method.invoke(Method.java:511)
04-17 02:43:29.284: E/AndroidRuntime(21249):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1102)
04-17 02:43:29.284: E/AndroidRuntime(21249):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869)
04-17 02:43:29.284: E/AndroidRuntime(21249):    at dalvik.system.NativeStart.main(Native Method)
04-17 02:43:29.304: D/dalvikvm(21249): Trying to load lib /data/app-lib/com.crtgames.cavebat-2/libgdx.so 0x424b0c00
04-17 02:43:29.304: D/dalvikvm(21249): Shared lib '/data/app-lib/com.crtgames.cavebat-2/libgdx.so' already loaded in same CL 0x424b0c00
04-17 02:43:29.304: I/GL2(21249): all initialized 2
04-17 02:43:29.304: I/AndroidGraphics(21249): OGL renderer: Adreno (TM) 320
04-17 02:43:29.304: I/AndroidGraphics(21249): OGL vendor: Qualcomm
04-17 02:43:29.304: I/AndroidGraphics(21249): OGL version: OpenGL ES 2.0 V@14.0 AU@  (CL@3544079)
04-17 02:43:29.304: I/AndroidGraphics(21249): OGL extensions:                     GL_AMD_compressed_ATC_texture GL_AMD_performance_monitor GL_AMD_program_binary_Z400 GL_EXT_debug_labelGL_EXT_debug_markerGL_EXT_robustness GL_EXT_texture_format_BGRA8888 GL_EXT_texture_type_2_10_10_10_REV GL_NV_fence GL_OES_compressed_ETC1_RGB8_texture GL_OES_depth_texture GL_OES_depth24 GL_OES_EGL_image GL_OES_EGL_image_external   GL_OES_element_index_uint GL_OES_fbo_render_mipmap GL_OES_fragment_precision_high GL_OES_get_program_binary GL_OES_packed_depth_stencil GL_OES_depth_texture_cube_map GL_OES_rgb8_rgba8 GL_OES_standard_derivatives GL_OES_texture_3D GL_OES_texture_float GL_OES_texture_half_float GL_OES_texture_half_float_linear GL_OES_texture_npot GL_OES_vertex_half_float GL_OES_vertex_type_10_10_10_2 GL_OES_vertex_array_object GL_QCOM_alpha_test GL_QCOM_binning_control GL_QCOM_driver_control GL_QCOM_perfmon_global_mode GL_QCOM_extended_get GL_QCOM_extended_get2 GL_QCOM_tiled_rendering GL_QCOM_writeonly_rendering GL_EXT_sRGB GL_EXT_texture_filter_anisotropic GL_EXT_color_buffer_float    GL_EXT_color_buffer_half_float 
04-17 02:43:29.304: W/Adreno200-EGL(21249): <qeglDrvAPI_eglGetConfigAttrib:487>: EGL_BAD_ATTRIBUTE
04-17 02:43:29.304: W/Adreno200-EGL(21249): <qeglDrvAPI_eglGetConfigAttrib:487>: EGL_BAD_ATTRIBUTE
04-17 02:43:29.304: I/AndroidGraphics(21249): framebuffer: (5, 6, 5, 0)
04-17 02:43:29.304: I/AndroidGraphics(21249): depthbuffer: (16)
04-17 02:43:29.304: I/AndroidGraphics(21249): stencilbuffer: (0)
04-17 02:43:29.304: I/AndroidGraphics(21249): samples: (0)
04-17 02:43:29.304: I/AndroidGraphics(21249): coverage sampling: (false)
04-17 02:43:29.314: I/AndroidGraphics(21249): Managed meshes/app: { }
04-17 02:43:29.314: I/AndroidGraphics(21249): Managed textures/app: { }
04-17 02:43:29.314: I/AndroidGraphics(21249): Managed shaders/app: { }
04-17 02:43:29.314: I/AndroidGraphics(21249): Managed buffers/app: { }
04-17 02:43:31.026: V/MediaPlayer(21249): decode(53, 100761, 16502)
04-17 02:43:31.066: V/MediaPlayer(21249): decode(54, 117313, 10400)
04-17 02:43:31.096: V/MediaPlayer(21249): decode(55, 66517, 34194)

My MainActivity code:

public class MainActivity extends AndroidApplication implements GameHelperListener, ActionResolver  {

private static final int REQUEST_LEADERBOARD = 0;
private GameHelper gameHelper;

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    gameHelper = new GameHelper(this, GameHelper.CLIENT_ALL);

    AndroidApplicationConfiguration cfg = new AndroidApplicationConfiguration();
    cfg.useAccelerometer = false;
    cfg.useCompass = false;
    initialize(new CaveBat(this), cfg);

    gameHelper.enableDebugLog(true);

    GameHelperListener listener = new GameHelper.GameHelperListener() {
        @Override
        public void onSignInSucceeded() {
            // handle sign-in succeess
        }
        @Override
        public void onSignInFailed() {
            // handle sign-in failure (e.g. show Sign In button)
        }
    };
    gameHelper.setup(listener);
}

@Override
public void onStart(){
    super.onStart();
    gameHelper.onStart(this);
}

@Override
public void onStop(){
    super.onStop();
    gameHelper.onStop();
}

@Override
public void onActivityResult(int request, int response, Intent data) {
    super.onActivityResult(request, response, data);
    gameHelper.onActivityResult(request, response, data);
}

@Override
public boolean getSignedInGPGS() {
    return gameHelper.isSignedIn();
}

@Override
public void loginGPGS() {
    try {
        runOnUiThread(new Runnable(){
            public void run() {
                gameHelper.beginUserInitiatedSignIn();
            }
        });
    } catch (final Exception ex) {
    }
}

@Override
public void submitScoreGPGS_Classic(int score) {
}

@Override
public void unlockAchievementGPGS(String achievementId) {
}

@Override
public void getLeaderboardGPGS_Classic() {
    startActivityForResult(Games.Leaderboards.getLeaderboardIntent(
    gameHelper.getApiClient(), "CgkIio298M4HEAIQAA"), REQUEST_LEADERBOARD);
}

@Override
public void getAchievementsGPGS() {
}

@Override
public void onSignInFailed() {
}

@Override
public void onSignInSucceeded() {
}

}

Possibly a build path or lifecycle issue? Also, when commenting out onStart(), onStop(), onActivityResult() my project runs perfectly fine until I hit the Leaderboard button, crashing again. Anything helps!

Was it helpful?

Solution

It seems it is releated to google play service. You should add meta-data at tag in your manifest.

<meta-data android:name="com.google.android.gms.games.APP_ID"
    android:value="@string/app_id" />
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top