I don't know if it is the place to ask this question, but i thinks it's more relevant to ask it here than in http://android.stackexchange.com.
The android studio project explorer always is like image below:
But in one of my new projects it became like below:
It's a bit confusing i could not find manifest and other xmls easily.
You are switching between Android project view and Project files view.
There is a menu on top of the tree view to change it.
Example screenshots:
Package view:
Android project view:
Project files view:
Android Studio creates the default structure for your project and
opens the development environment. If your app supports more than one
form factor, Android Studio creates a module folder with complete
source files for each of them .
You should check Projects Overview .You can change its structure by selecting above picture .
Related
I don't know how but the android studio changed the file hierarchy of my project...
see the image below.
This type was proper the image that is above this line .
The image that is below this line was automatically created by the android studio.
How to change back to the older file hierarchy type??
In left upper corner of Android Studio you need to change the project view to Android. Your current project view is Project.
Android Studio Project Structure (v.s. Eclipse Project Structure)
This link will help you to understand the folder structure of android studio.
And all the new folder created in your project after compile it in android studio is all because of folder structure of android studio and dont worry it will never harm your project.
I'm trying to import PocketSphinx into a project using Android Studio 1.5.
This page details how to install and use the library. However I stumble at the following step:
In Android Studio you need to place jar file in app/libs folder and jni .so files into app/src/main/jniLibs folder.
My project directory tree does not contain these directories and I have been unable to create them myself. This is my directory tree:
That webpage also provides a sample android studio project, which works just fine, but I think it is designed for an older version of android studio because the directory structure is totally different to any app I've seen before (While I do have some years of coding experience in other areas, I only started developing android apps in the last 2 or 3 months).
This is what it's directory tree looks like:
(I haven't expanded the entire tree this time)
One last thing: I tried to import the library (as available for download here) by using "File -> New -> Import Module" But doing this breaks the project (and it can't be fixed by simply clicking "undo"). The error message I get is:
V:\Documents\ButterflyMilk\SpeechRecDemo\pocketsphinx-android-master\build.gradle
Error:(7, 0) Could not find property 'sdkDir' on org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler_Decorated#606a97f.
Open File
and at the top of the code view it now permanently says:
Gradle project sync failed. Basic functionality (e.g. editing, debugging) will not work properly.
Thanks in advance for any help and advice you can offer! I will also quickly note again that the sample program provided works just fine, and I've managed to tweak it and play around with it. However I still need to be able to import the library into a separate project. Thanks again
My project directory tree does not contain these directories and I have been unable to create them myself. This is my directory tree:
This is "Android" view.
This is what it's directory tree looks like
This is "Project" view. You can switch between views with a dropdown selector on the top of the region (it says "Project" in second screenshot)
I have been unable to create them myself.
You can create folders in file manager.
You can also use IDE, right click on the app, then select "New" -> "Folder (green in the bottom)" -> "JNI Folder" for example.
You can also use "New" -> "Directory".
I have been developing an Android project using Android Studio and Gradle.
My project's AndroidManifest.xml is located under an external folder.
I'm pointing to it using the following code in the build.gradle file:
sourceSets {
main {
manifest.srcFile '..\\..\\..\\sources\\AndroidManifest.xml'
}
}
Everything works great, the project compiles and runs, except I can't locate the AndroidManifest.xml file under the project structure, when using the project view pane.
Maybe I need to add something else to the build.gradle file?
First - I don't see any reason to maintain manifest outside Android project. It's integral part of Android application so it should be in location where Android Studio can read it. Just copy it where it should be.
If you really need to have AndroidManifest.xml in external location, think about making symbolic link to location where Android Studio expects it to be.
I don't believe you can. When you use the project view pane, Android Studio displays all files in the project root, not all the files linked to your project (to test this, you can create a new file that's not linked to your project in the folder of your project and you'll be able to see it in Android Studio explorer).
Android Studio (and IntelliJ), are build under the assumption that all of your source is in a single "project" folder. That is why the Project view only contains files in the project, it's designed to just show a file tree.
I just tested it, you can use the Android view (one of the other options in the screenshot you posted) to have your external Manifest appear. Some of the functionality is disabled or broken while editing though. This is possible because the Android view is meant to show all relevant source for your project, even if you have the odd requirement of an external manifest.
But please, consider moving it into your project directly or using a symbolic link. You'll be much happier.
Put it in a folder closer to the directory you're on or if needed, move it closer. "..\sources\AndroidManifest.xml"
I am new to android development. I installed android studio 1.2.2 on osx 10.10 successfully. I downloaded the devunwired/accessory-samples repo and I am trying to view the activity_client.xml in design mode, but I am not able to do so.
I think I am supposed to see the "Design" tab in the botton somewhere, but I do not see it. Here is what I see. What do I need to do to see this .xml file in the graphical view?
It looks like your project isn't imported as Android module.
Also the folder "BluetoothGattPeripheral" must be the root of the module.
Either try to reopen the correct folder or use File -> New -> Project From existing sources and make sure you import it as Android Project/Module.
When you've done it correctly the "src/main/java" folder should be automatically chosen as "Source Root" and should turn blue.
There's no need to say one word:
After realizing why Eclipse did not want to open XMl files in its Layout designer, I hope we'll be able to solve this issue here.
Anyway, after I create the project in InteliJ IDEA, exports it in Eclipse format, opens it in Eclipse, I realize that Eclipse Layout Designer does not recognize such XML file and the Layout Designer cannot load its content into right pane of the designer. This is how the Designer looks like after I try to load InteliJ-created XML file.
Indeed, I can load Android layout elements after setting Designer to correct Android OS version (dropdown list, elements appear in left pane of the designer), but the very content of the XML file gets never loaded in the right pane of the Designer.
After examining the STRUCTURE of a project created in Eclipse and a project created in IntelliJ, I realized that Eclipse DOES NOT generate Java files in /gen directory nor it imports correct Android library once I import IntelliJ-created project. Look at the image.
The upper project is created in Eclipse and it has both Android R files and Android library imported.
The project below is created in IntelliJ, exported to Eclipse format and then imported into Eclipse workspace. It does not have either Android R files or Android library imported.
Another problem is that I cannot force rebuild the Intellij-created project or even clean it in Eclipse because it isn't in the list of projects. Like Eclipse does not see it as an Android project at all.
The final issue is: when I manually set Android OS version in Layout Designer, then try to grab&drop Android element into the right pane of the Designer, I get the message (error) "Missing project resources". Look at the image.
Please help!
I've not used IntelliJ IDEA for Android development. But from what I can guess I think there is an encoding mismatch. The text files are typically encoded in UTF-8. But some editors have a different default encoding like: ISO-8859-1. This could be confusing IntelliJ parser.
If the encoding is OK, check whether IntelliJ is trying to validate the xml file against Android schema. If it can't find the schema then the IDE should report the error on the logs. You can either turn off validation or show the schema path to IntelliJ.
If you don't mind me asking, why do you want to use IntelliJ instead of Eclipse?