12

I am following the tutorial to the letter; well, it's actually pretty basic so there is really nothing there. But when I created the project, the android portion is not compiling. Eclipse complains about not being able to resolve the imports. For instance there is a read line under the com.myapp.deviceinfoendpoint portion of

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

Does anyone know how to fix this? Maybe it's a build path issue but there are no instructions on how to set the build path.

I am using mac osx mountain lion and eclipse juno

Also there are red crosses on the following folders:

  • endpoint-libs/libdeviceinfoendpoint-v1/deviceinfoendpoint/deviceinfoendpoint-v1-generated-source

  • /myapp/endpoint-libs/libmessageEndpoint-v1/messageEndpoint/messageendpoint-v1-generated-source

  • /myapp/endpoint-libs (and sub folders)

and the following folders:

  • GCMIntentService.java

  • RegisterActivity.java

Pouton Gerald
  • 1,625
  • 22
  • 32
  • Do you have Deviceinfoendpoint, Builder, DeviceInfo classes in the package com.myapp.deviceinfoendpoint exactly ? – flexdroid Apr 24 '13 at 06:59
  • @flexdroid you don't sound like you know what you are asking/talking about. Have you used the GAE-eclipse-plugin? – Konsol Labapen Apr 24 '13 at 07:14
  • @KonsolLabapen no, i haven't used it, but made a comment knowing why eclipse says cannot resolve the imports. Have you used GAE-eclipse-plugin ? – flexdroid Apr 24 '13 at 07:26
  • 3
    Google has been very slow in resolving this issue. There are a number of posts here, some dating back to over a year ago about this same issue. It's aobut time that GEP works "out of the box". Maybe when Google says "bleeding edge" the translation is: extremely buggy and may give you a heart attack; use at your own risk. This plugin is way too old to be so buggy. – Konsol Labapen Apr 24 '13 at 08:53
  • 1
    @Konsol Labapen I really would like to see this fixed, but this post is 2 days old and endpoints itself is still in preview mode. Generally I find GPE and ADT to be some of the less buggy of Google products. If you wanna talk about important bugs going unfixed for years, take a look at Android! – Tom Apr 26 '13 at 14:56

2 Answers2

3

Yup, it happens with me too. The reason this happens is because some how (not sure if its Eclipse or the GAE Plugin) the classes in endpoint-libs/libdeviceinfoendpoint-v1/deviceinfoendpoint/deviceinfoendpoint-v1-generated-source

are moved from the expected structure :

./deviceinfoendpoint-v1-generated-source
    |- com
       |-myapp
           |- deviceinfoendpoint
               |- Deviceinfoendpoint.java

to invalid structure :

./deviceinfoendpoint-v1-generated-source
    |- com
       |-google
           |- api
               |- services
                   |- com.myapp.deviceinfoendpoint
                       |- Deviceinfoendpoint.java

In theory this should not happen. But, well it does! :-)

Try redoing the client library generation fresh, or try fixing them up manually.

[Update: Regenerating the Client Library again wont help. Either try the Command Line Mode.

Or a little hard way do it manually by

  1. moving all the contents of com.google.api.services/com.myapp/ package to com.myapp/.
  2. Search replace all occurances of "com.google.api.services." in all your generated java source files.

I tried this and it worked. ]


P.S: you may want to know that Google Endpoints is currently experiencing some outage. You may have to wait a while before you can test it. Keep an eye on this issue : https://code.google.com/p/googleappengine/issues/detail?id=9214

Update: It may help to refer to this Issue reported to Google : https://code.google.com/p/google-plugin-for-eclipse/issues/detail?id=117

Hari Krishna Ganji
  • 1,647
  • 2
  • 20
  • 33
  • 2
    This is pointing to that Google engineers don't even do the most basic tests on their codes. All they had to do to verify this is try to create a backbone project and see that it does not compile. This is disappointing. – Pouton Gerald Apr 24 '13 at 18:54
  • Oh, you are the same guy from the other post. So I guess you already knew about the outage. Lol! :-) – Hari Krishna Ganji Apr 24 '13 at 19:01
  • Google says they have patched a fix to the related Issue that solves this problem. You may want to give it a try now. – Hari Krishna Ganji Apr 24 '13 at 20:08
  • 1
    I meant to give the response a +1 for the piece about the outage. I am not sure how the suggested refresh would work, since I am creating a completely new project each time just to see if the plugin would work. So based on what you are saying the plugin is doing one thing and the google system is doing something else, causing a mismatch. In that case there needs to have an update to the plugin or google needs to revert to the old structure. Unless I misunderstand what you meant by `fresh generation`. Otherwise the point remains: a blank project should not need so much hacking: it's blank! – Pouton Gerald Apr 24 '13 at 20:46
  • 1
    btw, thanks for the bit about the patch (not trying to kill the messenger here). I checked for updates to the plugin (there was none); then I created a brand new GEP project. The android piece had no endpoint lib. When I tried generating the enpoints myself, I get the same mismatched endpoints. Say, is your project working fine now? How did you fix it? – Pouton Gerald Apr 24 '13 at 21:00
  • Okay, I tried it too. The fresh generation attempt did not solve the problem. Since Google has confirmed the problem here, that its the Google Servers that are messing this up: https://code.google.com/p/google-plugin-for-eclipse/issues/detail?id=117 – Hari Krishna Ganji Apr 24 '13 at 21:12
  • In an other post the Google guy confirms that the command line mode works. (I did not test). But I have successfully made manual edits to the package structure by moving the contents of `endpoint-libs/libdeviceinfoendpoint-v1/deviceinfoendpoint/deviceinfoendpoint-v1-generated-source/com/google/api/services/com.myapp/deviceinfoendpoint` to `endpoint-libs/libdeviceinfoendpoint-v1/deviceinfoendpoint/deviceinfoendpoint-v1-generated-source/com/myapp/` – Hari Krishna Ganji Apr 24 '13 at 21:18
  • let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/28845/discussion-between-hari-krishna-ganji-and-pouton-gerald) – Hari Krishna Ganji Apr 24 '13 at 21:24
0

The easiest solution is to create the project in the default location in the wizard. Then it just works (as of this writing, but it didn't use to). You can move it to wherever you want at that point.

enter image description here

You can create it in a different folder but then you'll have to:

  • Edit the modulePath entries in the descriptor.json files to remove the extra path (in my case changed com/test to com/).
  • Remove the bad generated-source folders in the java build path.
  • Add the correct generated-source folders into the java build path.

Which is pointless but included here for completeness. I admit I don't know what I'm doing in the descriptor.json files but it fixed the problem for me.

Hayes Haugen
  • 822
  • 1
  • 7
  • 7