Android Studio built-in compiler doesn't show red lamp errors

My android studio does not show a red light when I have an error, but gradle does it when I compile the project. The strangest thing is that this only happens in .java files, for xml files. I tried to clean the project and rebuild, reinitialize Android Studio and I checked that the power saving mode was not selected.

My gradle file:

sourceSets {
    main {
        manifest.srcFile 'AndroidManifest.xml'
        resources.srcDirs = ['src']
        res.srcDirs = ['res']
        assets.srcDirs = ['assets']
    }

    debug {
        java.srcDirs = ['src', 'build/generated-sources', 'src-debug']
    }

    release {
        java.srcDirs = ['src', 'build/generated-sources', 'src-release']
    }
    androidTest.setRoot('project-test')
    androidTest {
        java.srcDirs = ['project-test/src']
        resources.srcDirs = ['project-test/src']
        aidl.srcDirs = ['project-test/src']
        renderscript.srcDirs = ['project-test/src']
        res.srcDirs = ['project-test/res']
        assets.srcDirs = ['project-test/assets']
    }
}

      

Also my source folder in the project is marked with "J" inside a red circle.

Does anyone know where the problem is? Thank!

+3


source to share


1 answer


Finally I found the problem. The problem was that somehow in the gradle file my src foulder looked like the foulder resource:

sourceSets {
    main {
        manifest.srcFile 'AndroidManifest.xml'
-->     resources.srcDirs = ['src']
        res.srcDirs = ['res']
        assets.srcDirs = ['assets']
    }
      ...
}

      

I changed this line as follows:



sourceSets {
    main {
        manifest.srcFile 'AndroidManifest.xml'
        java.srcDirs = ['src']
        res.srcDirs = ['res']
        assets.srcDirs = ['assets']
    }
....
}

      

I hope this can be helpful for other people!

0


source







All Articles