java - App crashes if Games.API is added -


basically, googleapiclient able connect. if add games.api apiclient, uncaught exception occurs. searched everywhere, no 1 seems have problem. remove games.api builder, gets connected normally. need games.api include leaderboards in game. please can me?

logcat:

07-09 00:43:19.709  14636-14636/? w/dalvikvm﹕ threadid=1: thread exiting uncaught exception (group=0x418c49a8) 07-09 00:43:19.709  14636-14636/? w/dalvikvm﹕ threadid=1: uncaught exception occurred 07-09 00:43:19.709  14636-14636/? w/system.err﹕ java.lang.illegalstateexception: fatal developer error has occurred. check logs further information. 07-09 00:43:19.724  14636-14636/? w/system.err﹕ @ com.google.android.gms.common.internal.zzi$zza.zzc(unknown source) 07-09 00:43:19.724  14636-14636/? w/system.err﹕ @ com.google.android.gms.common.internal.zzi$zza.zzr(unknown source) 07-09 00:43:19.724  14636-14636/? w/system.err﹕ @ com.google.android.gms.common.internal.zzi$zzc.zznq(unknown source) 07-09 00:43:19.724  14636-14636/? w/system.err﹕ @ com.google.android.gms.common.internal.zzi$zzb.handlemessage(unknown source) 07-09 00:43:19.724  14636-14636/? w/system.err﹕ @ android.os.handler.dispatchmessage(handler.java:107) 07-09 00:43:19.724  14636-14636/? w/system.err﹕ @ android.os.looper.loop(looper.java:194) 07-09 00:43:19.724  14636-14636/? w/system.err﹕ @ android.app.activitythread.main(activitythread.java:5405) 07-09 00:43:19.724  14636-14636/? w/system.err﹕ @ java.lang.reflect.method.invokenative(native method) 07-09 00:43:19.724  14636-14636/? w/system.err﹕ @ java.lang.reflect.method.invoke(method.java:525) 07-09 00:43:19.724  14636-14636/? w/system.err﹕ @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:838) 07-09 00:43:19.724  14636-14636/? w/system.err﹕ @ com.android.internal.os.zygoteinit.main(zygoteinit.java:605) 07-09 00:43:19.724  14636-14636/? w/system.err﹕ @ dalvik.system.nativestart.main(native method) 07-09 00:43:19.724  14636-14636/? w/dalvikvm﹕ threadid=1: calling uncaughtexceptionhandler 07-09 00:43:19.725  14636-14636/? e/androidruntime﹕ fatal exception: main     java.lang.illegalstateexception: fatal developer error has occurred. check logs further information.             @ com.google.android.gms.common.internal.zzi$zza.zzc(unknown source)             @ com.google.android.gms.common.internal.zzi$zza.zzr(unknown source)             @ com.google.android.gms.common.internal.zzi$zzc.zznq(unknown source)             @ com.google.android.gms.common.internal.zzi$zzb.handlemessage(unknown source)             @ android.os.handler.dispatchmessage(handler.java:107)             @ android.os.looper.loop(looper.java:194)             @ android.app.activitythread.main(activitythread.java:5405)             @ java.lang.reflect.method.invokenative(native method)             @ java.lang.reflect.method.invoke(method.java:525)             @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:838)             @ com.android.internal.os.zygoteinit.main(zygoteinit.java:605)             @ dalvik.system.nativestart.main(native method) 

manifest:

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

code:

  mgoogleapiclient = new googleapiclient.builder(this)   .addapi(drive.api)   .addapi(games.api)   .addapi(appstatemanager.api)   .addscope(appstatemanager.scope_app_state)   .addscope(games.scope_games)   .addscope(drive.scope_file)   .addconnectioncallbacks(this)   .addonconnectionfailedlistener(this)   .build();   public void onconnected(bundle connectionhint) {          toast.maketext(homepage.this, "connected", toast.length_short).show();          sharedpreferences load=getsharedpreferences("mysavegame", mode_private);         int a=load.getint("score", 0);          if (mgoogleapiclient != null && mgoogleapiclient.isconnected()) {       //      games.leaderboards.submitscore(mgoogleapiclient, "cgki2tpa1v4neaiqaa", a);         }         toast.maketext(homepage.this, "score submitted", toast.length_short).show();         // connected google play services!         // stuff goes here.     } 

game link: https://play.google.com/store/apps/details?id=com.iitb.nihar.declarecardgame

maybe not complete solution problem, part of issue hard coding app_id manifest. wont work. tried , same crash.

you need use "@string/app_id" reference res/values/something.xml file.

**this work if add value app_id shown below /res/values/strings.xml file.

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

this not work.

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

in /res/values/strings.xml

<resources>     <string name="app_id">123456789</string> </resources> 

even if put app_id in /res/values/file.xml, if not valid app_id, the same crash.


Comments

Popular posts from this blog

python - No exponential form of the z-axis in matplotlib-3D-plots -

php - Best Light server (Linux + Web server + Database) for Raspberry Pi -

c# - "Newtonsoft.Json.JsonSerializationException unable to find constructor to use for types" error when deserializing class -