kotlinandroid-studiogradle

the character literal does not conform to the expected URI type


I have been trying to build a project in android studio using kotlin and I get this error

Could not resolve all files for configuration ':app:debugRuntimeClasspath'.

I've searched stackoverflow and it says to put this in setting.gradle

dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        google()
        mavenCentral()
        maven { url='https://jitpack.io'} <------
    }
}

But when I try to do it I get this error

the character literal does not conform to the expected URI type

What is the correct uri type and will that solve the problem? Thank you


Solution

  • You are pasting a Groovy DSL instruction into a Kotlin DSL file, that cannot work. In Kotlin single-quotes are around a single-character literal, not around a String.

    Besides that, whether adding the conceptually broken, slow, implementally broken, slow, flaky, and slow JitPack repository to your build will fix your problem noone here can guess, as you did not share further details on what was not found or what the actual full error is.

    Where you copied that snippet from, the asker probably tried to use a dependency that is only available on JitPack but did not add the JitPack repository. So it is not really very likely that it will solve your problem, even if you overcome the Groovy DSL / Kotlin DSL difference.