由于最新的Google Play服务和Android Studio更新(0.5.9),我收到了这个令人讨厌的错误。
当我使用GameHelper开始 Activity 时,应用程序崩溃了。
这些错误是我对制作应用失去兴趣的原因。
我有Google GitHub页面上的最新版本的GameHelper。
Activity :
mmmHelper = new GameHelper(this, GameHelper.CLIENT_ALL);
GameHelper.GameHelperListener listener = new GameHelper.GameHelperListener() {
@Override
public void onSignInSucceeded() {
// handle sign-in succeess
}
@Override
public void onSignInFailed() {
// handle sign-in failure (e.g. show Sign In button)
}
};
mmmHelper.setup(listener);
mGoogleApiClient = new GoogleApiClient.Builder(this)
.addApi(Games.API)
.build();
mGoogleApiClient.connect();
Log.d(TAG, "Starting setup.");
mHelper.startSetup(new IabHelper.OnIabSetupFinishedListener() {
public void onIabSetupFinished(IabResult result) {
Log.d(TAG, "Setup finished.");
if (!result.isSuccess()) {
// Oh noes, there was a problem.
Log.d(TAG, "Problem setting up In-app Billing: " + result);
}
// Hooray, IAB is fully set up!
mHelper.queryInventoryAsync(mGotInventoryListener);
}
});
最佳答案
我通过将CLIENT_ALL更改为CLIENT_GAMES来解决了崩溃问题!
问题:
mmmHelper = new GameHelper(this, GameHelper.CLIENT_ALL);
新鲜:
mmmHelper = new GameHelper(this, GameHelper.CLIENT_GAMES);
我仅使用Games.API,因此这可能是该应用程序因CLIENT_ALL而崩溃的原因。
mGoogleApiClient = new GoogleApiClient.Builder(this)
.addApi(Games.API)
.build();
mGoogleApiClient.connect();