Skip to content

Wire plugin is not compatible with built-in Kotlin in AGP 9.0.0-beta05+ #3480

@hungvietnguyen

Description

@hungvietnguyen

Problem

When built-in Kotlin is disabled, the kotlin-android plugin creates one KotlinSourceSet for each AndroidSourceSet.

When built-in Kotlin is enabled, starting with AGP 9.0.0-beta05, KotlinSourceSets are no longer supported (https://issuetracker.google.com/386221070).

Currently, Wire is using these Kotlin source sets, so with AGP 9.0.0-beta05+ and built-in Kotlin, the build will fail with an error similar to the following:

A problem occurred configuring project ':<project>'.
> KotlinSourceSet with name 'androidTest' not found.

* Exception is:
org.gradle.api.ProjectConfigurationException: A problem occurred configuring project ':<project>'.
Caused by: org.gradle.api.UnknownDomainObjectException: KotlinSourceSet with name 'androidTest' not found.
	at com.squareup.wire.gradle.kotlin.SourceRootsKt.sourceRoots(SourceRoots.kt:128)...

pointing to this code in the Wire plugin.

Fix

Please migrate KotlinSourceSet to AndroidSourceSet.kotlin. See this guide for more details.

Workaround for users

Set android.disallowKotlinSourceSets=false in gradle.properties to temporarily bypass this error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions