Udi*_*ahi 39 android gradle android-studio android-gradle-plugin android-studio-3.1
我最近将Android Studio更新为3.1.2.更新后,我尝试打开现有项目,并在编译项目时显示多个gradle错误.
这些错误指出我将'compile'语句更新为'implementation',我做了,仍然遇到了一些错误,我后来通过将我的google play和firebase sdks更新到最新版本来解决这些错误.
现在我不知道为什么我的IDE会出现以下错误(请看截图).
无法解决:运行时
现在我做了Build> Clean Project
错误是找不到runtime.aar(android.arch.lifecycle:runtime:1.0.3).
屏幕截图

接下来做什么?
解:
小智 65
是的,
如果您收到错误运行时的错误,您可以更改构建中依赖项中google()的位置.gradle ..如下所示:
repositories {
google()
jcenter()
}
Run Code Online (Sandbox Code Playgroud)
添加maven { url 'https://maven.google.com' }为llprojects/repositories顶级中的第一个条目build.gradle
像这样:
allprojects {
repositories {
maven { url 'https://maven.google.com' }
google()
maven { url "https://jitpack.io" }
jcenter()
}
}
Run Code Online (Sandbox Code Playgroud)
小智 5
android.arch.lifecycle:runtime可以在Google maven存储库中找到.确保在存储库的存储库块中添加存储库build.gradle
allprojects {
repositories {
jcenter()
google()
}
}
Run Code Online (Sandbox Code Playgroud)
要么
allprojects {
repositories {
jcenter()
maven { url "https://maven.google.com" }
}
}
Run Code Online (Sandbox Code Playgroud)
参考: 向项目添加组件
请在build.gradle(项目:projectName)中按照相同的顺序(依次)进行操作,问题将消失
buildscript {
repositories { // keep same this order
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
// can add your other compile types here
}
}
allprojects { // keep same this order
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
11629 次 |
| 最近记录: |