Null Pointer Importing Gradle Project Into Eclipse

As it turns out, when importing a gradle project, there is a field called "Run After" which defaults to "afterEclipseImport". This doesn't exist unless it is defined in the project you are importing. The documentation says that if it doesn't exist then the gradle import project skips over it. Well, once I unchecked this option, the import worked correctly.

Edit: Just as an aside. This assumes that your project is in a subdirectory inside your workspace as opposed to the workspace directory itself. (See the other answer).


In case it helps someone else in the future, I had the same problem, but a different resolution. My issue was resolved when I moved the projects out of the eclipse workspace directory. It can be in another directory entirely, or in a subdirectory.

BROKEN:

/path/to/workspace/.metadata
/path/to/workspace/build.gradle
/path/to/workspace/core
/path/to/workspace/etc

WORKS:

/path/to/workspace/.metadata
/path/to/workspace/projects/build.gradle
/path/to/workspace/projects/core
/path/to/workspace/projects/etc

I did not need to remove the "afterEclipseImport" script. See this issue: https://github.com/libgdx/libgdx/issues/1537#issuecomment-38535167