Android 2.3.3上的AccountPicker错误

时间:2012-12-10 17:58:28

标签: java android

我正在编写一个使用Google Oauth2登录的Android应用程序。 要提示用户使用我正在使用AccountPicker.newChooseAccountIntent()的帐户。

这依赖于设备上可用的Google Play服务,因此在我的活动的onResume()中,我按照google文档运行以下检查:

// Check that Google Play Services are available on the device
// We use them to show the account picker dialog
int status = GooglePlayServicesUtil.isGooglePlayServicesAvailable(this);

if(status != ConnectionResult.SUCCESS){     
    if(GooglePlayServicesUtil.isUserRecoverableError(status)){
        GooglePlayServicesUtil.getErrorDialog(status, this, REQUESTID_PLAY_SERVICES).show();
    } else {
        Toast.makeText(getApplicationContext(), R.string.purchases_not_supported, Toast.LENGTH_LONG).show();
        finish();
    }
}   

这在我的Jellybean设备上效果很好但是当在运行Android 2.3.3(Gingerbread)的旧设备上尝试它时,我得到以下异常。

有没有人见过这个?

E/Activities/MainActivity( 1906): Error: Unable to resume activity {com.somecompany.someapp/com.somecompany.someapp.activities.PurchaseActivity}: java.util.MissingResourceException: Can't find resource for bundle 'com.google.android.gms.common.strings.GmsStrings_en_US', key ''
E/Activities/MainActivity( 1906): java.lang.RuntimeException: Unable to resume activity {com.somecompany.someapp/com.somecompany.someapp.activities.PurchaseActivity}: java.util.MissingResourceException: Can't find resource for bundle 'com.google.android.gms.common.strings.GmsStrings_en_US', key ''
E/Activities/MainActivity( 1906):       at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2460)
E/Activities/MainActivity( 1906):       at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2481)
E/Activities/MainActivity( 1906):       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1847)
E/Activities/MainActivity( 1906):       at android.app.ActivityThread.access$1500(ActivityThread.java:132)
E/Activities/MainActivity( 1906):       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1038)
E/Activities/MainActivity( 1906):       at android.os.Handler.dispatchMessage(Handler.java:99)
E/Activities/MainActivity( 1906):       at android.os.Looper.loop(Looper.java:143)
E/Activities/MainActivity( 1906):       at android.app.ActivityThread.main(ActivityThread.java:4263)
E/Activities/MainActivity( 1906):       at java.lang.reflect.Method.invokeNative(Native Method)
E/Activities/MainActivity( 1906):       at java.lang.reflect.Method.invoke(Method.java:507)
E/Activities/MainActivity( 1906):       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
E/Activities/MainActivity( 1906):       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
E/Activities/MainActivity( 1906):       at dalvik.system.NativeStart.main(Native Method)
E/Activities/MainActivity( 1906): Caused by: java.util.MissingResourceException: Can't find resource for bundle 'com.google.android.gms.common.strings.GmsStrings_en_US', key ''
E/Activities/MainActivity( 1906):       at java.util.ResourceBundle.missingResourceException(ResourceBundle.java:225)
E/Activities/MainActivity( 1906):       at java.util.ResourceBundle.getBundle(ResourceBundle.java:218)
E/Activities/MainActivity( 1906):       at com.sonelli.y.a(Unknown Source)
E/Activities/MainActivity( 1906):       at com.sonelli.y.a(Unknown Source)
E/Activities/MainActivity( 1906):       at com.sonelli.h.a(Unknown Source)
E/Activities/MainActivity( 1906):       at com.somecompany.someapp.activities.PurchaseActivity.onResume(PurchaseActivity.java:49)
E/Activities/MainActivity( 1906):       at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1242)
E/Activities/MainActivity( 1906):       at android.app.Activity.performResume(Activity.java:3957)
E/Activities/MainActivity( 1906):       at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2450)
E/Activities/MainActivity( 1906):       ... 12 more
~       

0 个答案:

没有答案