16

I've created a new AndroidStudio project using the libGDX generator. When I import the project into AndroidStudio using the build.gradle file, I get a warning while editing build.gradle file

'sourceSets' cannot be applied to 'groovy.lang.closure'

Here is the section that gives the warning:

android {
    buildToolsVersion "23.0.2"
    compileSdkVersion 23
    sourceSets {
        main {
            manifest.srcFile 'AndroidManifest.xml'
            java.srcDirs = ['src']
            aidl.srcDirs = ['src']
            renderscript.srcDirs = ['src']
            res.srcDirs = ['res']
            assets.srcDirs = ['assets']
            jniLibs.srcDirs = ['libs']
        }

        instrumentTest.setRoot('tests')
    }
    defaultConfig {
        applicationId "com.twocrowstudios.rpggame"
        minSdkVersion 9
        targetSdkVersion 23
    }
}

Just the sourceSets section is generating this error. What does this error mean? It seems that all my builds work fine. While there have been some other questions relating to the build section, this question pertains to the sourceSet section which has not been addressed.

kalebthered
  • 161
  • 1
  • 6
  • Possible duplicate of [buildTypes cannot be applied to groovy.lang.Closure](http://stackoverflow.com/questions/29133601/buildtypes-cannot-be-applied-to-groovy-lang-closure) – Kaushik Jan 07 '16 at 05:05
  • 5
    I don´t think this is a duplicate becouse I have the same exact problem and solution suggested there does not solve it for me. – B.Gen.Jack.O.Neill Apr 02 '16 at 11:49
  • You can turn off the warning by specifying `// noinspection GroovyAssignabilityCheck`. – Fabian Zeindl Aug 04 '16 at 11:05

1 Answers1

1

There was long term bug IDEA-159224 which is still not completely fixed (as of 162.1628 build).

You can suppress this warning locally using comment //noinspection GroovyAssignabilityCheck or turn off Incompatible type assignment inspection (not recommended).

Anyway I'd suggest you to vote for this issue to attract developers attention to this problem.

vsminkov
  • 10,912
  • 2
  • 38
  • 50