Marcus Lagerstedt
Marcus Lagerstedt

Reputation: 438

Android project res folder not showing all directory

I tried to add some directories to the res folder in my android project(in Android Studio).

What I get in Android Studio

What I get in Android Studio

What's my real folder structure

What's my real folder structure

I don't know that much about gradle but here is some code from gradle

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:26.+'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    testCompile 'junit:junit:4.12'
}

allprojects {
    repositories {
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

the code is not in the same folder

Upvotes: 2

Views: 3327

Answers (4)

Jack
Jack

Reputation: 1

For me, I had refactored and renamed an XML file from main.xml to a_main.xml.

My directory folder for my whole project is also called main. So refactoring the XML also changed the name in the directory path within my module Gradle to a_main, but did not change the name of my directory. In the module Gradle, I found the srcDirs and changed it from a_main back to main. The project lives on.

project

Upvotes: 0

Orvenito
Orvenito

Reputation: 437

There is no mistake here. this is my res directory:

and take a look at my project directory:

but when you collapse each of them for example my drawable folder this is what it looks like:

you can notice that every images has mdpi or hdpi etc. indicated to know what folder it is stored. your resources are there, do not worry.

Upvotes: 0

user8442578
user8442578

Reputation:

I had the same problem, what I did was create a values-xx folder inside the main directory and then moved that folder to res/ directory.

Main -> Right click -> new -> directory

It's not beautiful but it is a workaround to create a folder with Android studio.

I follow it from How to Create New Res Folder in Android Studio

Above your the file directory view in Android Studio is a drop down which currently is most likely set to Android. Change it to Project and you should be able to see all your files.

Upvotes: 0

Linh
Linh

Reputation: 60923

Below you application name, click at dropdown and select Project then you will see all directories enter image description here

Upvotes: 3

Related Questions