Search code examples
androidkotlingradlegradle-kotlin-dsl

Could not get unknown property 'PrivateData' for object of type org.gradle.api.internal.initialization.DefaultScriptHandler


There is an open source project here.

After trying multiple times to build it, there is an error that make build Failed :

Task failed with an exception.

Where:

Build file '/src/apps/build.gradle' line: 19

What went wrong:

A problem occurred evaluating root project 'apps'.

Could not get unknown property 'PrivateData' for object of type org.gradle.api.internal.initialization.DefaultScriptHandler.

Here is line 19 :

buildscript {
    PrivateData.merge(project, "all-apps")
    ...
}

And the defined PrivateData.merge(...) is in /buildSrc/src/main/java/MergePrivateData.kt file:

object PrivateData {

    ...
    @JvmStatic
    @JvmOverloads
    fun merge(project: Project, dataDirName: String = "") {
    ...
    }
...
}

The source successful build is here and I follow the steps, but I can not find my mistake.

Please help me.


Solution

    1. From the apps folder remove the buildSrc file.
    2. From the root copy the buildSrc folder into the apps folder and rebuild it.