问题更新:在与教程的创建者交谈后,我正在尝试使用Firebase创建实时聊天。他告诉我改变你的Gradle编译com.google.firebase:firebase-core:9.4.0' 编译com.google.firebase:firebase-database:9.4.0'
如果是这种情况,为了使用这个9.4.0版本,我需要在依赖项中进行哪些更改?
// 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.3.3'
classpath 'com.google.gms:google-services:3.1.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
maven { url 'https://maven.fabric.io/public' } // <= ADD THIS
maven {
url "https://maven.google.com"
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Below is the Module:app Gradle
Here is where I am trying to compile the Firebase UI in order to make a chat application within my app:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "26.0.1"
defaultConfig {
applicationId "com.example.aids.a09application"
minSdkVersion 16
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
aaptOptions.cruncherEnabled = false
aaptOptions.useNewCruncher = false
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
android {
useLibrary 'org.apache.http.legacy'
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.google.firebase:firebase-core:11.2.0'
compile 'com.google.firebase:firebase-messaging:11.2.0'
compile 'com.android.support:appcompat-v7:26.0.1'
compile 'com.google.android.gms:play-services-maps:11.2.0'
compile 'com.google.firebase:firebase-auth:11.2.0' // ADDED
compile 'com.google.android.gms:play-services-auth:11.2.0' // ADDED
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:design:26.0.1'
compile 'com.android.support:support-v4:26.0.1'
compile 'com.android.support:recyclerview-v7:26.0.1'
compile 'com.google.firebase:firebase-database:9.4.0'
compile 'com.google.firebase:firebase-core:9.4.0'
}
apply plugin: 'com.google.gms.google-services'
这是我现在得到的错误:
Error:Execution failed for task ':app:processDebugGoogleServices'.
> Please fix the version conflict either by updating the version of the google-services plugin (information about the latest version is available at https://bintray.com/android/android-tools/com.google.gms.google-services/) or updating the version of com.google.android.gms to 11.2.0.
答案 0 :(得分:1)
由于您使用的是com.android.support:customtabs:26.0.1
,因此您必须添加repositories
“https://maven.google.com”端点。
自25.4.0以来的所有支持库都在google maven repo中作为described here。
在你的情况下,像;
allprojects {
repositories {
jcenter()
maven { url 'https://maven.fabric.io/public' } // <= ADD THIS
maven {
url "https://maven.google.com"
}
}
}
此外,如果您想添加最新的 Firebase库v.11.2.0 ,您必须添加与described here相同的回购。
答案 1 :(得分:1)
要在FirebaseUI 2.3.0中使用版本11.2.0的Firebase库,您必须按如下方式更新依赖项:
compile 'com.google.firebase:firebase-core:11.2.0'
compile 'com.google.firebase:firebase-messaging:11.2.0'
compile 'com.android.support:appcompat-v7:26.0.1'
compile 'com.google.android.gms:play-services-maps:11.2.0'
compile 'com.google.firebase:firebase-auth:11.2.0' // ADDED
compile 'com.google.android.gms:play-services-auth:11.2.0' // ADDED
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:design:26.0.1'
compile 'com.android.support:support-v4:26.0.1'
compile 'com.android.support:recyclerview-v7:26.0.1'
compile 'com.firebaseui:firebase-ui-auth:2.3.0'
需要添加firebase-auth
和play-services-auth
,因为尚未提供使用11.2.0构建的FirebaseUI版本。这在FirebaseUI documentation。
您还应该进行以下更改:
compileSdkVersion 26
buildToolsVersion "26.0.1"
compileSdkVersion 26
的要求位于Google Play Services Release Notes:
将应用的Play服务依赖项升级到11.2.0或 之后,您的应用程序的build.gradle也必须更新以指定 compileSdkVersion至少为26(Android O)
答案 2 :(得分:0)
如果尚未安装,则必须转至SDK Manager并下载API 26(Android 8.0)的SDK平台文件。然后将所有支持库文件更新到版本26.0.1,例如编译'com.android.support:design:25.3.1'以编译'com.android.support:design:26.0.1'等等。您还需要将compileSdkVersion 25更改为26,将buildToolsVersion“25.0.2”更改为“26.0.1”,将targetSdkVersion 25更改为26.并将maven“https://maven.google.com”添加到存储库
Firebase正在寻找版本26.0.1的支持库。由于没有安装或者你的buildToolsVersion和compileSdkVersion没有指向它,gradle无法解决它们。