1

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

  • 1
    No errors here :). It's supposed to be like this. If you would try to add new item let's say inside drawable folder, you would get dialog asking which drawable folder to put in. – Vygintas B Sep 18 '17 at 08:26
  • Ohh, tried to add something and got the dialog, but I like the old fashion project style so will probably use that instead. But thanks! – Marcus Lagerstedt Sep 18 '17 at 08:48

4 Answers4

2

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

Linh
  • 57,942
  • 23
  • 262
  • 279
0

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.

Community
  • 1
  • 1
0

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.

Community
  • 1
  • 1
Orvenito
  • 437
  • 2
  • 14
0

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

Nikos Hidalgo
  • 3,666
  • 9
  • 25
  • 39
Jack
  • 1
  • This should be an answer which solves the problem but instead reads like another problem desription. Please [edit] and rephrase to make the answering part more obvious. If it actually is a problem instead of an answer please delete and ask a separate new question instead https://stackoverflow.com/questions/ask – Yunnosch Apr 30 '20 at 10:22