android - Cloud Endpoints 后端 API 开箱即用

标签 android google-app-engine google-cloud-endpoints

我正在学习官方教程 https://github.com/GoogleCloudPlatform/gradle-appengine-templates/tree/master/HelloEndpoints .当我重建时,然后尝试从我的客户端 android 应用程序访问端点。找不到以下类:AndroidHttp、AndroidJsonFactory、GoogleClientRequestInitializer、AbstractGoogleClientRequest、AbstractGoogleJsonClient

这是代码 fragment

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。有没有其他人遇到过这个问题?

最佳答案

我将以下内容添加到后端 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'
}

关于android - Cloud Endpoints 后端 API 开箱即用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43295381/

相关文章:

Android - 通过 TCP/IP 将文件从一个设备同步到多个联系人设备

javascript - 列出 Google Cloud 存储桶中包含数千个文件的文件。

python-2.7 - 谷歌应用引擎 : object has no attribute ToMessage

python - App Engine 上的 Pyramid 获取 "InvalidResponseError: header values must be str, got ' unicode'

google-app-engine - 对同一个 GCS/blobstore URL 的多个上传请求

java - 将 Android 应用程序连接到 Google Cloud Endpoints : could not find class 时出错

android - 谷歌云端点、对象化和持久性

android - 如何在 Android 中创建命名管道 (mkfifo)?

java - 从 firebase 存储下载所有文件

java - 如何获取字符串的第一个符号