Android

maven { url 'https://maven.g

2018-06-11  本文已影响62人  JaedenKil

Android studio shows Could not find runtime.aar (android.arch.lifecycle:runtime:1.0.0)., as suggested, add maven { url 'https://maven.google.com' } to file build.gradle(project level):

allprojects {
    repositories {
        maven { url 'https://maven.google.com' }
        jcenter()
        google()
    }
...
}

The weird thing is google() already exists in the gradle file.
As the document:

MavenArtifactRepository google()
Adds a repository which looks in Google's Maven repository for dependencies.
The URL used to access this repository is "https://dl.google.com/dl/android/maven2/".

Examples:

 repositories {
     google()
 }
 
Returns:
the added resolver
Since:
4.0

Seems google() is the same as maven { url 'https://maven.google.com' } as long as:

Found something:

It's actually not something to do with maven { url 'https://maven.google.com' } or google(), but something else.
These two situations will fail:

allprojects {
    repositories {
        jcenter()
        google()
    }
...
}
allprojects {
    repositories {
        jcenter()
        maven { url 'https://maven.google.com' }
    }
...
}

Meanwhile these two situations will pass:

allprojects {
    repositories {
        google()
        jcenter()
    }
...
}
allprojects {
    repositories {
        maven { url 'https://maven.google.com' }
        jcenter()
    }
...
}
上一篇 下一篇

猜你喜欢

热点阅读