Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

Hello im trying to make a mod and the past few days GSON has almost killed me, when i export the mod and then launch it through minecraft launcher i get

java.lang.NoSuchMethodError: com.google.gson.JsonParser.parseString(Ljava/lang/String;)Lcom/google/gson/JsonElement;

i have literally tried everything here is my build config
 

dependencies {
    minecraft("com.mojang:minecraft:1.8.9")
    mappings("de.oceanlabs.mcp:mcp_stable:22-1.8.9")
    forge("net.minecraftforge:forge:1.8.9-11.15.1.2318-1.8.9")

    compileOnly("cc.polyfrost:oneconfig-1.8.9-forge:0.2.2-alpha+")
    shadowImpl("cc.polyfrost:oneconfig-wrapper-launchwrapper:1.0.0-beta+") {
        isTransitive = false
        exclude(module = "gson")
    }

    shadowImpl("org.spongepowered:mixin:0.7.11-SNAPSHOT") {
        isTransitive = false
        exclude(module = "gson")
    }
    annotationProcessor("org.spongepowered:mixin:0.8.5-SNAPSHOT")

    shadowImpl("org.javassist:javassist:3.15.0-GA") {
        isTransitive = false
        exclude(module = "gson")
    }
    shadowImpl("com.neovisionaries:nv-i18n:1.28") {
        isTransitive = false
        exclude(module = "gson")
    }

    shadowImpl("org.apache.commons:commons-lang3:3.4") {
        isTransitive = false
        exclude(module = "gson")
    }
    shadowImpl("org.apache.httpcomponents:httpcore:4.4.5") {
        isTransitive = false
        exclude(module = "gson")
    }

    compileOnly("com.google.code.gson:gson:2.8.6") { isTransitive = false }

    configurations.all { resolutionStrategy { force("com.google.code.gson:gson:2.8.6") } }
    shadowImpl(fileTree(
        mapOf(
            "dir" to "libs",
            "include" to listOf("*.jar"),
            "exclude" to listOf(
                "asm",
                "asm-commons",
                "asm-tree",
                "gson",
                "unspecified",
                "nv-i18n"
            )
        )
    ))
}

 

The conflict arises from discrepancies between different versions of GSON.


My suggestion would be to remove your dependency on GSON 2.8.6 and opt for a different approach. Instead of using the static method JsonParser.parseString, you can create a JsonParser object and then use the parse method.

 

JsonParser jsonParser = new JsonParser();
jsonParser.parse(jsonString)

 

Edited by bluedisgusted
-

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.