Skip to content
This repository was archived by the owner on Jun 27, 2020. It is now read-only.
This repository was archived by the owner on Jun 27, 2020. It is now read-only.

build.gradle.kts with sourceSets in android project #160

Open
@Merseyside

Description

@Merseyside

I use kotlin gradle build in my android project. I need to separate my xml files, so I write something like this:

sourceSets.getByName("main") {

        java.srcDir("src/main/res/")
        java.srcDir("src/main/res/layouts/fragment")
        java.srcDir("src/main/res/layouts/activity")
        java.srcDir("src/main/res/layouts/dialog")
        java.srcDir("src/main/res/layouts/view")
        java.srcDir("src/main/res/value/values-light")
        java.srcDir("src/main/res/value/values-night")
    }

Every folder (activity, fragment, etc.) contains layout folder as expected. But when i try to compile it, I got an error:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':android-app:generateUnitsClasses'.
> org.xml.sax.SAXParseException; systemId: file:/.../Workspace/moko-template/android-app/src/main/res/layouts/activity/; lineNumber: 1; columnNumber: 1; Content is not allowed in prolog.

I using Studio 3.6.3 and in IDE this folders are blue(includes).
Also xmlns:android value highlighted red and says "URI is not registered".

How can I compile project using kts?

Activity

Merseyside

Merseyside commented on May 16, 2020

@Merseyside
Author

I changed java -> res. Now xml looks nice. But i still getting this error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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

        Participants

        @Merseyside

        Issue actions

          build.gradle.kts with sourceSets in android project · Issue #160 · Kotlin/kotlin-frontend-plugin