a2a-java icon indicating copy to clipboard operation
a2a-java copied to clipboard

[Bug]: Duplicate package-info.class in a2a-java-sdk-common and -spec breaks Android builds

Open kvmilos opened this issue 4 months ago • 1 comments

What happened?

On Android, depending on the A2A Java client fails AGP's checkDuplicateClasses because a2a-java-sdk-common and a2a-java-sdk-spec both ship a byte-identical org/a2aproject/sdk/util/package-info.class.

How to reproduce

A minimal Android project (verified with Android Gradle Plugin 9.2.1, Gradle 9.6.1): settings.gradle.kts

pluginManagement {
  repositories { google(); mavenCentral(); gradlePluginPortal() }
}
dependencyResolutionManagement {
  repositories { google(); mavenCentral() }
}
include(":app")

build.gradle.kts

plugins { id("com.android.application") version "9.2.1" apply false }

gradle.properties

android.useAndroidX=true

app/build.gradle.kts

plugins { id("com.android.application") }
android {
  namespace = "com.example.a2arepro"
  compileSdk = 34
  defaultConfig { minSdk = 26 }
}
dependencies {
  implementation("org.a2aproject.sdk:a2a-java-sdk-client:1.0.0.Final")
}

app/src/main/AndroidManifest.xml

<manifest xmlns:android="http://schemas.android.com/apk/res/android" />

Then run:

./gradlew :app:checkDebugDuplicateClasses

The build fails with the duplicate class shown below. (checkDuplicateClasses is a standard AGP task that also runs during any normal build, e.g. :app:assembleDebug.) Reproduced on both 1.0.0.Final and 1.1.0.Final.

Cause org.a2aproject.sdk.util is a split package — real classes live in both modules (common: Assert, HttpHeaderUtils, NotNull; spec: Utils, ErrorDetail, PageToken) — and each ships its own package-info.java (@NullMarked), so both jars contain a duplicate package-info.class. It's unavoidable for consumers: spec depends on common, and the client/http-client/transports all depend on spec, so both jars are always on the Android classpath.

Expected An Android app should be able to depend on the A2A Java client without a duplicate-class build failure.

Relevant log output

> Task :app:checkDebugDuplicateClasses FAILED
> A failure occurred while executing com.android.build.gradle.internal.tasks.CheckDuplicatesRunnable
   > Duplicate class org.a2aproject.sdk.util.package-info found in modules a2a-java-sdk-common-1.0.0.Final.jar -> a2a-java-sdk-common-1.0.0.Final (org.a2aproject.sdk:a2a-java-sdk-common:1.0.0.Final) and a2a-java-sdk-spec-1.0.0.Final.jar -> a2a-java-sdk-spec-1.0.0.Final (org.a2aproject.sdk:a2a-java-sdk-spec:1.0.0.Final)

Code of Conduct

  • [x] I agree to follow this project's Code of Conduct

kvmilos avatar Jul 13 '26 08:07 kvmilos

Hi @kvmilos - I'm looking at this now

kabir avatar Jul 21 '26 13:07 kabir