【问题标题】:Grade sync failed: Unresolved dependencies成绩同步失败:未解决的依赖关系
【发布时间】:2020-07-09 17:46:36
【问题描述】:

我尝试将我在 android studio 中的项目与 gradle 文件同步,但它失败了,我收到了上面的消息“Grade sync failed: Unresolved dependencies”。

我在构建选项卡中也遇到了这些错误:

  1. 错误:无法解析 ':app@debugUnitTest/compileClasspath' 的依赖关系:无法解析 androidx.fragment:fragment:[1.2.0]。
    显示详情
    受影响的模块:app
  2. 错误:无法解析 ':app@debugAndroidTest/compileClasspath' 的依赖关系:无法解析 androidx.fragment:fragment:[1.2.0]。
    显示详情
    受影响的模块:app
  3. 错误:无法解析 ':app@debug/compileClasspath' 的依赖关系:无法解析 androidx.fragment:fragment:[1.2.0]。
    显示详情
    受影响的模块:app

这些是我在 build.gradle (Module:app) 中的依赖项

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.core:core-ktx:1.2.0'
implementation 'com.google.android.material:material:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.navigation:navigation-fragment-ktx:2.2.1'
implementation 'androidx.navigation:navigation-ui-ktx:2.2.1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'

implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.5'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.5'
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.2.0'

【问题讨论】:

  • 删除实现 'androidx.navigation:navigation-fragment-ktx:2.2.1'
  • @MohammadMoeinGolchin 我删除了实现 'androidx.navigation:navigation-fragment-ktx:2.2.1' ,但是在我仍然得到一个错误之后:错误:无法解决对 ':app@debug 的依赖/compileClasspath':无法下载 fragment.aar (androidx.fragment:fragment:1.1.0) 显示详细信息 受影响的模块:app

标签: android android-studio android-fragments kotlin kotlin-coroutines


【解决方案1】:

嘿,我不太确定,我没有找到片段的任何依赖项

dependencies {
    def fragment_version = "1.2.4"

    // Java language implementation
    implementation "androidx.fragment:fragment:$fragment_version"
    // Kotlin
    implementation "androidx.fragment:fragment-ktx:$fragment_version"
    // Testing Fragments in Isolation
    implementation "androidx.fragment:fragment-testing:$fragment_version"

}

把它放在依赖部分

【讨论】:

    猜你喜欢
    • 2018-11-20
    • 2014-08-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-12-28
    • 2011-11-30
    • 1970-01-01
    • 2016-03-26
    相关资源
    最近更新 更多