【问题标题】:Cloud Endpoints backend API not working out of the boxCloud Endpoints 后端 API 无法开箱即用
【发布时间】:2017-04-08 14:37:23
【问题描述】:

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

这里是代码sn-p

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

【问题讨论】:

  • 能否请您发布您的 Android 应用的 gradle 构建文件

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


【解决方案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'
}

【讨论】:

    猜你喜欢
    • 2015-06-25
    • 1970-01-01
    • 1970-01-01
    • 2018-03-11
    • 2017-05-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-10-27
    相关资源
    最近更新 更多