“ com.android.support:appcompat-v7:28.0.0”错误

时间:2019-04-04 06:34:22

标签: android firebase-realtime-database

每当我添加Firebase数据库依赖项时,它就会显示appcompat错误。

“所有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“

   dependencies {
        implementation fileTree(dir: 'libs', include: ['*.jar'])
        implementation 'com.android.support:appcompat-v7:28.0.0'
        implementation 'com.android.support.constraint:constraint- 
        layout:1.1.3'
        implementation 'com.google.firebase:firebase-database:16.1.0'
        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'
   }

3 个答案:

答案 0 :(得分:1)

  

“所有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“

解决方案::将com.android.support:support-v4:28.0.0依赖项添加到gradle文件中。

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support.constraint:constraint- 
    layout:1.1.3'
    implementation 'com.google.firebase:firebase-database:16.1.0'
    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'

    // Add this line
    implementation 'com.android.support:support-v4:28.0.0'
}

答案 1 :(得分:0)

将依赖项implementation 'com.android.support:support-v4:28.0.0'implementation 'com.android.support:appcompat-v7:28.0.0'一起添加

Support Library 28.0.0的稳定版本也是android.support包装下的最后一个功能版本,鼓励开发人员迁移到AndroidX

  android {
  compileSdkVersion 28
  buildToolsVersion "28.0.3"


 defaultConfig {
 applicationId "com.your_project_name"
 minSdkVersion 23
 targetSdkVersion 28
 versionCode 1
 multiDexEnabled true
 testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}

 dependencies {
 implementation fileTree(dir: 'libs', include: ['*.jar'])
 implementation 'com.android.support:appcompat-v7:28.0.0'
 implementation 'com.android.support:support-v4:28.0.0'
 implementation 'com.android.support:design:28.0.0'
 implementation 'com.android.support:cardview-v7:28.0.0'
 implementation 'com.android.support:recyclerview-v7:28.0.0'
 implementation 'com.android.support.constraint:constraint- 
    layout:1.1.3'
 implementation 'com.google.firebase:firebase-database:16.1.0'
 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.crashlytics.sdk.android:crashlytics:2.9.5' 
 }

答案 2 :(得分:0)

implementation 'com.android.support:support-media-compat:28.0.0'

implementation 'com.android.support:support-v4:28.0.0'

添加到依赖项并进行更改

implementation 'com.google.firebase:firebase-database:16.1.0'

implementation 'com.google.firebase:firebase-database:9.0.2'

这对我有用