How to import .XML code style into Android Studio - intellij-idea

I'm using Android Studio on OS X, and want to import intellij-java-google-style.xml for my code format.
But I can't find import at Preferences -> Project Settings -> Code Style -> Manage only Save as, Delete, Copy to project, and Close there.

Copy intellij-java-google-style.xml into the directory $HOME/Library/Preferences/IdeaIC14/codestyles/.

In the latest Android Studio (as of this edit, 4.1.1) you can go to Preferences -> Editor -> Code Style -> Scheme -> Settings Icon (Gear) -> Import Scheme... and import the xml there.

I am using Android Studio 1.2 on Ubuntu 12.04 and in my case I have an .AndroidStudio1.2 folder in my home directory. In this folder there is a config folder. What I did was the following:
I created a new folder called codestyles in the config folder.
copied my style xml (in my case named AndroidStyle.xml) into the codestyles folder (.AndroidStudio1.2/config/codestyles/AndroidStyle.xml)
Went into File>Settings>Editor>Code Style
Chose the AndroidStyle among the listed Schemas.
NOTE: Android Studio does not give you an option to import the xml file. And before you add the file to the codestyles folder there is NO indication that you can change the Schema to your own in any way. But after you have added the file the added schema will be shown among the other schemas.
NOTE 2: In other Operating systems this folder is located elsewhere. For more info on configuration folders see here: http://tools.android.com/tech-docs/configuration

If you are on Android Studio Preview you will need to copy your style xml file to:
~/Library/Preferences/AndroidStudioPreviewX.X/codestyles
where X.X is your Preview version ie. 1.4

Also, for those who use Android Studio on windows. Copy your xml file to $USER_SPACE$\.AndroidStudio1.X\config\codeStyles. If you don't have the codeStyles folder, just create one. And then you will see it in Settings->Editor->Code Style->Scheme.

Here are steps I used to import my coding style for a project.
Place codingStyle.xml to .idea folder under your project.
In Android Studio select Project for coding style scheme, click OK.
Place original codingStyle.xml to .idea folder again (Android Studio most likely had overwritten with default settings your codingStyle.xml when you click OK on step 2)
Restart Android Sturdio.

Related

Why can't I save some editor config settings to the local file?

Looking at this question: How can I use a file-scoped namespace declaration in a class template?
The answer shows an example:
But when I add a file "Editor Config(.Net)" to my project it doesn't look the same:
many settings are hard-coded to Location = Visual Studio Settings
the severity options do not match that screenshot at all
I am also using VS2022 like the other question (Pro version in my case). What is going on? There's no point me adding a .editorconfig file to Git under my project if the settings I want to change aren't stored in that file.

IntelliJ IDEA Ultimate project loading issue

So, today in the morning I closed down IntelliJ(2017.3.3) after doing some programming as usual and everything worked great. Now suddenly when I try to open any of my projects this is the view I am greeted with:
After searching for a solution for this issue I managed to get the projects working by doing the following steps:
File -> Project Structure -> Modules -> + -> Import -> The project .iml file
File -> Project Structure -> Project -> Project SDK -> Java 8 in my case
File -> Project Structure -> Project -> Project language level -> 8
File -> Project Structure -> Project -> Project compiler output -> The path to the out folder of the specific project(the whole path from D:\ to it)
Navigate to Main class in project structure and alt+enter to add it to run configurations.
Finally able to run the project
Now this would be fine if I had to do it once, configuration corruption or whatever happens, but I have to do this every single time I open a project for some reason. I tried restarting my PC, reinstalling 2017.3.3, installing 2018.1 and the issue persists whatever I do. Also there were no visible errors in relation to this issue in any of the above scenarios, steps, installs and so on.
Well it turns out the issue was related to me using OneDrive to backup my data. I assume OneDrive updated at some point and activated Files On-Demand. The issue is documented here. For me personally a solution that worked was:
Right click the OneDrive tray icon
Click settings
Click the settings tab
Disable the Save space and download files as you use them option under Files On-Demand.
Wait for your files to sync up completely, IntelliJ project load is back to normal.
I tried disabling Themed status bar in Material Theme Advanced Settings and it started working for me.
From: IntelliJ IDEA > Preferences > Material Theme > Advanced Settings > Other Tweaks Tab
Disable "Themed Title Bar" by unchecking the box here.

Can't see project folders in IntelliJ IDEA

