2

根据文档添加com.android.support:design'com.google.android.material:material-rc01'后,工作室未能检测到依赖项。然后我将依赖版本降级为 implementation 'com.google.android.material:material:1.1.0-alpha09'

它有效。但是为什么会出现这个问题呢?有什么解释吗?

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

错误:无法解决:com.google.android.material:material-rc01:受影响的模块:app

4

2 回答 2

13

由于您没有为实现指定版本,因此出现错误;该程序需要以下内容:

  1. 群组
  2. 要实现的依赖的名称
  3. 依赖版本

所有这些都在这里更详细地介绍

当我收到此错误消息时,我使用以下行解决了它:

implementation 'com.google.android.material:material:1.0.0-rc01'

如您所见,上面的行遵循implement 'compileGroup:name:version'列表中的模式,在例中为1.0.0-rc01; -rc01似乎是版本的名称,就像-alpha09.

另请注意,如果您之前没有指定版本,您并没有降级,这就是您的应用无法构建的原因。

于 2019-12-05T19:15:02.083 回答
6

我只是有同样的问题。我通过使用以下依赖项解决了它:

implementation "com.google.android.material:material:1.0.0"

要解决此类问题,您始终可以检查您正在寻找的库是否确实存在于 Google 的 Maven 存储库中:https ://dl.google.com/dl/android/maven2/index.html

希望有所帮助,加油!

于 2019-09-05T11:10:14.187 回答