Skip to content

Duplicate class com.shockwave.pdfium.BuildConfig when using readium-adapter-pdfium #662

Closed
@Yahoo-Mike

Description

@Yahoo-Mike

Describe the bug

When I add org.readium.kotlin-toolkit:readium-adapter-pdfium:3.1.0 to my build dependencies, the build fails with several errors like this:

Duplicate class com.shockwave.pdfium.BuildConfig found in modules readium-adapter-pdfium-document-3.1.0.aar -> readium-adapter-pdfium-document-3.1.0-runtime (org.readium.kotlin-toolkit:readium-adapter-pdfium-document:3.1.0) and readium-adapter-pdfium-navigator-3.1.0.aar -> readium-adapter-pdfium-navigator-3.1.0-runtime (org.readium.kotlin-toolkit:readium-adapter-pdfium-navigator:3.1.0)

Duplicate class com.shockwave.pdfium.PdfDocument found in modules readium-adapter-pdfium-document-3.1.0.aar -> readium-adapter-pdfium-document-3.1.0-runtime (org.readium.kotlin-toolkit:readium-adapter-pdfium-document:3.1.0) and readium-adapter-pdfium-navigator-3.1.0.aar -> readium-adapter-pdfium-navigator-3.1.0-runtime (org.readium.kotlin-toolkit:readium-adapter-pdfium-navigator:3.1.0)

etc

How to reproduce?

  1. using AndroidStudio Meerkat (patch 2) with AGP 8.9.2, create a new "EmptyViewsActivity" project with minSdk=26
  2. in the build.gradle.kts (:app) add this:

dependencies {
implementation("org.readium.kotlin-toolkit:readium-adapter-pdfium:3.1.0")
}

  1. by the way you also need to desugar, even if minSdk=26. Readme.md says you shouldn't have to, but the build insists anyway

android {
compileOptions {
isCoreLibraryDesugaringEnabled = true
}
}

dependencies {
coreLibraryDesugaring( "com.android.tools:desugar_jdk_libs:2.1.5" )
}

  1. sync and assemble

Readium version

3.1.0

Android API version

min=26, target=35

Additional context

On the "main" git branch, I can see com.shockwave.pdfium being pulled in by only one file: readium/adapters/pdfium/document/.../PdfiumDocument.kt

Excluding readium-adapter-pdfium-document from the build results in a successful compile, but obviously removes functionality from the library:

implementation("org.readium.kotlin-toolkit:readium-adapter-pdfium:3.1.0") {
    exclude(group="org.readium.kotlin-toolkit",module="readium-adapter-pdfium-document")
}

Trying to sneak the pdfium-document library back in separately leads to the same duplication class errors:

implementation("org.readium.kotlin-toolkit:readium-adapter-pdfium:3.1.0") {
    exclude(group="org.readium.kotlin-toolkit",module="readium-adapter-pdfium-document")
}
implementation("org.readium.kotlin-toolkit:readium-adapter-pdfium-document:3.1.0")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions