How to create new project in Android Studio? - android-studio

I want to create new project in Android Studio.
But There is error message.
There must not already be a project at this location
But There is empty folder at 'this location'

You have to delete the empty folder.
What the error message should say is "There must not already be a folder at this location". The location you specify for the new project must not already exist, because the new project wizard wants to create the folder itself. This makes the whole idea of selecting a folder using the "..." button pointless, you can't select an already-existing folder for the project. It must be a non-existing folder in the "Project location".
I've just spent quite a long and frustrating time figuring this out.

EDIT: Disregard that, it made a project in the default dir, not the place I specified :(
I had the same problem.
The only way I could do it, is to delete projects at the default location (so when I go into Create new Project dialog it won't show me this crap right away). Then enter all the settings for my project and at the very end just paste the path to new project location right into the path field (not select it with their folder picker) and then hit Next.
It's very important to paste path and hit next at very end, so studio won't have time to validate entered path (it will, if you'll try to change some other fields)

Related

xcode 8 delete old objects

for a few minutes i had an second version of my core data:
this entry isn't available and i would like to delete it.
but i didn't find a way to do this? how can i delete this old unavailable object?
I suspect the reason your have the scenario is that you have 'Add a Model Version' in Editor and some how hit cmd+delete on the model in the master folder in Finder. You still have original version 'CoreData.xcdatamodel' in your master folder. Here is the how you can clean up the Project Navigation.
1) In Xcode Project Navigator, Right click *.xcdatamodeld and hit 'Delete'.
2) Still in Xcode, put mouse over either project name or group name ( first create a new group under your project. e.g 'model'), then right click and select 'Add Files to "ProjectName"...
3) A Finder window will open. Navigate to your *.xcdatamodeld, select and click 'Add'
4) Now you should get back *.xcdatamodeld file in Xcode Project Navigator clean without red V2 model.

changing the company name of application in android studio

when i created the project i have entered "atoa" in the company domain, and now my package name is "atoa.myApplication".i have tried to change it from the manifest and then move it but it didnt work. all the solutions i found are for changing "myApplication" name but i want to change atoa.myApplication to com.myApplication
Go to AndroidManifest file
Here, put your cursor over your package name "atoa.myApplication", don't select just place cursor over the word you want to rename (For eg: atoa) and
Press shift+F6 you will get a popUp for Renaming your package. Write your new package name and refactor.
Goto App->build.gradle
Change it in there and make sure to resync!

TortoiseSVN - New files are marked as ignored rather than unversion

I am creating new files on my project but for some reason they are marked by TortoiseSVN as ignored by default rather than unversion, so I keep check changes in without new files then I have to go manually to the folder right clicking on the file to add it to finally check it in, this make the whole process really annoying.
Any idea?
Regards
Possibly you configured to ignore all new files unintentionally.
Click the right mouse button in the project folder and then select TortoiseSVN > Properties.
If there is a property "svn: global-ignores" with Value "*" or "*.*", remove the property or edit it to remove the two mentioned values.
These files are ignored due to (some) ignore-rules. You have to detect this rule, if you don't want to continue adding files by hand

How to create new res folder in Android Studio

