【发布时间】:2019-03-25 18:29:54
【问题描述】:
我尝试将我在 Android Studio 上的项目连接到 Firebase 数据库。在尝试这样做时,我在应用程序 gradle 文件中添加了一些代码行。然后我得到一个一周都解决不了的错误... 虽然这个错误我可以在模拟器上运行应用程序,所以我继续连接到 Firebase 的过程。 完成之后,我尝试向数据库中添加一些内容,但没有成功。 如果你知道如何解决这个问题,请帮助我:)
应用 gradle 文件:
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.example.rotem.bepart"
minSdkVersion 27
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
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:28.0.0'
implementation 'com.android.support:customtabs: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-auth:16.0.4'
implementation 'com.google.firebase:firebase-database:16.0.3'
implementation 'com.google.firebase:firebase-core:16.0.4'
}
apply plugin: 'com.google.gms.google-services'
错误文本:
所有 com.android.support 库必须使用完全相同的版本规范(混合版本可能导致运行时崩溃)。找到版本 28.0.0、26.1.0。示例包括 com.android.support:animated-vector-drawable:28.0.0 和 com.android.support:support-media-compat:26.1.0 less... (Ctrl+F1)
有些库或工具和库的组合不兼容,或者可能导致错误。一种这样的不兼容性是使用不是最新版本的 Android 支持库版本(或者特别是低于您的 targetSdkVersion 的版本)进行编译。问题 ID:GradleCompatible
【问题讨论】:
-
将课程移至该错误。然后按 alt + 回车。它会为你推荐正确的版本。
-
它不建议这样做。它让我可以选择“提供有关此警告的反馈”。
-
我不确定这是您的问题。请与我们分享连接代码。
标签: java firebase android-studio gradle