Android Google API:授权无效,不是有效的电子邮件或用户ID

Android Google API:授权无效,不是有效的电子邮件或用户ID,android,json,google-api,bad-request,Android,Json,Google Api,Bad Request,这是我的密码: private void updateSubscriptionDetails(Purchase p) { new Thread(new Runnable() { @Override public void run() { try { InputStream stream = assetManager.open("key.json");

这是我的密码:

private void updateSubscriptionDetails(Purchase p) {
        new Thread(new Runnable() {
            @Override
            public void run() {
                try {
                    InputStream stream = assetManager.open("key.json");

                    HttpTransport httpTransport = new com.google.api.client.http.javanet.NetHttpTransport();
                    JsonFactory jsonFactory = JacksonFactory.getDefaultInstance();
                    HttpRequestInitializer credential = GoogleCredential.fromStream(stream).createScoped(Collections.singleton(AndroidPublisherScopes.ANDROIDPUBLISHER));
                    AndroidPublisher publisher = new AndroidPublisher.Builder(httpTransport, jsonFactory, credential).setApplicationName("App Name").build();

                    SubscriptionPurchase sub = publisher.purchases().subscriptions().get(getPackageName(), p.getSku(), p.getPurchaseToken()).execute();
                    Date expiryDate = new Date(sub.getExpiryTimeMillis() * 1000);
                    SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy");
                    String expiryString = sdf.format(expiryDate);
                    userSubscriptionExpiry.setText(expiryString);
                    Date startDate = new Date(sub.getStartTimeMillis() * 1000);
                    String startString = sdf.format(startDate);
                    userSubscriptionStatus.setText(startString);

                    Toast.makeText(getApplicationContext(), "Subscription details updated", Toast.LENGTH_SHORT).show();
                } catch (Exception e) {Crashlytics.logException(e);
                    Log.e("ERR", e.getMessage(), e);}
            }
        }).start();
    }
我正在尝试访问Google API以更新订阅详细信息,但出现以下错误:

 {
      "error" : "invalid_grant",
      "error_description" : "Not a valid email or user ID."
    }
    com.google.api.client.auth.oauth2.TokenResponseException: 400 Bad Request
    {
      "error" : "invalid_grant",
      "error_description" : "Not a valid email or user ID."
    }
它指向这条线:

SubscriptionPurchase sub = publisher.purchases().subscriptions().get(getPackageName(), p.getSku(), p.getPurchaseToken()).execute();
我的资产文件夹中有.json密钥。我做错了什么