简体   繁体   中英

Could not import a dependency in Kotlin project using Gradle

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 .

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM