尝试在我的项目中实现Firebase,但是“implementation 'com.google.firebase:firebase-core:16.0.1'”这一行被下划线标出。请帮忙看看。
谢谢Mbuodile Obiosio,但是没有起作用,我不知道怎么办。
谢谢Mbuodile Obiosio,但是没有起作用,我不知道怎么办。
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.example.harun.basicmathquiz"
minSdkVersion 15
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
implementation 'com.android.support:support-annotations:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.google.firebase:firebase-core:16.0.1'
implementation 'com.google.firebase:firebase-database:16.0.1'
}
apply plugin: 'com.google.gms.google-services'
与
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
classpath 'com.google.gms:google-services:4.0.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
maven { url "https://maven.google.com" }
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
我的错误:所有的 gms/firebase 库必须使用完全相同的版本规范(混合版本可能导致运行时崩溃)。发现的版本有 16.1.1、16.0.1、16.0.0、15.0.1。示例包括 com.google.firebase:firebase-analytics-impl:16.1.1 和 com.google.firebase:firebase-analytics:16.0.1。