我正在尝试为我的 android 项目中的 Android FirebaseUI — Auth 编写代码,但是从最近两天开始,我在当前代码中遇到错误并且不知道如何修复它。努力尝试但没有以正确的方式发生。
这是我的 build.gradle(project:FriendlyChat)
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
mavenLocal()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.google.gms:google-services:3.0.0'
}
}
allprojects {
repositories {
jcenter()
mavenLocal()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
这是我的 build.gradle(Module:app)
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
repositories {
mavenLocal()
flatDir {
dirs 'libs'
}
}
android {
compileSdkVersion 24
buildToolsVersion "24.0.1"
defaultConfig {
applicationId "com.google.firebase.udacity.friendlychat"
minSdkVersion 16
targetSdkVersion 24
versionCode 1
versionName "1.0"
}
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(dir: 'libs', include: ['*.jar'])
// Displaying images
compile 'com.android.support:design:24.2.1'
compile 'com.android.support:appcompat-v7:24.2.1'
compile 'com.github.bumptech.glide:glide:3.6.1'
compile 'com.google.firebase:firebase-database:11.0.4'
compile 'com.google.firebase:firebase-auth:11.0.4'
compile 'com.google.android.gms:play-services-auth:11.4.0'
testCompile 'junit:junit:4.12'
}
原文由 Johon smuthio 发布,翻译遵循 CC BY-SA 4.0 许可协议
将
maven { url "https://maven.google.com" }
添加到您的根级别build.gradle
文件从 11.2.0 开始需要这个 Maven 仓库。
您也可以使用
google()
快捷方式,但在使用前检查 要求。还要注意,因为您使用的是不同的版本。 使用相同的版本。
更新
Firebase Android SDK 和 Google Play Services 库 现在有独立的版本号,允许更频繁、更灵活的更新。将 google play 服务 gradle 插件版本更新到最新版本(至少 3.3.1)。
并将库更新到 最新版本。