Android App crash with BaseGameActivity -


so, hard ask. wanna use google play game service access leaderboard game. tried use basegameactivity shown here accessing games apis

tried few things, did search cannot figure out problem. app crashes when basegameactivity started. log error shows:

03-10 17:44:54.071: e/androidruntime(31435): fatal exception: main 03-10 17:44:54.071: e/androidruntime(31435): java.lang.illegalstateexception:  fatal  developer error has occurred. check logs further information. 03-10 17:44:54.071: e/androidruntime(31435):    @     com.google.android.gms.internal.dw$h.b(unknown source) 03-10 17:44:54.071: e/androidruntime(31435):    @ com.google.android.gms.internal.dw$h.b(unknown source) 03-10 17:44:54.071: e/androidruntime(31435):    @ com.google.android.gms.internal.dw$b.br(unknown source) 03-10 17:44:54.071: e/androidruntime(31435):    @ com.google.android.gms.internal.dw$a.handlemessage(unknown source) 

console shows:

[2014-03-10 17:47:18 - basegameutils] not find basegameutils.apk!

answer: had 2 metadata entrys appid in manifest. log without filters listed corresponding errors

the 2 entries were

<meta-data         android:name="com.google.android.gms.games.app_id"         android:value="@string/app_id" />     <meta-data         android:name="com.google.android.gms.appstate.app_id"         android:value="@string/app_id" /> 

only 1 of these entries mentioned in tutorial.

i've finished putting leaderboards , pain, did , works. here's long list of suggestions may directly or indirectly you. use eclipse.

  • for google play api, minimum sdk 9 put in manifest on it's own line:

    < uses-sdk android:minsdkversion="9" android:targetsdkversion="19"/> //whatever target want

  • import basegameutils project workspace. not have modify of code.

  • import google-play-services_lib. in sdk folder. sdk folder next eclipse folder. anyways in: sdk/extras/google/google_play_services/libproject/google-play-services_lib. not have modify of code.

  • right click on yourproject in package explorer tab (normally on left side of eclipse of project folders). click on properties (alt+enter). click on android. on bottom part of android page, should "library." click add button , add basegameutils , google-play-services_lib. not click "is library".

  • ensure of android-support-v4.jar files in relevant projects using same up-to-date version. can update support file right clicking project in "package explorer" tab , going ->android tools->add support library. accept , update. can further check see if of projects listed have updated jar right clicking project , going properties. click on java build path , click on libraries tab. should see support jar listed. if not, can add jar, where-ever located in project. if not this, may have called jar mixmatch. of course, see exact problem in console easy fix , diagnose.

  • your manifest should be: < meta-data android:name="com.google.android.gms.games.app_id" android:value="@string/app_id" /> < meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />

the last line @integer looks google_play_services_version don't have in future whenever google play version changes. not hard code version number value or have manually update often.

  • myproject extends basegameactivity.

  • then call leaderboard , update it, sample code of 2 lines of code runs great. see below. https://developers.google.com/games/services/android/leaderboards have pass in leaderboard id given when link app google play developer console. it's string looks like: "dkbgvageybasewefcx." updating , getting leaderboard crash if aren't connected. check out complete sample code below.

    //to update if (getapiclient().isconnected()) //getapiclient part of basegameutils games.leaderboards.submitscore(getapiclient(), leaderboardid, score);

    //to show if (getapiclient().isconnected()) startactivityforresult(games.leaderboards.getleaderboardintent(getapiclient(), leaderboardid), 1337);

  • lastly, if using app different keystore has different sha1 (secure hash algorithm) 1 have on google play store, there error , not able connect. if uploaded app keystore sha1 ab:cd:de... , you're debugging app, may see problems since eclipse use default android debug keystore has different sha1. not able connect , consequently, not able use google play services.

  • i recommend @ sample code called "trivial quest." https://github.com/playgameservices/android-samples it's under eclipse_compat. sample code shows 1 how sign in , unlock achievement. if can sign in, can achievements , leaderboards easily.

  • there's lot of stuff have given small piece of puzzle. if have more problems, please let know.


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -