> For the complete documentation index, see [llms.txt](https://polyv.gitbook.io/document/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://polyv.gitbook.io/document/docs/live/solution/common-problem/android/library_conflict.md).

# 架包与so库冲突

## 一.架包冲突

常见冲突的架包为okhttp、okio、glide、gson、zip4j等。

以glide为例：

```
报错信息：
java.lang.NoSuchMethodError No virtual method placeholder(I)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/com.sdym.jinlixuexi-THEnfkL_rUo8HozNpZ2cGw==/base.apk)
```

### 方案一：

将项目中各个引入相同库的版本改为一致。

### 方案二：

排除掉多场景SDK中的库，导入项目中需要的版本，如下：

```
api('net.polyv.android:polyvSDKLiveScenes:1.10.8') {
        exclude group:'com.github.bumptech.glide',module:'glide'
    }
implementation 'com.github.bumptech.glide:okhttp3-integration:xx.xx.xx'
```

## 二.so库冲突

常见的so库冲突为libc++\_shared.so库

```
报错信息：
2 files found with path 'lib/arm64-v8a/ibc++-shared.so' from inputs:If you are using jniLibs and CMake IMPORTED targets, seehttps://developer.android.com/r/tools/jniLibs-vs-imported-targets
C:\sers Administratorl.gradle caches transfoms-3 3145107184bd587ba19fcadd7645transfomedjetified-mediaplayer-FuL-1,1.1 jnlar64-8e Libc+-_sthared.st
C: Users Adinistrator).grdlecaches transfom-\705ecaad84efaed5edddf21db transfomed jetified-pdfium-androd-1.90jnam64-vBa libc++-shared.s
```

### 解决方案：

```
在defaultConfig中加入packagingOptions选项:

packaging0ptions {
//下面为实际重复导致报错的so文件
pickFirst 'lib/arm64-v8a/libc++_shared.so
pickFirst 'lib/armeabi-v7a/libc++_shared.so
pickFirst 'lib/x86/libc++_shared.so'
pickFirst 'lib/x86_64/libc++_shared.so'
}
```
