Android - Invalid Resource Directory Name

1

I tried everything by searching the internet, I saw several answers about giving Clean Project, renaming, updating IDE and nothing worked. It still gives the following problem:

I just want to better organize the layout files by adding a folder to separate them. However you are giving this error and have not found a solution

    
asked by anonymous 21.04.2017 / 22:25

2 answers

3

The folders of an Android application follow a well-defined folder structure and names.

By default the resources of type layout should be placed in the

project_path

In your case what's wrong is, besides having .. \ app \ src \ main \ res \ layouts yet another layout-tuto folder.

To resolve

  • Rename the Layouts folder to Layout * .
  • Layout
  • delete the layout-tuto folder.

However it is possible to have other resources folders. They must be set up in the build.gradle file via sourceSets using the res.srcDirs property.

android{

    ....
    ....
    sourceSets {
        main {
            res.srcDirs += ['src/main/res2']
        }
    }
}
    
21.04.2017 / 23:00
0

The error says:

  

Invalid resource directory name

You have created a directory, layout-tuto , within another directory, layouts , which is not recognized by the Android SDK, and then the error is thrown in your IDE. To resolve the problem, you must change the directory name layouts to layout as recommended in the documentation. You can improve and organize your structure through the name of your layouts .

See Resource Delivery for the valid recommendations for directory names.

    
21.04.2017 / 22:53