1

I have an Android Studio project.

I recently viewed this page.

I noticed that under the "The Android Project View" section of the page, that my project view (attached) differed from the one on the page. Is this because the project structure has changed in recent releases, or is it because my project is configured differently (possibly wrongly)?

enter image description here

Scorb
  • 1,654
  • 13
  • 70
  • 144
  • Not duplicate. The other question is broad question about Eclipse vs Android studio project structure. This question is about "Project View" in android studio. We have no clue that my project view has anything to even do with the fact it was an eclipse project before. – Scorb Jan 24 '17 at 01:32
  • You appear to have two modules in the same project. Is one your own and the other from the example you are following? – Code-Apprentice Jan 24 '17 at 02:21
  • I suggest that you read [this](https://developer.android.com/studio/projects/index.html) to learn more about the difference between projects and modules in Android Studio. – Code-Apprentice Jan 24 '17 at 02:24
  • see link in thread......that is what I was reading as the precursor to this question..... – Scorb Jan 24 '17 at 02:25
  • It appears that you probably opened the directory which contains two separate AS projects as a project itself. Instead, you should open each of those directories separately. – Code-Apprentice Jan 24 '17 at 02:26
  • Unlike Eclipse, you can only open one project in a window at a time in Android Studio. Instead, you can open multiple projects in multiple windows. – Code-Apprentice Jan 24 '17 at 02:27
  • You should also get a handle on the actual directory structure of an Android Studio project. AS has several different views in the Project Pane which provide access to the files in a project. Some of these views are organized so that you do not see the actual directory hierarchy of your project. – Code-Apprentice Jan 24 '17 at 02:29
  • @Code-Apprentice Check the comments on my answer. The question is "Why is the BleeperMaker folder shown and not **only** the app module" – OneCricketeer Jan 25 '17 at 02:09
  • @cricket_007 Yes, I understand that. There is something strange going on with the way the user created or opened the project. – Code-Apprentice Jan 25 '17 at 05:10
  • @Code-Apprentice I think I figured it out - my "Project Files" view looks the same. – OneCricketeer Jan 25 '17 at 05:16
  • 1
    @ScottF For future reference, you should add the `.idea` folder and all `*.iml` files to `.gitignore` so that they are not added to version control. They can be generated automatically by Android Studio or IntelliJ. – Code-Apprentice Jan 25 '17 at 05:18
  • @cricket_007 Looks the same as what? – Code-Apprentice Jan 25 '17 at 05:28
  • @Code-Apprentice Image in the question. Like `app` and `` looking like separate modules. In the "Project" or "Android" views, I do not see `` folder separately – OneCricketeer Jan 25 '17 at 05:30
  • When I clone the GitHub repo and open the project in AS, I get an error: "Error Loading Project: Cannot load 2 modules". – Code-Apprentice Jan 25 '17 at 05:44
  • Same issue, and for reason you had suspected (project configuration). I could not post an answer here, probably because it's marked as a DUP - REF: https://stackoverflow.com/a/52773372/309779 – XMAN Oct 12 '18 at 06:33

1 Answers1

4

From your link

To see the actual file structure of the project including all files hidden from the Android view, select Project from the dropdown at the top of the Project window

So, click that <> looking button to the right of that and select Project.
You are showing Project Files

Here's the options I see in IntelliJ.

enter image description here

So, no, not wrong. My projects also look like that in the Project Files view.


UPDATE For what it's worth, I just cloned your repo.

Ran gradlew build --stacktrace

Saw BUILD FAILED

And you have errors anyway

:app:assembleRelease
:app:assemble
:app:lint
Ran lint on variant debug: 88 issues found
Ran lint on variant release: 88 issues found
Wrote HTML report to file:///.../BleeperMaker/app/build/outputs/lint-results-debug.html
Wrote XML report to file:///.../BleeperMaker/app/build/outputs/lint-results-debug.xml
:app:lint FAILED

You have to read over that results-debug.html to see the errors to fix.

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
  • Why does my project have a second gradle module, if this is not the standard? – Scorb Jan 24 '17 at 01:40
  • I don't know. It's your code. Look in the root `build.gradle` and `settings.gradle` files to see what you are compiling – OneCricketeer Jan 24 '17 at 01:40
  • Based on the fact there is an `.idea` folder in `BleeperMaker`, I'd guess you created in Android project within an existing Gradle project directory – OneCricketeer Jan 24 '17 at 01:42
  • My code is in the src folder. All the config file Android Studio generated. I have never manipulated them manually or modified the code in them. – Scorb Jan 24 '17 at 01:42
  • My build.gradle files can be view here. There are two of them...is this correct? https://github.com/safield/SafireRingtoneMaker – Scorb Jan 24 '17 at 01:52
  • That all looks fine. Plus, you only have one module included https://github.com/safield/SafireRingtoneMaker/blob/master/settings.gradle#L1 Like I said, I think you have a project within another one. – OneCricketeer Jan 24 '17 at 01:54
  • I am not sure what is meant by that. I don't have any "project" on the files system, and I can not find any other project in the configs... – Scorb Jan 24 '17 at 01:58
  • For example, in `C:\...\project1`, there is `C:\...\project1\BleeperMaker` and `C:\...\project1\name\app` – OneCricketeer Jan 24 '17 at 02:01
  • 1
    my file structure is exactly as shown in the github repo. There is no sub project that I can find.... My local copy had a rename done, so replace instances of "BleeperMaker" with "SafireRingtoneMaker". The same behavior is exhibited in a clean check out. – Scorb Jan 24 '17 at 02:04
  • Your `app.iml` file is the problem. You opened the project from the `app` folder when you imported, not the root level `build.gradle` – OneCricketeer Jan 24 '17 at 02:12
  • Is there a reasonable solution to this? – Scorb Jan 24 '17 at 02:16
  • Yeah, I think you should delete the relevant iml files and the hidden .idea folder. That is what Android Studio uses to show the "project view" – OneCricketeer Jan 24 '17 at 02:18
  • Deleting app.iml does not solve the problem. It just regenerates it every time I open android studio. I also delete any reference to app.iml, which is only in .idea/modules.xml – Scorb Jan 25 '17 at 01:50
  • You have to remove the project from Android Studio. Anyway, I would delete your project from disk entirely. Then re-clone from Github, then import the build.gradle file as a new project – OneCricketeer Jan 25 '17 at 02:07
  • I just built and deployed the app to my device....playing with it right now... – Scorb Jan 25 '17 at 02:22
  • Not sure how you got it to install. Won't build on my system – OneCricketeer Jan 25 '17 at 02:25
  • 1
    Moral of the story. Android tools are a complicated convoluted mess. Ill just flag up your answer, and move on with my life. Cheers. – Scorb Jan 25 '17 at 02:33
  • I use IntelliJ, so not sure what to tell you. – OneCricketeer Jan 25 '17 at 02:34
  • Ugh, I didn't even realize that was a dropdown... Spent like 5 minutes clicking around it then went to google to find this. Today mine switched an existing project from "Project" to "Android" for no apparent reason. – Izkata Dec 02 '19 at 07:02