Every once in a while, I open an old project and I can't see any of the folders in the intelliJ project viewer. I can see all the files at the root.. but no folders. Yes I can delete the .iml file and .idea folder and re-create the project, but come on.. there's gotta be an easier way to fix this.
Is there?
If you look in project settings (ctrl-shift-alt-s), you should see a module structure. If you instead see "Nothing to see", do the following:
In Project Structure -> Modules, press the + button,
press enter (since, for some weird reason, it won't let me click on "New Module")
In the window that pops up, click on the "..." next to Content root, find your root folder, and select it
Press ok
ignore any warning that says the name is already in use (or to that effect)
the simplest solution worked from me, just delete the .idea folder
keep in mind this will delete all of idea's current project configuration, it'll create the folder with default settings when reload the project again... but all other configuration will be lost if not properly backed-up
It might be because the project didn't have any modules defined. Try adding existing source code by hitting File > New > Module from Existing Sources and select the parent directory of the project for source code
Go to pom.xml file -> right click -> maven -> generate source and update folders. You will see your files and folder structures in left hand side.
All the project-specific settings for a project opened through Intellij IDE are stored in the .idea folder.
The .idea folder (hidden on OS X) in the solution root contains
IntelliJ’s project-specific settings files. These include per-project
details such as VCS mapping and run and debug configurations, as well
as per-user details, such as currently open files, navigation history
and currently selected configuration.
So, if you are not able to see the project file structure in your Intellij IDE, just delete the .idea folder,
rm -rf .idea
and reload the project, then after reload you'll be easily able to get your project structure displayed.
Thank you very much. I just remove the .idea folder and works in my case.
rm -rf .idea
For me, the java folder was not showing up. I went into File->Project Structure. In the second column, I selected on _main. In the third column, I selected the tab "sources". In what I call the fourth column, where the "+Add Content Root" is shown, I verified, the java source/folder was present. In my case, there was an extra source folder, which was the current location. I removed this, applied and the java folder immediately showed up.
Right click on the Project name -> Open Module Setting -> Check the application context path set it up at your project location.
Check your idea.log -- it may have some details explaining why or what is happening (Help | Reveal log in Explorer). Possibly one of the config files got corrupted.
You can always backup and delete .idea subfolder (project settings) and re-create project from scratch. When it's wroking again (after basic configuration) you may copy some of the files from that folder back to recover some of your settings (if there were many).
This happened to me on a new computer when I opened up a Java project in the newly installed Intellij.
The problem was that I had not installed any JDK on the machine.
I had to install a JDK and then go into the settings at ctrl-shift-alt-s and add a JDK by specifying the folder where I installed it. It's possible that IntelliJ would have found it if I closed it and reopened it.
In my case the solution was to create a new project, specifying the project type and creating it within the same directory path as the project that does not load the project files correctly.
PhpStorm automatically detects that the directory exists and gives you the option to create project from existing sources.
This can be found under:
File --> New project...
For gradle users: "Reload All Gradle Projects" option should help.

Cannot find/open Bing Maps module Orchard

When installing the "Bing Maps" module into Orchard 1.6 (source version) the module does not show up under modules in solution explorer.
Other modules are simply found in the root under Modules but for some reason this module is not.
It is located on the following location: C:\Orchard\src\Orchard.Web\Modules\Bing.Maps
How come its located here and not showing up in the Solution Explorer (The Orchard.web does not show modules in solution explorer)?
For installation i just went to admin dashboard --> gallery and install.
I need to edit this module because its having troubles with my regional settings, but i do not like editing files i cannot open in solution explorer (when opening through file/open file many lines are marked in red).
Thanks.
Modules are always physically located on the filesystem under the path e.g. C:\Orchard\src\Orchard.Web\Modules\SomeModule When you install a module, the files are copied to this folder.
The root Modules folder that you refer to is a solution folder used in visual studio to organise projects within the solution explorer. Projects can be moved to these virtual folders without affecting their location on the file system. To add your new module to this folder in Visual Studio solution explorer, right click the Modules solution folder and select Add => Existing project and select the project file for your new module.

IntelliJ-IDEA: how to enforce same code style

We are using IntelliJ IDEA 10.5. How can we ensure that everyone is using the same code style and Rearranger configuration? What files should be put under version control?
You should share most of the files in .idea directory when using the directory based format, check the FAQ.
In the Code style settings make the current scheme project specific, it will be stored in .idea/codeStyleSettings.xml (or project .ipr file when using the legacy format).
Rearranger is a third-party plug-in and as far as I know doesn't store its configuration inside the project. It has options to import configuration from a file and export it to a file which you can use to maintain the same configuration by putting this file in the version control.
Note that IDEA 12 will bundle a new Rearranger plug-in which will have better configuration management (similar to the code style settings, or a part of it).