15

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" }
}

}

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
ahmed mostafa
  • 197
  • 2
  • 12
  • 4
    You are using Groovy syntax in a Kotlin script Gradle file. Try `maven { url = uri("https://jitpack.io") }`. See [the Gradle documentation](https://docs.gradle.org/current/userguide/declaring_repositories.html#sec:maven_repo). – CommonsWare Aug 09 '20 at 23:25
  • @CommonsWare thanks it works with me – ahmed mostafa Aug 09 '20 at 23:30

1 Answers1

36

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") }
CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491