在学习郭神的《第一行代码》时候,在第12章中产生了标题中的包冲突问题。网上有说找到冲突的包去掉依赖,这种方法并不管用。后来才发现是新加入的一个依赖版本过高引起的。
报错的依赖:
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
testImplementation 'junit:junit:4.12'
implementation 'com.android.support:appcompat-v7:26.1.0'
compile 'com.android.support:design:24.2.1'
compile 'de.hdodenhof:circleimageview:2.1.0'
compile 'com.android.support:recyclerview-v7:26.1.0'
compile 'com.android.support:cardview-v7:26.1.0'
implementation 'com.github.bumptech.glide:glide:4.7.1'
将最后一行的4.7.1版本改为 3.7.0 就可以了,其他的都没有变化,真是太神奇了,大家如果没有其他解决的办法可以试试这种方式。
implementation ‘com.github.bumptech.glide:glide:3.7.0’