添加Google应用内结算功能会导致应用无法找到Google Play服务

时间:2014-08-19 20:09:30

标签: android google-play-services in-app-billing google-cloud-messaging

我的应用使用Google Cloud Messaging并使用Android网站上的实施代码检查Google Play Services APK是否已安装:

// Check for Google Play Services APK. If success, proceed with GCM registration.
public void registerGcm() {
    if (checkPlayServices()) {
        mGcm = GoogleCloudMessaging.getInstance(mContext);
        mGcmRegId = getRegistrationId(mContext);

        if (mGcmRegId.isEmpty()) { new RegisterGCMTask().execute(); }
    }
    else {
        Toast.makeText(mContext, "Google Play Services APK not found\n"
                + "Please download Google Play Services", Toast.LENGTH_LONG).show();
        mActivity.finish();
    }
}

一切正常,checkPlayServices()之前恢复正常。但是,一旦我将v3 Google In-App Billing作为说明here实施,它就会停止工作,checkPlayServices()开始返回false。

为什么会这样?还有其他人遇到过类似的问题吗?升级Google Play服务后发生此错误。

我也在我的Logcat中得到了这个注释:

08-19 13:12:39.730: W/GooglePlayServicesUtil(11708): Google Play services out of date.  Requires 5089000 but found 5084036