解决AndroidStudio Gradle方式引用第三方库重复依赖的问题
星光不问赶路人,时间不负有心人,
问题简述
我android项目里面有一个PictureSelector框架他自带的Gilde是4.5.0,但是我导入环信sdk,环信sdk里面也集成了一个Gilde4.9.0,导致这个环信带的Gilde4.9.0覆盖了PictureSelector框架他自带的Gilde是4.5.0,然后PictureSelector框架直接报错
具体的报错信息:
java.lang.NoSuchMethodError: No virtual method sizeMultiplier(F)Lcom/bumptech/glide/request/RequestOptions; in class Lcom/bumptech/glide/request/RequestOptions; or its super classes (declaration of 'com.bumptech.glide.request.RequestOptions' appears in /data/app/~~-y9JqSoNI8oheKzSJCFlzw==/com.hnucm.xiaotang-9r5hodOjlptUOT9ptXXl8w==/base.apk)
at com.luck.picture.lib.adapter.PictureImageGridAdapter.onBindViewHolder(PictureImageGridAdapter.java:190)
at androidx.recyclerview.widget.RecyclerView$Adapter.onBindViewHolder(RecyclerView.java:7263)
at androidx.recyclerview.widget.RecyclerView$Adapter.bindViewHolder(RecyclerView.java:7343)
解决方法
通过使用 gradle exclude 排除io.hyphenate:ease-im-kit:3.8.7 里面的Gilde4.9.0
意思是编译的时候将group为com.github.bumptech.glide 的所有library都去除在外,这样io.hyphenate:ease-im-kit:3.8.7 就会自动去引用项目里的Gilde4.5.0 包了。到此问题解决了。
implementation 'io.hyphenate:hyphenate-chat:3.8.7'
implementation ('io.hyphenate:ease-im-kit:3.8.7'){
exclude group: 'com.github.bumptech.glide', module: 'glide'
}
|