Home > other >  Could not import a dependency in Kotlin project using Gradle
Could not import a dependency in Kotlin project using Gradle

Time:10-08

I would like to use a third-party library in Kotlin project.

settings.gradle:

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

build.gradle in app directory:

...
dependencies {
    ...
    implementation 'com.github.delight-im:Android-AdvancedWebView:v3.2.1'
    ...
}
...

MainActivity.kt:

...
private lateinit var webView: im.delight.android.webview.AdvancedWebView
...

The compiler is unable to find im.delight.android.webview.AdvancedWebView.

CodePudding user response:

I've tried to build and run app with this code but faced no problem. Share your error screen please

If you doubt that the dependency works, you can try to download the link directly from the jitpack. All you have to do is grab the github repository link, go to the jitpack.io website and paste the address into the search box. At the bottom there will be a list of releases, where you will need to click one of the green buttons, copy one of the resulting line and paste in dependcy, like in your description

Read the documentation for the site for details.

  • Related