【问题标题】:Gradle issue while importing Android Link Preview library导入 Android Link Preview 库时出现 Gradle 问题
【发布时间】:2023-01-04 19:33:07
【问题描述】:

我正在我的项目 (https://github.com/LeonardoCardoso/Android-Link-Preview) 中导入 Android 链接预览,但它在运行项目时给我错误

Task failed with an exception.
 -----------
* What went wrong:
Execution failed for task ':app:checkDebugDuplicateClasses'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
 > Could not find com.leocardz:link-preview:2.0.0.
 Searched in the following locations:
   - https://dl.google.com/dl/android/maven2/com/leocardz/link-preview/2.0.0/link-preview-2.0.0.pom
   - https://repo.maven.apache.org/maven2/com/leocardz/link-preview/2.0.0/link-preview-2.0.0.pom
   - https://jcenter.bintray.com/com/leocardz/link-preview/2.0.0/link-preview-2.0.0.pom
   - https://github.com/leonardocardoso/mvn-repo/raw/master/maven-deploy/com/leocardz/link-preview/2.0.0/link-preview-2.0.0.pom
 Required by:
     project :app

设置.gradle

pluginManagement {
repositories {
    gradlePluginPortal()
    google()
    mavenCentral()
    jcenter()
    maven { url 'https://github.com/leonardocardoso/mvn-repo/raw/master/maven-deploy' }
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
    google()
    mavenCentral()
    jcenter()
    maven { url 'https://github.com/leonardocardoso/mvn-repo/raw/master/maven-deploy' }
}
}


implementation 'androidx.core:core-ktx:1.7.0'
implementation 'androidx.appcompat:appcompat:1.5.1'
implementation 'com.google.android.material:material:1.6.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.navigation:navigation-fragment-ktx:2.5.1'
implementation 'androidx.navigation:navigation-ui-ktx:2.5.1'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
implementation 'org.jsoup:jsoup:1.13.1' // required
implementation 'com.leocardz:link-preview:2.0.0@aar'

【问题讨论】:

  • 有什么解决办法吗???

标签: android android-studio kotlin preview


【解决方案1】:

我解决了。您可以将库代码直接获取到您的项目中,并从 gradle 文件中删除依赖项。

https://github.com/LeonardoCardoso/Android-Link-Preview/tree/master/library/src/main/java/com/leocardz/link/preview/library

您只需将这些代码添加到您的项目中。

【讨论】:

    猜你喜欢
    • 2018-05-13
    • 2018-01-12
    • 2020-01-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-05-03
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多