androidgradlejitpack

Unexpected tokens (use ';' to separate expressions on the same line) in build.gradle.kts


that is a screen shot of the error message

I can't add jitpack to build.gradle.kts it shows an error " Unexpected tokens (use ';' to separate expressions on the same line) "

allprojects {
repositories {
    google()
    jcenter()
    maven { url "https://jitpack.io" }
}

}


Solution

  • Support for Kotlin Gradle scripts is fairly new in Android — for example, Android Studio only added support for it in version 4.0. Most of the instructions that you will see online will be for Groovy Gradle scripts, and you will need to make some minor conversions.

    In this case, this Groovy:

    maven { url "https://jitpack.io" }
    

    ...turns into this Kotlin:

    maven { url = uri("https://jitpack.io") }