作者:靖憐兵役_523 | 来源:互联网 | 2022-12-07 09:36
ll com.android.support库必须使用完全相同的版本
规范(混合版本可能导致运行时崩溃)。找到版本28.0.0-alpha1,26.1.0。示例包括com.android.support:animated-vector-drawable:28.0.0-alpha1和com.android.support:customtabs:26.1.0 less ...(Ctrl + F1)有一些库,工具或不兼容的库,或可能导致错误的库。一种不兼容的情况是使用不是最新版本的Android支持库版本进行编译(或者特别是低于目标targetSdkVersion的版本)。
我的gradle依赖项:-
implementation 'com.google.firebase:firebase-ads:15.0.1'
implementation 'com.google.firebase:firebase-core:16.0.1'
关于此依赖项的警告-----------------------------
implementation 'com.android.support:appcompat-v7:28.0.0-alpha1'
testImplementation 'junit:junit:4.12'
implementation 'com.google.android.gms:play-services-vision:15.0.2'
implementation 'com.theartofdev.edmodo:android-image-cropper:2.3.+'
implementation 'com.memetix:microsoft-translator-java-api:0.6.2'
implementation 'com.google.firebase:firebase-crash:16.0.1'
implementation 'com.facebook.android:audience-network-sdk:4.+'
>
1> Rifat..:
某人正在使用较旧的库,而罪魁祸首是firebase-core:16〜;
经过多次试验,我解决了这个问题。
从这个答案和这个答案,我解决了错误。
您需要手动添加有冲突的依赖项。(要找到冲突的依赖关系,一种简单的方法是将鼠标悬停在突出显示的错误上。)您可以将appcompat库降级为不建议使用的给定/提示库,也可以手动声明这些依赖关系。
我今天将此代码与所有更新的库一起使用,并解决了错误:
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0-rc01'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
//this thing is carusing error, to solve - see hints and manually add them.
implementation 'com.google.firebase:firebase-core:16.0.1'
implementation 'com.android.support:support-media-compat:28.0.0-rc01'
implementation 'com.android.support:support-v4:28.0.0-rc01'
//implementation 'com.android.support:appcompat-v7:25.2.0'
/*implementation ("com.google.firebase:firebase-core:16.0.1"){
exclude group: 'com.android.support'
}
*/
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'
}
这种行为使新开发人员感到头疼。
如果这可以解决您的问题,也请告知其他人。快乐的编码。
更新。
注意:不要忘记检查是否有其他库添加到项目中导致警告。
其工作证明。