我正在尝试将我的android项目连接到firebase。启动时它也正常工作。我不知道突然之间发生了什么,我遇到了一系列未解决的依赖项。
我已经完成了网上发现的几乎所有步骤。像禁用离线工作一样,使检查/重启无效。即使在创建新项目时,我也面临着同样的问题。早些时候,所有事情都没有发生。
我的应用程序gradle代码是:
// 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.2.1'
classpath 'com.google.gms:google-services:4.0.1'
}
}
allprojects {
repositories {
google()
maven { url "http://jcenter.bintray.com"}
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
模块的build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.aabsys.metasensing"
minSdkVersion 21
targetSdkVersion 28
versionCode 1
versionName "2.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'])
//noinspection GradleCompatible
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.google.firebase:firebase-core:16.0.1'
implementation 'com.google.firebase:firebase-messaging:17.3.0'
implementation 'com.squareup.retrofit2:retrofit:2.4.0'
implementation 'com.squareup.retrofit2:converter-gson:2.4.0'
}
apply plugin: 'com.google.gms.google-services'
提前谢谢。Please find image
答案 0 :(得分:0)
尝试在代码中添加以下依赖项:-
implementation 'com.google.android.gms:play-services:12.0.1'
答案 1 :(得分:0)
尝试更改课程路径
classpath 'com.google.gms:google-services:4.2.0'
答案 2 :(得分:0)
我通过将google服务版本降低到来解决了我的问题:
classpath 'com.google.gms:google-services:4.0.0'
并删除
implementation 'com.google.firebase:firebase-core:16.0.1'