解析失败:'de.greenrobot:eventbus:2.4.0'
Failed to resolve: 'de.greenrobot:eventbus:2.4.0'
我正在使用 Android Studio,但是当我尝试将:compile 'de.greenrobot:eventbus:2.4.0'
添加到我的应用程序组件的 gradle 文件中的 dependencies
时,我收到一条横幅:项目同步成功。打开 'Messages' 视图以查看发现的错误 。在消息窗格中,它显示错误消息:
Error:(28, 13) Failed to resolve: de.greenrobot:eventbus:2.4.0
<a href="openFile">Show in File</a><br><a href="open.dependency.in.project.structure">Show in Project Structure dialog</a>
检查时EventBus on github I find that the latest version does exist on maven central。
会不会是 android 工作室配置错误之类的?
下面是其余可以正常工作的依赖项(没有事件总线依赖项):
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.aiesec"
minSdkVersion 9
targetSdkVersion 22
versionCode 1
versionName "0.1"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.0.0'
compile 'com.parse.bolts:bolts-android:1.+'
compile 'com.nineoldandroids:library:2.4.0'
compile 'com.android.support:support-v4:22.0.0'
compile 'com.android.support:cardview-v7:22.0.0'
compile 'de.greenrobot:eventbus:2.4.0'
}
这很尴尬,但问题是 gradle 文件(在我项目的 root/base 文件夹中)在它的 allprojects
存储库列表中没有 mavenCentral!
所以如下所示将 mavenCentral()
添加到 allprojects
的 repositories
为我修复了 gradle 同步错误:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.2.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
mavenCentral()
}
}
我正在使用 Android Studio,但是当我尝试将:compile 'de.greenrobot:eventbus:2.4.0'
添加到我的应用程序组件的 gradle 文件中的 dependencies
时,我收到一条横幅:项目同步成功。打开 'Messages' 视图以查看发现的错误 。在消息窗格中,它显示错误消息:
Error:(28, 13) Failed to resolve: de.greenrobot:eventbus:2.4.0
<a href="openFile">Show in File</a><br><a href="open.dependency.in.project.structure">Show in Project Structure dialog</a>
检查时EventBus on github I find that the latest version does exist on maven central。
会不会是 android 工作室配置错误之类的?
下面是其余可以正常工作的依赖项(没有事件总线依赖项):
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.aiesec"
minSdkVersion 9
targetSdkVersion 22
versionCode 1
versionName "0.1"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.0.0'
compile 'com.parse.bolts:bolts-android:1.+'
compile 'com.nineoldandroids:library:2.4.0'
compile 'com.android.support:support-v4:22.0.0'
compile 'com.android.support:cardview-v7:22.0.0'
compile 'de.greenrobot:eventbus:2.4.0'
}
这很尴尬,但问题是 gradle 文件(在我项目的 root/base 文件夹中)在它的 allprojects
存储库列表中没有 mavenCentral!
所以如下所示将 mavenCentral()
添加到 allprojects
的 repositories
为我修复了 gradle 同步错误:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.2.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
mavenCentral()
}
}