
问题信息
Duplicate class com.github.barteksc.pdfviewer.PDFView found in modules jetified-AndroidPdfViewer-3.1.0-beta.3-runtime (com.github.TalbotGooday:AndroidPdfViewer:3.1.0-beta.3) and jetified-android-pdf-viewer-2.8.2-runtime (com.github.barteksc:android-pdf-viewer:2.8.2)
哇哦,搞Android开发经常遇到的问题,这类问题不大,先分析好相关的依赖,然后排除冲突
 
问题定位
从出错信息上,分别看是那里引入如下两个库
 1、com.github.TalbotGooday:AndroidPdfViewer
 
2、com.github.barteksc:android-pdf-viewer
 
 从上面可以看出我们是一个RN第三方库,依赖一个库,跟某个我们自己的原生模块直接依赖的com.github.barteksc:android-pdf-viewer存在类的冲类!
 我们先看下TalbotGooday是怎么样的存在
 
 再看下com.github.barteksc

 很明显com.github.TalbotGooday:AndroidPdfViewer大概率是从com.github.barteksc fork的代码,然后改了groupid与artifact-Id发了个maven库!!!
 我们去看下他的源码库,一切正相浮出水面了,如下!

 我这边的解决方案是,自己APP工程的原生模块先依赖回react-native-pdf引用的TalbotGooday
有趣地方
其实react-native-pdf库开发者,有提到过!在他引用TalbotGooday时
 
 然后我们还可以看到相关的代码提交记录 https://github.com/wonday/react-native-pdf/commit/166090dd5960abc27ad2c485b657ee05a374d470
 
相关知识
一个RN库,一般是JS代码+Android(java/kotlin) 与IOS(OC) 的代码的集合
