Endpoint.Builder缺少生成云终端终端、Endpoint、Builder

2023-09-05 05:11:33 作者:莪有着属于莪的执著

我试图效仿教程在 https://developers.google。 COM /月食/文档/端点-addentities 与我被困在找出如何让 GameEndpoint.Builder 类来生成在Eclipse中。

下面这一点,并产生了云终端之后描述的那样,我有一个 GameEndpoint 类创建,但没有 GameEndpoint.Builder 类。所以很明显,我有这样的错误

  

GameEndpoint.Builder不能被解析为一个类型

我难倒了这一点。我如何在Eclipse中生成 GameEndpoint.Builder 类,还是什么话prevent呢?

code

 公共类NewGameTask扩展的AsyncTask<背景下,为Integer,Long> {
    保护龙doInBackground(上下文...上下文){

        GameEndpoint.Builder endpointBuilder =新GameEndpoint.Builder(
                AndroidHttp.newCompatibleTransport(),新JacksonFactory()
                新的Htt prequestInitializer(){
                    公共无效初始化(Htt的prequest HTT prequest){
                    }
                });
        GameEndpoint终点= CloudEndpointUtils.updateBuilder(
                endpointBuilder).build();
        尝试 {
            游戏游戏=新游戏();
            game.setStart(Calendar.getInstance());

            比赛结果= endpoint.insertGame(游戏);
        }赶上(IOException异常E){
            e.printStackTrace();
        }
        返回(长)0;
    }
}
 

解决方案

我想通了,我的问题,从的谷歌I / O 2013 它采用Android工作室,但它是一回事Eclipse的居多。

我在下面的错误 https://developers.google.com/eclipse/docs/端点-addentities 的是,你需要把你的实体类到的的MyApp-AppEngine上的项目,不是你的的MyApp 的项目。

这是问题的根源。在情况下,它可以帮助那些在未来,这里是我做了一个简短崩溃。

把的实体的要添加到应用程序引擎进级你的的MyApp-AppEngine上的项目。 右键点击您的类并转到谷歌> 生成云端点客户端库 右键单击您的的MyApp-AppEngine上的项目,并转到谷歌> 生成云Enpoint客户端库 新的参考将在作出您的的MyApp 的,你在你的项目中使用参考项目。 怎么看你的电脑有没有声卡

I'm attempting to follow the example tutorial at https://developers.google.com/eclipse/docs/endpoints-addentities and I'm stuck figuring out how to get the GameEndpoint.Builder class to generate within Eclipse.

After following this and generating the cloud endpoints as described, I have a GameEndpoint class created, but there is no GameEndpoint.Builder class. So obviously I have this error

GameEndpoint.Builder cannot be resolved to a type

I'm stumped at this point. How do I generate the GameEndpoint.Builder class within Eclipse, or what would prevent it?

Code

public class NewGameTask extends AsyncTask<Context, Integer, Long> {
    protected Long doInBackground(Context... contexts) {

        GameEndpoint.Builder endpointBuilder = new GameEndpoint.Builder(
                AndroidHttp.newCompatibleTransport(), new JacksonFactory(),
                new HttpRequestInitializer() {
                    public void initialize(HttpRequest httpRequest) {
                    }
                });
        GameEndpoint endpoint = CloudEndpointUtils.updateBuilder(
                endpointBuilder).build();
        try {
            Game game = new Game();
            game.setStart(Calendar.getInstance());

            Game result = endpoint.insertGame(game);
        } catch (IOException e) {
            e.printStackTrace();
        }
        return (long) 0;
    }
}

解决方案

I figured out my issue after watching this video from Google I/O 2013 which is using Android Studio, but it was the same thing as Eclipse mostly.

My mistake in following https://developers.google.com/eclipse/docs/endpoints-addentities was that you need to put your entity class into the MyApp-AppEngine project and NOT your MyApp project.

That was the source of confusion. In case it helps those in the future, here is a short breakdown of what I did.

Put the Entity class you want to add to App Engine into your MyApp-AppEngine project. Right click your class and go to Google > Generate Cloud Endpoint Client Library Right click your MyApp-AppEngine project and go to Google > Generate Cloud Enpoint Client Library New references will be made in your MyApp project which you reference in your project for usage.