TypeToken not found

I had a similar problem with an SBT project recently, and I found out that the cause was that IntelliJ had added two modules for my project instead of one, but only the one I wasn’t using had the libraries. I solved it by deleting the module without any libraries. Maybe it’s something similar here.

@Meegoo it does build when I use the commandline in the project folder, but it doesn’t when I try to do it through IntelliJ

@Katrix where should I be able to check this? As far as I see the external libraries are correct. I have no idea what kind of modules you mean :disappointed:

Try reinstalling intellij

It probably doesn’t need a reinstall; the project probably just needs a reimport. Close the project, then on the welcome screen, choose Import and select build.gradle.

@JBYoshi I tried to reimport the project, didn’t make a difference.

@KingGoesGaming I’ve reinstalled IntellIJ without result, I also reinstalled the java jdk and jre but sadly nothing has changed.

I’d probably need to inspect the project configuration itself. Could you put it on GitHub or similar (including the IntelliJ data files) and send me the link?

I took a look at it, and it seems that the only problem is selecting a custom source directory via IntelliJ when you’re using Gradle. Unless otherwise specified, Gradle assumes that all your source files are in src/main/java, so it sets up IntelliJ with that assumption. The fix is to change either IntelliJ or Gradle to use the other’s source directory. There are two ways to do that:

  1. Using the standard project structure: Refresh your Gradle project to revert src to a regular folder, then create a subfolder named main and add another subfolder to main named java. Drag your package into java and your dependencies should work properly.
  2. Changing the source directory in Gradle: Just add the line sourceSets.main.java.srcDirs = [file('src')] to your Gradle build script.
1 Like

Thank you very much!
It has been fixed, this is stuff what happens when you start using another IDE than you are used to I guess :stuck_out_tongue:
Now I can finally start coding :smiley: