java - Android gradle 在创建 androidx 项目后无法立即解析核心
问题描述
我正在 android studio 3.3 中使用 androidx 创建一个新的 android 项目,并且在项目创建后立即出现以下错误
ERROR: Failed to resolve: core
Affected Modules: app
ERROR: Failed to resolve: collection
Affected Modules: app
ERROR: Failed to resolve: annotation
Affected Modules: app
ERROR: Failed to resolve: lifecycle-common
Affected Modules: app
ERROR: Failed to resolve: core-common
Affected Modules: app
我已经下载了最新的谷歌支持存储库,gradle 4.10.1,gradle android tools 3.3.0,我还检查了我对 maven.google.com 和 jcenter.bintary.com 的访问,这很好。
我还清理了项目并重新启动了 android studio,但它们都没有工作
我的依赖:
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.0.0-beta01'
implementation 'androidx.constraintlayout:constraintlayout:1.1.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.0-alpha4'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0-alpha4'
和所有项目存储库:
google()
jcenter()
maven { url "https://jitpack.io" }
mavenCentral()
不幸的是,错误不清楚,我不知道这是怎么回事,谢谢你的帮助
解决方案
错误是由于 android studio 的默认 androidx 依赖版本,我将依赖项更改为:
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.0-alpha4'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0-alpha4'
}
它现在工作正常。我从这里得到这些版本
推荐阅读
- python - Python DictWriter 使用循环和 if else 条件在输入文件的列中附加状态
- html - 试图通过抓取找到超链接
- android - Android 下载管理器“下载失败”
- class - 涉及模板化表单时的 UML 类图
- python - 使用 djongo 从 django 应用程序更新 mongodatabase 集合时出错
- java - Java:如何修复 Itext PdfReader 找不到方法 getPageN(int pageNumber)?
- java - 在 Android 的 SQL Server 中保存数据的异步任务
- css - 使用网格区域的 CSS 网格动画
- python - 套接字项目未连接
- python - 有没有理由在 python asyncio 中`return await ...`?