I'm trying to implement a very simple leaderboard into a trivia section of an app. For the past few days I have been slamming my face into this code to no avail - no matter what I try the login screen just indefinitely loops (E.G. when I start the activity I get the "connecting to Google Play Games, it pops up with my synced Google Accounts, I choose one and then it just goes back to the activity with "connecting to Google Play Games" again". It does this no matter what the user inputs. The only error that I get is
02-27 15:24:20.735: E/dalvikvm(6467): Could not find class 'com.google.android.gms.internal.fq$b', referenced from method com.google.android.gms.internal.fq.a
And this error also only shows up the first time it tries, I get nothing if I try to log in again even if I go somewhere else on the app and come back to the trivia.
Here is my code for submitting a score to the leaderboard:
int answers;
Button subScore;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.scorescreen);
Intent mIntent = getIntent();
answers = mIntent.getIntExtra("answers", 0);
subScore = (Button) findViewById(R.id.bSubScore);
subScore.setText("" + answers + "/100");
beginUserInitiatedSignIn();
}
@Override
public void onSignInFailed() {
subScore.setText("FAYULED");
// TODO Auto-generated method stub
Log.d("GPS", "failed");
}
@Override
public void onSignInSucceeded() {
Log.d("GPS", "succeeded");
subScore.setText("WE COO");
Games.Leaderboards.submitScore(getApiClient(), "laser", 12345);
startActivityForResult(Games.Leaderboards.getLeaderboardIntent(
getApiClient(), "CgkIvIukofYXEAIQAQ"), 5);
}
}
It never gets to signInFailed() or signInSucceeded(). I've checked the logs. I am extending the BaseGameActivity from the BaseGameUtils library project. and I have the appropriate imports.
Things that I have done to try and figure this out:
- Made sure the BaseGameUtils is a library project
- Made sure I have google-play-services_lib as a library project
- Made sure BaseGameUtils has a reference to google-play-services_lib
- Made sure my project has a reference to BaseGameUtils (I've also tried with references to both BaseGameUtils and google-play-services_lib)
- Made sure that my Google Play Game has a valid Oath2.0 client ID, with the correct SHA1 key for my keystore
- Made sure that I have an ids.xml file in res->values with the 12 digit number for my game's client ID and the Leaderboard ID
- Made sure I am running the game on an actual android device logged in as the tester account
- Made sure the tester account is explicity listed under "tester accounts" in the Google Play Developer Console.
- Made sure that the version of the game I am running on the android device is actually the signed version with the same key mentioned above with the Oath2.0 client
- Made sure that my game is linked to the proper application in my developer console and the package names match.
- Made sure I have the proper meta-data tag in my manifest.xml within the tag.
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<meta-data
android:name="com.google.android.gms.games.APP_ID"
android:value="@string/app_id" />
any suggestions would be sincerely appreciated, I have been digging for almost a week trying to figure this out to no avail.
Thanks in advance for your time!