Google Cloud Endpoints 设置问题

Google Cloud Endpoints Setup Trouble

我对 Google 的云平台完全陌生,我在为我的 Android 设备设置它时遇到问题。我试图在 20 秒后跟随 this tutorial and I'm at the point of trying to test my backend with my Android Emulator. The emulator, however, gives me this message,而它应该说出我的名字。到目前为止,这是我的代码:

MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);

    buildUI();

    new EndpointsAsyncTask().execute(new Pair<Context, String>(this, "Solomon"));


}

EndpointsAsyncTask.java

public class EndpointsAsyncTask extends AsyncTask<Pair<Context, String>, Void, String> {
private static MyApi myApiService = null;
private Context context;

@Override
protected String doInBackground(Pair<Context, String>... params) {
    if(myApiService == null) {  // Only do this once
        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);
                    }
                });
        // end options for devappserver

        myApiService = builder.build();
    }

    context = params[0].first;
    String name = params[0].second;

    try {
        return myApiService.sayHi(name).execute().getData();
    } catch (IOException e) {
        return e.getMessage();
    }
}

@Override
protected void onPostExecute(String result) {
    Toast.makeText(context, result, Toast.LENGTH_LONG).show();
}
}

感谢所有帮助!

编辑:部分问题是我是 运行 端点后端而不是 App Engine Servlet 后端。但现在我得到 "connection refused" 并且我是 运行 App Engine Servlet 后端。有什么想法吗?

在艰难的几天之后,我发现问题是我需要将我的 rootUrl 从 http://10.0.2.2:8080/_ah/api/ 更改为我的 appspot 域。现在我收到了 Hello World 消息。