无法确定androidx.appcompat:appcompat:1.0.2的工件:无缓存版本可用于离线模式

时间:2019-03-28 06:55:12

标签: android android-appcompat

等级依赖关系是:

implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'com.google.android.material:material:1.1.0-alpha05'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha3'
implementation 'androidx.vectordrawable:vectordrawable:1.1.0-alpha01'
implementation 'androidx.recyclerview:recyclerview:1.0.2'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'com.hendraanggrian.material:collapsingtoolbarlayout-subtitle:1.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'

每次清理和重建后,Gradle Project Sync都会失败。

4 个答案:

答案 0 :(得分:9)

答案 1 :(得分:0)

转到设置,然后搜索gradle。这是2种状态:

  1. 您的gradle设置为可离线使用(通过checkbo

  2. 您的gradle路径设置不正确(如果之前没有问题)

如果一切正常,请在设置页面中搜索代理并进行检查。您也可以在此处检查连接性。

这三种方法可以解决问题。

答案 2 :(得分:0)

Gradle处于离线模式,这意味着它不会进入网络来解决依赖关系。

Go to Preferences > Gradle and uncheck "Offline work".

答案 3 :(得分:0)

如果 gradle全局设置设置为离线工作,则Android Studio将无法为您解决此问题 解决这个问题

  1. 转到首选项
  2. 构建,执行,部署
  3. Gradle
  4. 全局gradle设置
  5. 取消选中离线工作
  6. 然后重建项目/尝试同步
  

确保您的互联网连接正常,否则可能无法正常工作