dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0-alpha3'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
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.0'
}
这会导致我的项目出错
错误日志:
所有com.android.support库必须使用完全相同的版本规范(混合版本可能导致运行时崩溃)。发现版本28.0.0-alpha3,26.1.0。示例包括com.android.support:animated-vector-drawable:28.0.0-alpha3和com.android.support:support-media-compat:26.1.0 less ...(Ctrl + F1)有一些库的组合,或工具和库,不兼容,或可能导致错误
Firebase-core:16.0.0
依赖关系隐式依赖于支持库26.1.0。因此,您需要通过添加相同的库但使用特定版本来覆盖它。例如:
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0-alpha3'
implementation 'com.android.support:animated-vector-drawable:28.0.0-alpha3'
implementation 'com.android.support:support-media-compat:28.0.0-alpha3'
...
implementation 'com.google.firebase:firebase-core:16.0.0'
}
注意,不要在生产代码上使用alpha版本的库。
在Project>app>build.gradle
,找到并更改它。
implementation 'com.android.support:appcompat-v7:28.0.0-alpha3'
implementation 'com.android.support:design:28.0.0-alpha3'
我也因修复此问题而遇到此错误,您应该修改build.gradle文件(Module:app),来自: 实现'com.android.support:appcompat-v7:28.0.0-alpha3'
to:implementation'comnd.android.support:appcompat-v7:28.0.0-alpha1'
我希望这能解决你的问题(为我工作)。
加上这个
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.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:customtabs:28.0.0'