[英]Unable to build firebase gradle in Android studio
I am adding Firebase database gradle into my Android Project, but gradle is unable to build.I added Firebase gradle in my app gradle and one google gradle in Project gradle I am getting this message: 我正在将Firebase数据库gradle添加到我的Android项目中,但gradle无法构建。我在我的应用程序gradle中添加了Firebase gradle,在Project gradle中添加了一个google gradle我收到此消息:
this is my app gradle 这是我的应用程序gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.3"
defaultConfig {
applicationId "iamrajendra.github.io"
minSdkVersion 15
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:design:25.3.1'
testCompile 'junit:junit:4.12'
compile 'com.google.firebase:firebase-database:11.0.2'
}
and this is my project gradle 这是我的项目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.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()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
I solved the problem. 我解决了这个问题。 the problem is the version of library 问题是库的版本
working library 工作图书馆
implementation'com.google.firebase:firebase-database:10.0.0'
If the tutorial android library version is 11.01 but this version is not working in android studio 如果教程android库版本是11.01但这个版本在android studio中不起作用
not working library 不工作的图书馆
com.google.firebase:firebase-database:11.0.2
In tutorial gradle dependencies are wrongly written. 在教程中,gradle依赖项被错误地写入。
https://firebase.google.com/docs/android/setup https://firebase.google.com/docs/android/setup
在你的应用程序gradle中的最后一行下面添加它..在文件的底部
apply plugin: 'com.google.gms.google-services'
You can try this dependencies, 你可以尝试这种依赖,
// FirebaseUI Database only compile 'com.firebaseui:firebase-ui-database:2.0.1' // FirebaseUI数据库只编译'com.firebaseui:firebase-ui-database:2.0.1'
// Single target that includes all FirebaseUI libraries above compile 'com.firebaseui:firebase-ui:2.0.1' //包含编译'com.firebaseui:firebase-ui:2.0.1'之上的所有FirebaseUI库的单个目标
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.