[英]implementation 'com.android.support:appcompat-v7:28.0.0' - Error
[英]“com.android.support:appcompat-v7:28.0.0” Error
每當我添加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'
}
“所有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'
}
添加依賴implementation 'com.android.support:support-v4:28.0.0'
以及implementation 'com.android.support:appcompat-v7:28.0.0'
支持庫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'
}
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'
這對我有用
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.