【发布时间】:2018-08-04 11:39:03
【问题描述】:
以下是我的 gradle 文件:
apply plugin: 'com.android.application'
apply plugin: 'realm-android'
apply plugin: 'io.fabric'
android {
compileSdkVersion 27
buildToolsVersion "27.0.3"
defaultConfig {
applicationId "???"
minSdkVersion 21
targetSdkVersion 27
versionCode 4
versionName "1.02"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
realm {
syncEnabled = true
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation project(':EBS')
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
implementation 'com.android.support:gridlayout-v7:27.1.1'
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.afollestad.material-dialogs:commons:0.9.6.0'
implementation 'com.android.support:cardview-v7:27.1.1'
implementation 'com.android.support:recyclerview-v7:27.1.1'
implementation 'com.squareup.retrofit2:retrofit:2.4.0'
implementation 'com.squareup.retrofit2:converter-gson:2.4.0'
implementation 'com.daimajia.swipelayout:library:1.2.0@aar'
implementation 'com.google.firebase:firebase-messaging:17.1.0'
implementation 'com.google.firebase:firebase-core:16.0.1'
implementation 'com.crashlytics.sdk.android:crashlytics:2.9.4'
implementation 'com.github.amlcurran.showcaseview:library:5.4.3'
}
apply plugin: 'com.google.gms.google-services'
// 顶级构建文件,您可以在其中添加所有子项目/模块通用的配置选项。
buildscript {
repositories {
google()
jcenter()
maven {
url 'https://maven.fabric.io/public'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3'
classpath "io.realm:realm-gradle-plugin:5.4.1"
classpath 'com.google.gms:google-services:4.0.2'
classpath 'io.fabric.tools:gradle:1.25.4'
classpath 'com.google.android.gms:strict-version-matcher-plugin:1.0.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
maven {
url 'https://jitpack.io'
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
在这里,我在我的项目中都添加了 firebase 核心和 firebase 消息传递,但我面临
"所有 gms/firebase 库必须使用完全相同的版本 规范(混合版本可能导致运行时崩溃)。成立 版本 17.1.0、16.2.0、16.1.1、16.0.1、16.0.0、15.0.1。例子 包括 com.google.firebase:firebase-messaging:17.1.0 和 com.google.firebase:firebase-iid:16.2.0 少... (⌘F1) 有一些库或工具和库的组合是不兼容的,或者可能导致错误。一种这样的不兼容 正在编译的 Android 支持库版本是 不是最新版本(或者特别是低于您的版本 targetSdkVersion.)"
你能帮我解决这个问题吗?
【问题讨论】:
-
您是否尝试过清理您的项目?
-
我试过了,没用。
标签: android firebase android-gradle-plugin dependencies firebase-cloud-messaging