[英]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.