Cannot find package folder under src - android-studio

Iam using android studio 2.3.2..
I cannot find package under srcenter image description here

You are currently looking at the project view. In the top spinner where it says project (above calculator) you can switch it to android where it will show the package folder "com.something.calculator" which is what you are like used to seeing. However it is important to note that in the project view that you are currently in, if you click main, then java You, should see your package folder.

Related

In Android Studio, how do I create a folder for project documentation?

In Eclipse, I had some folders in the project root that were not code - containing text files with notes about the project, Photoshop files for artwork and so on. Having migrated to Android Studio, these extra folders in the project root are not visible in the Project navigation pane - I only see the app folder and Gradle Scripts.
Is there some way to create a non-code folder that is visible in the Project pane but that is outside the app module?
I thought "Create New Module" in the Project Structure dialogue might do it, but it only offers me templates for modules that contain Android code.
--- EDIT ---
Thanks to #SvdTweel's answer I've stumbled across something that seems to do what I want:
switch to the Project view
create the documentation folder in the project root
right-click it and select Mark Directory as>Resources Root
switch back to the Android view and you see a new folder named "resources"
Will this have any adverse effects? Is this folder still ignored when building the app module?
In the Project Structure you can switch from Android to Project.
The default Android view structures and minimalizes the directories and files so that you as a developer can easier navigate through your project.
The Project view shows everything just as you would see when you browse it with your file explorer on your OS.
I think that is what you search for to create files and directories in the root of the project.
You can put the doc files in the test/resources folder. This is clumsy, but it makes them visible in the Android view while keeping them out of the build.
Bonus: code completion when editing Markdown code samples using the JetBrains Markdown plugin.

How to Build Sample Android Location App from GitHub

I downloaded the Main branch of the Sample Android Location App from GitHub as a ZIP file.
https://github.com/android/location-samples
Once on my computer, I unzipped the file to a subdir.
Then in Android Studio (4.1.1), I imported the project by specifying the unzip'd dir.
It opens fine, but I am unsure how to build it.
In addition, Studio editor shows several errors such as "Cannot resolve symbol 'AppCompatActivity'".
Not sure how to proceed now to build, test and debug. I am sure it is something simple I am overlooking. I checked the ReadMe. This is the first time I have attempted to download and Build a project from GitHub Android Samples, so just need a couple pointers.
After unzipping the file, you can import it to AS
Choose the dirrectory with Android icon to open the project
Then it will download the dependencies, jars, SDKs, etc. After downloading, you can refer to the upper right side, where you can choose which App to build, then click the green arrow, gradle will take care of the rest.
If it didn't show the green arrow, the gradle sync might have failed, and you can sync the project by click this

Unable to find Android SDK to build Unity application

I am currently developing an application using Unity3D, and I would like to build the app on the android platform. When I attempt to build with android, I am always prompted to 'Select Android SDK Root Folder'. It looks like this:
My problem is that I cannot find the Android SDK Root Folder, and therefore I cannot build the project.
To attempt to find the correct path, I used the configure SDK manager within Android Studio. I was given this as a path:
/Users/Luke/Library/Android/sdk
Just be sure, I checked this path in the terminal and found the sdk directory.
However, when I attempt to use the finder in Unity, I have no idea where the sdk directory is located. When I follow the path Luke/Library/Android,
I get a multitude of folders called Android, but none of these folders contain the sdk directory, or even resemble what I'm looking for.
Another pic:
Obviously, I cannot select any of these directories as the path, and therefore I am stuck at this step in the build.
Question:
How might I go about finding the SDK root folder in Unity?
I just found a simple solution to the problem, thanks to Julien_Nantes on the Unity forums -> https://forum.unity3d.com/threads/os-x-remember-to-install-the-android-sdk-via-the-sdk-manager-not-android-studio.288419/
If the sdk directory is added to the favorites on the left size bar, we can easily select it in the Unity finder.
In order to find the sdk folder in the finder application, I navigated to the correct directory in the command line and ran open . With that open, I added the sdk folder as a favorite.

Facebook SDK not imprted in Android studio

I have downloaded the facebook sdk version 3.21.1 and I have android studio version 1.0.2.
Whenever I try to import the 'facebook' folder in the sdk folder(through the import module method), it dosent show up in the project tree on the left hand pane. Also I am getting this error : Error:(1, 0) Gradle DSL method not found: 'pply()'
Possible causes:The project 'The Social App' may be using a version of Gradle that does not contain the method.
Gradle settingsThe build file may be missing a Gradle plugin.
Apply Gradle plugin
Please help.
For me I was having similar problems.
I am using Android Studio 1.1 and Facebook SDK 4.0.0
First, be sure to follow that steps 3 to 6 in the facebook developers page in your existing project.
Click here for the getting started instructions.
Be very sure you follow it all.
After importing it I didn't see it in my project structure be sure to click down on the left corner and make sure it is on Project, if not use the drop down and select Project.
Also do ctrl+alt+shiftt+s to bring up the project structure wizard. Then go to app dependencies and click plus in the right corner to add the :facebook module dependency.
Then make sure that in your root project build.gradle that it's using gradle 1.1.1 since some problems with importing has been fixed here.
dependencies {
classpath 'com.android.tools.build:gradle:1.1.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
Then referencing this answer was the finishing touch:
Can not import facebook-sdk 4.0.1
Then a pop should appear to upgrade buildToolsVersions to 21.1.1.
This is what it took for me to get this all working. Hope it works for you too!

Android studio no main activity, no layouts on a new project

I installed new Android Studio. I created new Project and asked the wizard to create main activity. But there were no layouts, no main activity class, no nothing. Error on trying to make new Java class files. The new project tree looks like this:
No (main/java) folder.
No (res/layout) folder.
Other words project is useless.
From what i learned is that you may be picking the "no layout" option when prompted to pick one. Try picking the basic activity and the rest of the files will show
After creating the project, you need to go to File menu and then Import Project. Then browse to the location of your project and import it. Then you will see all of these files and folders. I had this problem too, and it seems to be something that they overlooked in the newer versions of Android Studio (which is quite pathetic if you ask me).
Empty Activity
Choose "Empty Activity" instead of "No Activity",
while creating a NEW PROJECT in Android Studio.
I don't know if anyone is having the same problem right now but i solved this issue by changing the Android Gradle plugin version and the Gradle version.
For doing this you have to open the project you're having issues with and click on
File->Project Structure->Project
and there you will see the two options.
Android Gradle Plugin Version 4.0.0 and Gradle version 6.1.1 worked for me. After that I went to the file directory, right click on the package folder "com.example.myProject" and manually created an empty activity. The layout folder with my new activity was created automatically after that.
I found it's because I changed the Java runtime version before through the Android Studio plugin Choose Runtime. I changed to JDK 8 from JDK 11 then the problem occured. It worked for me to change back to JDK 11 through plugin Choose Runtime.
Try
Typing main activity (without quotes) in the search box and
Press enter.
For me it got restored. Search window is useful in finding many hidden tools quickly.
I created a new activity by right clicking on java then selected activity and the layout file was automatically written
When you open a new project, you can't select "empty project" you have to select and activity project. I just went through this had to delete my project and start a new one now everythings there.

Resources