How to fix the Android studios project file layout - android

Typically when I use Android studios the project files on the side bar are all nice, organized and clean; having App - (manifest, java, res, assets) Gradle Scripts -
I like when it is like that. But for some reason, every so often when I open a project, typically one that I did on another computer with Android Studios, the files come in all expanded, That is they look like they just came out of the folder looking something like this: .gradle- .idea- app -(build, libs, src, .gitIgnore, app.iml, build.gradle, progaurd-rules.pro) build- gradle- And Still more. It is messy any unorganized. Even more, my namespaces are all expanded, so when I view files I have to expand the folders way out.
Android studios when working the way I like puts the namespaces into one folder, that is there will be a folder that is called com.etc.whatever and it doesn't have to be expanded way out.
So how do I get it back to normal?

You must change your project structure to Packages. it may work.
explore the other option given in project structure.

Related

Android Projects: Organize Artwork and Sound with Version control

I've been working with Android for quite some time, yet I have never seen any good explanations for this issue.
I'm working on an app with a number of artwork and sound files. Many of these files are temporary, are base files that future work will evolve from, or are large versions that will be split into multiple files later. I want to keep them under version control with this project, and I'd like to keep everything in the same place on my hard drive.
But I don't want these "work" files to end up in my apk. They are often huge and have nothing to do with the final product.
For most of my life (ie, before Android), I would simply have a subdirectory within my project called art_work_files. And this directory would be subdivided into all the various tasks. And git is fine with this, especially for SVG files (it even properly notes differences and changes).
But when I put these files in my Android Studio project, I get concerned that the AS will think these are somehow important and keep references to them--possibly even adding them to jar or apk files.
Yes, I realize that the final versions of the art needs to go in the res/drawing/ directories (and similar for sound and other resources). And I'm happy to do this final copy.
Am I over-thinking this, or is there a better way to organize and still keep Android Studio happy?
Since no one has answered this question in 7 months, I'll submit my solution.
I have created a directory under the main directectory (same level as java and res) called assets. Git recognizes this directory and will notice any files that are added, removed, or changed. I'm fine with using git to handle binaries btw.
For each type of asset, I make another subdirectory. Here's what it looks like:
app ->
libs
src ->
main ->
assets ->
font
ogg
png
svg
java
res
...
This seems to work fine and keeps everyone happy. I'm still curious how other people do this; I welcome your comments and answers.

What are the "androidTest" and "test" folders used for?

I am creating an android app using Android Studio. In the project view, apart from the main folder where all my classes are stored I also have "androidTest" and "test" folders (marked with red in the image). I did not created these folders and I believe Android Studio generated these folders. What are these folders for? Is it safe to delete them?
Yes, you can delete them (and you can delete their references from the gradle file), but why even bother? These files are just there to nudge you do the right thing.
They're like the broccoli that your mother might put on your plate even though she probably already knows that you're not going to eat them. You could refuse them and even delete them, but there is really little to no point in doing that.
If you want less visual clutter, just use the "Android View" instead of the "Project View" and don't expand those particular test folders.
These folders are created by default for testing your code
src/test - Unit Tests
src/androidtest - Android Instrumentation tests
[Read more]

How do I move files in Android IDE

I'm using Android IDE to develop, and I need to move source files from one folder to another, but I can't seem to find a way to actually MOVE a file (even copy and delete in two steps would work).
Am I blind? This seems like a required feature of any IDE, and given how good Android IDE is, I find it shocking if this feature was overlooked.
NOTE: This question is NOT about Android Studio!
You are right. The (essential) feature to move files around is missing from Android IDE.
Workaround:
You can manipulate the files in any explorer. Your project files are placed in /sdcard/AppProjects/YourProject.
You can count on the fact that such a feature will not be missing for long.
I would download a file manager (I like root browser) and switch between the two apps as a temporary work around. That app is updated fairly often so I would also just shoot the developers a feature request. I am sure they would consider it essential as you do.
PREFACE: Use a file manager; this hack renames Java classes.
Rename, with the relative path as the new name.
Let's say I wanted to move file from /sdcard/A to /sdcard/B. I'd long-press on file, chose rename, and type the new destination as ../B/file.
This doesn't seem like deliberate feature, rather a side effect of blindly passing path strings to the underlying framework. Can't say I don't like it, although, I'd recommend using a proper file explorer app.
Right-mouse click on any element (folder, Class, or XML file) the click = 'cut'.
Right-mouse click on the folder where you would like the files to be moved to, and then select 'paste'.
This works the same as moving files in the file-system.
For the most part (depending on where you are moving to and from) you can just drag-and-drop your files to move them as well.
I often achieve this goal by simply drag and drop. And the IDE also takes care of all the refactoring stuff.

How do you change the default subdrectories in an Eclipe ADT project?

I would like to be able to change the default subdirectories created as part of an Eclipse ADT project. That is, instead of "res" and "bin" I would like to have something else.
With most kinds of Eclipse projects it seems pretty straightforward -- there are a few places where you go to change different core subdirectories, you go there and change them, and that's pretty much that.
With the ADT plugin for Eclipse, it seems that if you refactor "res" to "resources" for example a new folder called "res" gets automatically added anyway. The same seems to be true for "bin" and "gen."
Where do I start to look to learn more about what causes this automated behavior and how to change it?
I'm not sure you can, as they are strictly defined by Android
http://developer.android.com/guide/topics/resources/providing-resources.html
http://developer.android.com/guide/topics/resources/available-resources.html
Why do you want to change the names?

Android and Eclipse - a problem

I'm a newbie with Eclipse and Android. I have a legacy project from an
SVN repository which I could import and use under Eclipse Helios. Also
changes inside and outside Eclipse are synchronized fine with the SVN.
Now the problem: The project structure consists of a root directory,
referring to a src path, which exists outside the root (i.e. on the
same level as the root of the project is). I guess this has been
arranged by the designer, because the src part has been referenced
from different java projects for different platforms. I think this is
not such a bad idea.
However: Whatever I do I can't make Eclipse and SVN synchronize
changes on files located in this "outer" directory. What do I have to
do in order to make both aware of the outer parts, w/o being forced to
change the file/dir structure completely?
Kind regards
From what I understand from your description you did the following ?
You Removed the src folder created by eclipse during the first check out.
You create a linked src folder (when you created it, instead of just accepting all the defaults, you opened the "advanced" dialog box and checked the radio button saying Link...(Linked Folder) and you filled in the location where you wanted that "outer" src folder to be located).
You updated from the repository.
But when you look at the updated folders, the src that has been updated is really under the root rather than the one you have shifted away.
Can you confirm my understanding ?
If not, then you might try the procedure outlined above.
Unless there are twists in the ADT I don't know about (a little bit like in hierarchical maven projects where you can "export as Maven subproject"), I cannot see any other scenario that would lead to the problem you describe.

Categories

Resources