我正在关注https://github.com/GoogleCloudPlatform/gradle-appengine-templates/tree/master/HelloEndpoints的官方教程。当我重建,然后尝试从我的客户端Android应用程序访问端点。无法找到以下类:AndroidHttp,AndroidJsonFactory,GoogleClientRequestInitializer,AbstractGoogleClientRequest,AbstractGoogleJsonClient
以下是代码段
MyApi.Builder builder = new MyApi.Builder(AndroidHttp.newCompatibleTransport(),
new AndroidJsonFactory(), null)
// options for running against local devappserver
// - 10.0.2.2 is localhost's IP address in Android emulator
// - turn off compression when running against local devappserver
.setRootUrl("http://10.0.2.2:8080/_ah/api/")
.setGoogleClientRequestInitializer(new GoogleClientRequestInitializer() {
@Override
public void initialize(AbstractGoogleClientRequest<?> abstractGoogleClientRequest) throws IOException {
abstractGoogleClientRequest.setDisableGZipContent(true);
}
});
我也无法看到MyApi。还有其他人遇到过这个问题吗?
答案 0 :(得分:1)
我将以下内容添加到后端gradle并且可以正常工作
dependencies {
compile 'com.google.http-client:google-http-client-android:1.19.0'
compile 'com.google.api-client:google-api-client:1.19.0'
compile 'org.projectlombok:lombok:1.12.6'
compile 'org.slf4j:slf4j-api:1.7.21'
compile 'org.slf4j:slf4j-jdk14:1.7.21'
}