Android App crash with BaseGameActivity

So, somewhat hard to ask.
I wanna use the google play game service to access a leaderboard for my game.
I tried to use BaseGameActivity like it is shown here Accessing the Games APIs

Tried a few things, did some search but cannot figure out the problem. My App crashes when the BaseGameActivity is started.
Log error shows:

  • Android - Is it possible to get install referrer programmatically
  • SwipeRefreshLayout - Pull From Bottom
  • Android application architecture - MVVM or MVC?
  • How to Parse JSON Array with Gson
  • onStart of new Activity is called before onStop of parent
  • Multiple MIME types in Android
  • 03-10 17:44:54.071: E/AndroidRuntime(31435): FATAL EXCEPTION: main
    03-10 17:44:54.071: E/AndroidRuntime(31435): java.lang.IllegalStateException: A
     fatal  developer error has occurred. Check the logs for further information.
    03-10 17:44:54.071: E/AndroidRuntime(31435):    at$h.b(Unknown Source)
    03-10 17:44:54.071: E/AndroidRuntime(31435):    at$h.b(Unknown Source)
    03-10 17:44:54.071: E/AndroidRuntime(31435):    at$b.bR(Unknown Source)
    03-10 17:44:54.071: E/AndroidRuntime(31435):    at$a.handleMessage(Unknown Source)

    Console shows:

    [2014-03-10 17:47:18 – BaseGameUtils] Could not find BaseGameUtils.apk!

    I had to do two metadata entrys about the appid in the manifest.
    The Log without filters listed the corresponding errors

    The two entries were

            android:value="@string/app_id" />
            android:value="@string/app_id" />

    only one of these entries were mentioned in the tutorial.

  • Aligning textviews on the left and right edges in Android layout
  • Event OnClick for a button in a custom notification
  • Json Parsing from Url In Android , Not working
  • How can I navigate between pages inside a PhoneGap application?
  • Change spinner style in toolbar
  • Elevation on Android Lollipop not working
  • 2 Solutions collect form web for “Android App crash with BaseGameActivity”

    I’ve just finished putting up leaderboards and it was a pain, but I did it and it works. Here’s a long list of suggestions that may directly or indirectly help you. I use Eclipse.

    • For Google Play API, minimum SDK is 9 so put this in your manifest on it’s own line:

      < uses-sdk
      //whatever target you want

    • Import the BaseGameUtils project to your workspace. You do not have to modify any of this code.

    • Import google-play-services_lib. This is in your sdk folder. My sdk folder is next to my eclipse folder. Anyways this is in: sdk/extras/google/google_play_services/libproject/google-play-services_lib. You do not have to modify any of this code.

    • Right Click on YourProject in the package explorer tab (normally on the left side of eclipse with all of your project folders). Then click on Properties (Alt+Enter). Then click on Android. On the bottom part of the Android page, should be “Library.” Click the add button and add BaseGameUtils and google-play-services_lib. Do not click “Is Library”.

    • Ensure all of the android-support-v4.jar files in all the relevant projects are using the same up-to-date version. You can update your support file by right clicking your project in the “package explorer” tab and going to ->Android Tools->Add Support Library. Then you accept and update.
      You can further check to see if all of the projects listed have this updated jar by right clicking your project and going to properties. Then click on Java Build Path and then Click on the libraries tab. You should see the support jar listed. If not, you can add the jar, where-ever it is located in the project. If you do not do this, you may have something called JAR MIXMATCH. Of course, you will see the exact problem in your console so this is easy to fix and diagnose.

    • Your manifest should be:
      < meta-data
      android:value=”@string/app_id” />
      < meta-data
      android:value=”@integer/google_play_services_version” />

    The last line with @integer looks into the google_play_services_version so you don’t have to do anything in the future whenever the google play version changes. Do not hard code the version number value or you will have to manually update it often.

    • MyProject extends BaseGameActivity.

    • Then to call the leaderboard and update it, their sample code of 2 lines of code runs great. See below.
      You have to pass in your leaderboard ID given to you when you link up your app to the google play developer console. It’s a String that looks something like: “DkbGvageyBASEWEFCx.”
      Updating and Getting a leaderboard will crash if you aren’t connected. Check out this complete sample code below.

      //to update
      if (getApiClient().isConnected()) //getAPIClient is part of BaseGameUtils
      Games.Leaderboards.submitScore(getApiClient(), leaderboardID, score);

      //to show
      if (getApiClient().isConnected())
      startActivityForResult(Games.Leaderboards.getLeaderboardIntent(getApiClient(), leaderboardID), 1337);

    • Lastly, if you are using an app with a different keystore that has a different SHA1 (Secure Hash Algorithm) than the one that you have on the google play store, then there will be an error and you will not be able to connect. So if you uploaded an app with a keystore with an SHA1 like ab:cd:de… and you’re debugging your app, you may see problems since Eclipse will use a default android debug keystore which has a different SHA1.
      You will not be able to connect and consequently, you will not be able to use any google play services.

    • I recommend you look at the sample code called “Trivial Quest.”
      It’s under eclipse_compat. This sample code shows one how to sign in and unlock an achievement. If you can sign in, you can do achievements and leaderboards really easily.

    • There’s a lot of stuff but you have given us only a small piece of the puzzle. If you have any more problems, please let us know.

    I think, maybe, you need put Google Play Services Library in your dependencies,

    In this line :

    03-10 17:44:54.071: E/AndroidRuntime(31435): at$h.b(Unknown Source)

    Probally you have problems with maps dependency of google, the library GMS from google is used

    to maps and other services from Google Play Services, if you have problems with that, is possible you have added Wrong versions in your project.

    The best way for you is, downalod Google Play Services For Games and put in your project

    (this google play services is specific to games )

    Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.