java.lang.NoSuchMethodError with GSON parseString
See original GitHub issueI saw issue #224 and I tried the solution in there, and that did not work. I invalidated/restarted my IntelliJ cache, I tried to remove the GSON library I was using and used the one that the JAR downloaded when I put it into my build.gradle, nothing seems to have worked.
I am using v6.5.4 as that is the last version (that I’m aware of) that is compiled with Java 8.
Here is where the problem is:
AuthorizationCodePKCERequest authorizationCodePKCERequest = api.authorizationCodePKCE(code, VERIFIER).build();
try {
AuthorizationCodeCredentials credentials = authorizationCodePKCERequest.execute();
After I run .execute() it throws an exception:
Exception in thread "Thread-15" java.lang.NoSuchMethodError: com.google.gson.JsonParser.parseString(Ljava/lang/String;)Lcom/google/gson/JsonElement;
at com.wrapper.spotify.SpotifyHttpManager.getResponseBody(SpotifyHttpManager.java:296)
at com.wrapper.spotify.SpotifyHttpManager.post(SpotifyHttpManager.java:183)
at com.wrapper.spotify.requests.AbstractRequest.postJson(AbstractRequest.java:123)
at com.wrapper.spotify.requests.authorization.authorization_code.pkce.AuthorizationCodePKCERequest.execute(AuthorizationCodePKCERequest.java:37)
Which I find weird, because when opening it up in IntelliJ Ctrl + Click, it… doesn’t have any errors? And Ctrl + Clicking parseString brings me to the method it otherwise could not find?

The request works fine, as I did some testing before trying to get the authorization codes and the callback worked fine, and I was able to get the code + the window opens to authorize with my application.
Any pointers? I’m genuinely confused and I’m entirely lost.
Edit: Proof that I can get the code just fine:

Issue Analytics
- State:
- Created a year ago
- Comments:7 (3 by maintainers)
Top Related StackOverflow Question
I tried what I suggested, and that did not work either.
I thank you for trying to help me though! I’ll keep this issue open in case I find a fix, unless you’d like to close it.
So update on this, I recently upgraded to Java 17 and it seems to work now, thanks for all of the help. It just seems like for some reason it didn’t like java 8