Google App Engine连接Android(Eclipse)设备端点错误

时间:2021-01-30 20:51:46

I am just started exploring app engine with android (Java) and I followed a link to teach me how to create an App Engine Connected Android Project. https://developers.google.com/eclipse/docs/endpoints-androidconnected-gae

我刚开始用android(Java)探索app引擎,我按照链接教我如何创建App Engine Connected Android Project。 https://developers.google.com/eclipse/docs/endpoints-androidconnected-gae

I followed exactly what was written in the link ,

我完全按照链接中写的内容,

1) Created a new app engine connected android project

1)创建了一个连接android项目的新app引擎

2) Get the project number and API Keys from https://code.google.com/apis/console/#project

2)从https://code.google.com/apis/console/#project获取项目编号和API密钥

3) enable Google Cloud Messaging in the Google APIs Console

3)在Google API控制台中启用Google Cloud Messaging

4) set the LOCAL_ANDROID_RUN to true in CloudEndpoints class

4)在CloudEndpoints类中将LOCAL_ANDROID_RUN设置为true

5) used a emulator with google api(v17)

5)使用谷歌api模拟器(v17)

6) installed the android cloud messaging library from android sdk manager

6)从android sdk manager安装了android云消息库

7) I am using eclipse indigo

7)我正在使用eclipse indigo

i got errors these lines in RegisterActivity.java

我在RegisterActivity.java中遇到了这些错误

import messageEndpoint.MessageEndpoint;
import messageEndpoint.CollectionResponseMessageData;
import messageEndpoint.MessageData;

i got i got errors these lines in GCMIntentService.java

我在GCMIntentService.java中得到了这些行的错误

import com.tez.deviceinfoendpoint.Deviceinfoendpoint;
import com.tez.deviceinfoendpoint.Deviceinfoendpoint.Builder;
import com.tez.deviceinfoendpoint.model.DeviceInfo;

and errors like that:

和那样的错误:

Deviceinfoendpoint cannot be resolved to a type GCMIntentService.java
MessageEndpoint cannot be resolved to a type RegisterActivity.java

Deviceinfoendpoint无法解析为类型GCMIntentService.java MessageEndpoint无法解析为类型RegisterActivity.java

What should i do?

我该怎么办?

2 个解决方案

#1


1  

Right click on the app engine project and select Google-->Generate Cloud End Point Client Library. Clean the project and refresh. It should work.

右键单击app引擎项目,然后选择Google - > Generate Cloud End Point Client Library。清理项目并刷新。它应该工作。

#2


0  

Although I'm not quite sure about the cause of your error stack, it's encouraged to right-click on the app-engine project and select generate cloud end point as suggested above. However, if you badly need to create an endpoint on your own, you will have to make sure a similar entry as below is added into your web.xml inside your webapp directory.

虽然我不太确定错误堆栈的原因,但我们鼓励右键单击app-engine项目并选择生成云终点,如上所述。但是,如果您非常需要自己创建端点,则必须确保将以下类似条目添加到webapp目录中的web.xml中。

        <param-name>services</param-name>
        <param-value>${package}.MyEndpoint</param-value>

And after you ensure the above entry,

在确保上述条目后,

  1. you can make your module
  2. 你可以制作你的模块
  3. Deploy it local server and run the app on emulator
  4. 部署本地服务器并在模拟器上运行应用程序

Or else if you're working with your production server,

否则,如果您正在使用生产服务器,

  1. Make the module
  2. 制作模块
  3. Deploy to app-engine and test it on a device or an emulator of your choice.
  4. 部署到app-engine并在您选择的设备或模拟器上进行测试。

Hope this might help you if the issue was with your new endpoint/services exposed through the new endpoint that you create. Thanks!

希望这可能对您有所帮助,如果问题在于您通过您创建的新端点公开的新端点/服务。谢谢!

#1


1  

Right click on the app engine project and select Google-->Generate Cloud End Point Client Library. Clean the project and refresh. It should work.

右键单击app引擎项目,然后选择Google - > Generate Cloud End Point Client Library。清理项目并刷新。它应该工作。

#2


0  

Although I'm not quite sure about the cause of your error stack, it's encouraged to right-click on the app-engine project and select generate cloud end point as suggested above. However, if you badly need to create an endpoint on your own, you will have to make sure a similar entry as below is added into your web.xml inside your webapp directory.

虽然我不太确定错误堆栈的原因,但我们鼓励右键单击app-engine项目并选择生成云终点,如上所述。但是,如果您非常需要自己创建端点,则必须确保将以下类似条目添加到webapp目录中的web.xml中。

        <param-name>services</param-name>
        <param-value>${package}.MyEndpoint</param-value>

And after you ensure the above entry,

在确保上述条目后,

  1. you can make your module
  2. 你可以制作你的模块
  3. Deploy it local server and run the app on emulator
  4. 部署本地服务器并在模拟器上运行应用程序

Or else if you're working with your production server,

否则,如果您正在使用生产服务器,

  1. Make the module
  2. 制作模块
  3. Deploy to app-engine and test it on a device or an emulator of your choice.
  4. 部署到app-engine并在您选择的设备或模拟器上进行测试。

Hope this might help you if the issue was with your new endpoint/services exposed through the new endpoint that you create. Thanks!

希望这可能对您有所帮助,如果问题在于您通过您创建的新端点公开的新端点/服务。谢谢!