I want to add localized strings for my android app. Therefore I need a values-xx folder in my Res folder.
The original values folder has a blue dot, so I tried creating a new Package, but a package can't contain a hyphen so this must be wrong. Instead I tried right-clicking res and choosing New -> Android resource directory, but this time nothing happens. No dialog or reaction of any sort as I can see.
How do I create a values-xx folder?
Edit: I can create the folder from file explorer and it all works good. It is just irritating to not be able to do it from inside Android Studio.
Edit2: This bug is fixed in newer versions of Android Studio.
When you are in the Android view (rather than Project or Packages) in Android studio, you just need to right click the "values" directory and choose New > "Values resource file".
That gives you a chose of different resources you can add. For example, if you want to add a different language to your app you can choose the Language option and press the ">>" button. If you want Swahili then select that from the list, type "strings" for the file name, and press OK.
Android Studio will automatically create a values-sw directory with the new strings.xml file in it. And in your Android file view you conveniently see both strings files together.
And it is a similar process for adding other types of resources (see my other example). You no longer have to manually add the directories (but you can do that too by right clicking the res directory and choosing New > Android resource directory).
I had the same problem, what I did was create a values-xx folder inside the main directory (main>>right click>>new>>directory) and then moved that folder to res/ directory.
It's not beautiful but it is a workaround to create a folder with Android studio.
This bug is fixed in newer versions of Android Studio.
The values-xx folder we created is not showing, but when we create a file its asking
=>I have created values-21 folder and then tried with creating an xml and it asks for choosing a directory
=>I have updated to Android 1.02
Check the values-21
Lets assume i Want to create a folder named "Daylight" under res.
Step 1:
Right click on res.
Step 2:
Then go to New.
Step 3:
Then go to Folder.
Step 4:
Then go to Res Folder Option and select.
A window will be open.
Step 5:
At that window check the unchecked box "Change Folder Location"
and as assumed we have to create folder "Daylight"
Step 6:
SO name the newly created folder as daylight, in this format. src/main/res/Daylight
Step 7:
Then, Finally Click finish.
If you have already created a new directory but just don't see it in the Project Tools window. Do this
Click on Project Tools window >> Android(Drop Down) >> Click Project.
Now you'll see all your Directories in res. See the picture:
Its very simple. I too had trouble initially.
Lets break it stepwise:-
1) Open your project
2) Right click the res folder
3) Choose New
4) Chose Directory
5) Name the directory.
Thats it!! It works for a fresh project everytime!
For those finding this answer when trying to add a new res folder to a library.
Right-click java/kotlin folder > New > Folder > Res Folder

Add an already existing directory to a directory in Solution Explorer

I want to add an already existing directory to a directory in Solution Explorer, but whenever I right-click on the directory and select Add => Existing Item, I can only add individual files, but not directories.
How do I add an already existing directory to a directory inside a Project inside Solution Explorer?
Click the 'Show all files' button at the top of the Solution Explorer and right click the folder desired and select 'include in project'.
Drag and drop the folder from Windows Explorer onto your Visual Studio solution window :)
Source here
or simply copy & paste into solution explorer.
VS 2012 seems to distinguish between 'Solution Folders', which are only folders containing either other solution folders, or containing project folders. The drag-and-drop works (with my settings) only for the project folders, and no for the solution folders.
If I add a new solution folder, nothing happens on the machine. If I drag-and-drop a machine folder to the main Solution, it refuses to accept it. If I drag-and-drop the folder to a Solution Folder, I get an error message saying this cannot be done.
Some other answers are missing an important point: if the folder is not in a project in the solution it is impossible to add the folder
This is the solution:
1) Add a new folder to the sln - it does not care that the folder already exists on the disk because this a virtual folder in the sln
2) Add the file to the folder using "add existing files"
When dealing with a solution level folder that has been removed for some reason, and now needs to be added back, open the .sln file in a text editor like notepad++.
Find your "FolderName" in the section that looks like this...
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "NewFolder1", "NewFolder1", "{73ED84FC-F250-4CCC-B267-34CEB67F2883}"
EndProject
Delete from "Project" to "EndProject" ONLY for the specific Project/Folder you're having trouble with.
You may get a message in VS2012 that says your solution has been modified by an external source. Choose the option to "Discard" your changes for the external changes. Lastly, add your solution level folder, and add your project(s) to that folder as existing items, drag/drop them, or copy and paste them, according to your preference.
For those who had a hunch it could be done but weren't able to do it, NOTE: Drag Folder or Files ONTO the name of the Project Name in Solution Explorer in the least
Expand the "Project" item in the menu bar and select "Show All Files". Then locate the folder you wish to add in the Solution Explorer (folders that are not currently included will be light grey with a dotted outline instead of the usual solid icon) right click the desired folder and select "Include in project"
Once finished select "Show All Files" from the Project menu again to return to the regular view.
(This is very similar to Radenko Zec's answer, but does not require the "Show All Files" button to already be present in a toolbar. I would just leave this as a response to his answer, but I don't currently have the reputation to leave comments.)

Resources