Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

'sourceSets' cannot be applied to 'groovy.lang.closure' warning in Android Studio

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.

like image 290
kalebthered Avatar asked Jan 07 '16 04:01

kalebthered


1 Answers

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.

like image 150
vsminkov Avatar answered Oct 01 '22 22:10

vsminkov