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

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

Open
Merseyside opened this issue May 16, 2020 · 1 comment
Open

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

Merseyside opened this issue May 16, 2020 · 1 comment

Comments

@Merseyside
Copy link

Merseyside commented May 16, 2020

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?

@Merseyside
Copy link
Author

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant