简体   繁体   English

AbstractGoogleClientRequest 和 GoogleClientRequestInitializer class 在 com.google.api-client:google-api-client-android:2.0.0 中找不到

[英]AbstractGoogleClientRequest and GoogleClientRequestInitializer class not found in com.google.api-client:google-api-client-android:2.0.0

My Android app with Cloud Endpoints says these classes do not exist我的带有 Cloud Endpoints 的 Android 应用程序说这些类不存在

import com.google.api.client.googleapis.services.AbstractGoogleClientRequest;
import com.google.api.client.googleapis.services.GoogleClientRequestInitializer;

when using any version higher than 1.31.0 of the following import使用以下导入的任何高于 1.31.0 的版本时

implementation 'com.google.api-client:google-api-client-android:1.31.0'

The latest version is 2.0.0 but even 1.32.1 has the issue.最新版本是2.0.0但即使是 1.32.1 也有问题。 Anything that is 1.31.0 or lower works.任何 1.31.0 或更低版本的作品都可以。

This is what my code looks like (taken from this link ):这是我的代码的样子(取自此链接):

    if (myApiService == null) {  // Only do this once
        MyApi.Builder builder = new MyApi.Builder(AndroidHttp.newCompatibleTransport(),
                new AndroidJsonFactory(), null)
                .setRootUrl("http://YOUR-PROJECT-ID.appspot.com/_ah/api/")
                .setGoogleClientRequestInitializer(new GoogleClientRequestInitializer() {
                    @Override
                    public void initialize(AbstractGoogleClientRequest<?> abstractGoogleClientRequest) throws IOException {
                        abstractGoogleClientRequest.setDisableGZipContent(true);
                    }
                });
        // end options for devappserver
        myApiService = builder.build();
    }

    try {
        return myApiService.sayHi(params[0]).execute().getData();
    } catch (IOException e) {
        return e.getMessage();
    }

Is there a different way to be doing this in the new versions or is something else going on?在新版本中是否有不同的方法可以做到这一点,还是发生了其他事情?

According to the documentation you shared and the code example you are following, it seems to be definitely an issue of the API version .根据您共享的文档和您正在遵循的代码示例,这似乎肯定是API 版本的问题。

I highly recommend you to raise a new issue in this GitHub repository .我强烈建议您在此GitHub 存储库中提出一个新问题。

As soon as you receive a response in the repository, I would advise you to keep working with a lower version for the time being.一旦您在存储库中收到响应,我建议您暂时继续使用较低版本。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 类型 com.google.api.client.json.JsonFactory 无法解析 - The type com.google.api.client.json.JsonFactory cannot be resolved 谷歌客户端 api 使用后端服务器进行身份验证不起作用 - google client api Authenticate with a backend server not working java.lang.NoSuchMethodError: 'boolean com.google.api.client.http.HttpTransport.isMtls() - java.lang.NoSuchMethodError: 'boolean com.google.api.client.http.HttpTransport.isMtls() Google API 客户端机密错误(Python) - Google API client secrets error (Python) 使用谷歌客户端的最佳实践 api - best praticle to use the client from an google api java.lang.ClassNotFoundException:com.google.api.client.json.JsonFactory - java.lang.ClassNotFoundException: com.google.api.client.json.JsonFactory GCS Hadoop 连接器错误:ClassNotFoundException:com.google.api.client.http.HttpRequestInitializer ls:方案 gs 没有文件系统 - GCS Hadoop connector error: ClassNotFoundException: com.google.api.client.http.HttpRequestInitializer ls: No FileSystem for scheme gs 解析来自 Google Cloud Vision API Python 客户端的响应 - Parse response from Google Cloud Vision API Python Client 原因:org.gradle.api.GradleException:没有为 package 名称“com.faizan4742.medmobile”找到匹配的客户端 - Caused by: org.gradle.api.GradleException: No matching client found for package name 'com.faizan4742.medmobile' 致命错误:未捕获错误:未找到 Class 'Google\Client' - Fatal error: Uncaught Error: Class 'Google\Client' not found
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM