Firebase Android在依赖项中显示错误
我正在尝试使用Firebase创建一个实时数据库。我遵循了原则,但显示出错误 我的build.gradle应用程序如下所示:Firebase Android在依赖项中显示错误,android,android-studio,firebase,firebase-realtime-database,Android,Android Studio,Firebase,Firebase Realtime Database,我正在尝试使用Firebase创建一个实时数据库。我遵循了原则,但显示出错误 我的build.gradle应用程序如下所示: apply plugin: 'com.android.application' android { compileSdkVersion 24 buildToolsVersion "24.0.3" defaultConfig { applicationId "com.example.ashik.project" mi
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "24.0.3"
defaultConfig {
applicationId "com.example.ashik.project"
minSdkVersion 17
targetSdkVersion 24
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE-FIREBASE.txt'
exclude 'META-INF/NOTICE'
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:multidex:1.0.1'
compile "com.squareup.picasso:picasso:2.4.0"
compile 'com.google.firebase:firebase-core:9.0.2'
compile 'com.google.firebase:firebase-database:9.0.2'
compile 'com.android.support:appcompat-v7:24.0.0'
compile 'com.android.support:support-v4:24.0.0'
compile 'com.android.support:design:24.0.0'
compile 'com.firebase:firebase-client-android:2.5.2+'
compile 'com.firebaseui:firebase-ui:0.3.1'
compile 'com.github.dakatso:livebutton:1.0.0'
compile 'com.jakewharton:butterknife:7.0.1'
compile 'com.squareup.picasso:picasso:2.4.0'
compile 'de.hdodenhof:circleimageview:2.1.0'
compile 'com.balysv:material-ripple:1.0.2'
compile 'com.github.dmytrodanylyk.circular-progress-button:library:1.1.3'
compile 'com.android.support:multidex:1.0.1'
compile 'com.google.android.gms:play-services:9.0.2'
compile 'com.google.android.gms:play-services-ads:9.0.2'
compile 'com.google.android.gms:play-services-auth:9.0.2'
compile 'com.google.android.gms:play-services-gcm:9.0.2'
compile 'org.jsoup:jsoup:1.10.1'
compile 'com.facebook.stetho:stetho-okhttp:1.4.1'
androidTestCompile 'org.hamcrest:hamcrest-library:1.3'
}
apply plugin: 'com.google.gms.google-services'
还有我的build.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:2.2.1'
classpath 'com.google.gms:google-services:3.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
在控制台中显示错误:
Error:FAILURE: Build failed with an exception.
- 出了什么问题: 配置项目“:app”时出现问题 无法解析配置“”的所有依赖项:应用:_debugApkCopy。 无法解析com.firebase:firebase客户端android:2.5.2+。 要求: 项目:应用程序:未指定 无法解析com.firebase:firebase客户端android:2.5.2+。 未能列出com.firebase:firebase客户端android的版本。 无法从加载Maven元数据。 无法获取“”。 jcenter.bintray.com
- 尝试: 使用--stacktrace选项运行以获取堆栈跟踪。使用--debug选项运行以获得更多日志输出
compile 'com.firebase:firebase-client-android:2.5.2+'
与
或
看起来你一半在使用Firebase 2.x(com.Firebase…),一半在使用Firebase 3.x(com.google.Firebase…) 也许这两者相互冲突并导致错误
应该有助于您切换。我觉得gradle似乎无法识别此库'com.firebase:firebase客户端android:2.5.2+'…是否真的有必要?如果没有,请尝试删除其依赖项,以查看构建是否成功
compile 'com.firebase:firebase-client-android:2.3.1'
compile 'com.firebase:firebase-client-android:2.4.0'