I have the same problem with my application. I think they must have changed something in the latest update to GameHelper.java . Here I tried something, but so that you know, it only eliminates errors, so I could compile my code, it will not fix the source of the problem.
// Api options to use when adding each API, null for none Games.GamesOptions mGamesApiOptions = null; Plus.PlusOptions mPlusApiOptions = null; Api.ApiOptions mAppStateApiOptions = null;
I also changed the methods further down to make the classes fit ...
public void setGamesApiOptions(Games.GamesOptions options) { doApiOptionsPreCheck(); mGamesApiOptions = options; } public void setAppStateApiOptions(Api.ApiOptions options) { doApiOptionsPreCheck(); mAppStateApiOptions = options; } public void setPlusApiOptions(Plus.PlusOptions options) { doApiOptionsPreCheck(); mPlusApiOptions = options; }
I was still getting errors, so I finally had to get rid of the second parameters of these addApi() method calls because they did not accept these types of classes. Fortunately, the addApi() method does not need the options parameter, but removing it pretty much strikes the whole goal of having these variables in the first place.
if (0 != (mRequestedClients & CLIENT_GAMES)) { builder.addApi(Games.API); //, mGamesApiOptions); builder.addScope(Games.SCOPE_GAMES); } if (0 != (mRequestedClients & CLIENT_PLUS)) { builder.addApi(Plus.API); //, mPlusApiOptions); builder.addScope(Plus.SCOPE_PLUS_LOGIN); } if (0 != (mRequestedClients & CLIENT_APPSTATE)) { builder.addApi(AppStateManager.API); //, mAppStateApiOptions); builder.addScope(AppStateManager.SCOPE_APP_STATE); }
I really hope someone comes up with a real solution or updates the GameHelper file. This was a pretty nasty problem. Sorry, I could not be more helpful.
EDIT: I found when they changed this code in a GitHub project . However, these changes were made more than 3 months ago, so I am very confused about why someone else did not have this problem. Here's what it looks like:
- // Client objects we manage. If a given client is not enabled, it is null. - GamesClient mGamesClient = null; - PlusClient mPlusClient = null; - AppStateClient mAppStateClient = null; + // the Google API client builder we will use to create GoogleApiClient + GoogleApiClient.Builder mGoogleApiClientBuilder = null; - // What clients we manage (OR-able values, can be combined as flags) + // Api options to use when adding each API, null for none + GoogleApiClient.ApiOptions mGamesApiOptions = null; + GoogleApiClient.ApiOptions mPlusApiOptions = null; + GoogleApiClient.ApiOptions mAppStateApiOptions = null; + + // Google API client object we manage. + GoogleApiClient mGoogleApiClient = null;