【问题标题】:How to debug app engine backend with Google Cloud Messaging code in android studio如何在 android studio 中使用 Google Cloud Messaging 代码调试应用引擎后端
【发布时间】:2015-09-05 14:34:58
【问题描述】:

我是 Google Cloud 消息传递与应用引擎后端领域的初学者。我跟着教程https://github.com/GoogleCloudPlatform/gradle-appengine-templates/tree/master/GcmEndpoints

我通过“构建 -> 将模块部署到 App Engine”将代码部署到应用引擎开发服务器。部署成功。

我从 https://project-id.appspot.com/_ah/api/explorer 消息传递 API 发送消息。 (请注意 project-id 是我代码中的真实 id)

我在我的设备上收到了消息。但我想在服务器端调试代码。如何调试服务器端代码?

【问题讨论】:

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


    【解决方案1】:

    您在开发机器上调试服务器端代码,然后将其部署到云应用引擎,您可以根据需要多次执行此操作,它只是覆盖当前实例。您可以先在本地测试您的应用引擎,只需运行它即可 - 可通过 localhost:8080 访问它

    【讨论】:

      【解决方案2】:

      您可以通过 Sout (System.out.println)

      调试您的服务器端代码
      This is an example of how I am doing it
      
      if (result.isSuccess()) {
      
          Transaction transaction = result.getTarget();
          transaction.getStatus();
          System.out.println("message: " + result.getMessage());
          System.out.println("transaction: " + result.getTarget());
          System.out.println("status: " + result.getTarget().getStatus());
          resp.getWriter().println("Thanks for the purchase (: ");
      
      } else {
      
        ValidationErrors errors = result.getErrors();
        System.out.println(result.getErrors());
        resp.getWriter().println("Payment Failed " + errors.toString());
      
       }
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2017-08-10
        • 1970-01-01
        相关资源
        最近更新 更多