Describe the bug
The v2 API (com.google.android.gms.oss.licenses.v2.OssLicensesMenuActivity) is written in Kotlin and documented with Kotlin-style usage, but the published AAR has the kotlin.Metadata annotation stripped from its classes. As a result, the Kotlin compiler treats setTheme() / setActivityTitle() as plain Java static methods:
- Named arguments fail to compile:
Named arguments are prohibited for non-Kotlin functions.
OssLicensesMenuActivity.Companion.setTheme(...) fails with Unresolved reference 'setTheme'.
This looks like a follow-up to #364: in 17.4.0 the companion methods were stripped entirely by ProGuard ("it got stripped out by proguard and we missed it"). 17.5.0 restored the methods themselves, but the Kotlin metadata is still being stripped, so Kotlin consumers lose named arguments, parameter names, and companion resolution on a Kotlin-first API.
To Reproduce
- Add
com.google.android.gms:play-services-oss-licenses:17.5.1.
- Call the v2 API with named arguments:
OssLicensesMenuActivity.setTheme(
lightColorScheme = myLightScheme,
darkColorScheme = myDarkScheme,
typography = myTypography,
)
- Compilation fails:
e: Named arguments are prohibited for non-Kotlin functions.
e: No parameter with name 'lightColorScheme' found.
e: No value passed for parameter 'p0'.
- Verify the cause in the published artifact — no
kotlin.Metadata runtime annotation is present:
$ javap -v -classpath classes.jar com.google.android.gms.oss.licenses.v2.OssLicensesMenuActivity | grep kotlin.Metadata
(no output; only @kotlin.jvm.JvmStatic remains as a runtime-invisible annotation)
Expected behavior
kotlin.Metadata (and @Metadata on the Companion) is kept for the public v2 API classes so Kotlin consumers can use named arguments and companion access as documented. For libraries with a Kotlin public API this typically means keeping the metadata for public API classes in the ProGuard configuration used to build the release artifact (see e.g. -keep class kotlin.Metadata guidance for Kotlin SDK authors).
Desktop (please complete the following information):
- Gradle version: 9.4.1
- Android Studio version: N/A (CLI build)
- Kotlin version: 2.3.21
- Android Gradle Plugin: 9.2.1
- Plugin name and version:
oss-licenses-plugin 0.12.0
- Library dependency:
play-services-oss-licenses 17.5.1
Additional context
Describe the bug
The v2 API (
com.google.android.gms.oss.licenses.v2.OssLicensesMenuActivity) is written in Kotlin and documented with Kotlin-style usage, but the published AAR has thekotlin.Metadataannotation stripped from its classes. As a result, the Kotlin compiler treatssetTheme()/setActivityTitle()as plain Java static methods:Named arguments are prohibited for non-Kotlin functions.OssLicensesMenuActivity.Companion.setTheme(...)fails withUnresolved reference 'setTheme'.This looks like a follow-up to #364: in 17.4.0 the companion methods were stripped entirely by ProGuard ("it got stripped out by proguard and we missed it"). 17.5.0 restored the methods themselves, but the Kotlin metadata is still being stripped, so Kotlin consumers lose named arguments, parameter names, and companion resolution on a Kotlin-first API.
To Reproduce
com.google.android.gms:play-services-oss-licenses:17.5.1.kotlin.Metadataruntime annotation is present:Expected behavior
kotlin.Metadata(and@Metadataon theCompanion) is kept for the public v2 API classes so Kotlin consumers can use named arguments and companion access as documented. For libraries with a Kotlin public API this typically means keeping the metadata for public API classes in the ProGuard configuration used to build the release artifact (see e.g.-keep class kotlin.Metadataguidance for Kotlin SDK authors).Desktop (please complete the following information):
oss-licenses-plugin 0.12.0play-services-oss-licenses 17.5.1Additional context
setTheme()with Kotlin snippets; positional calls do work, so this is purely a Kotlin-interop degradation, not a runtime failure.