I don't want to auto-format the whole project and get blame in files I have not edited in this PR.
Can I apply linting on only the modified files without manually having to find and select them?
If not, is there a good way to manually find and select all altered files in Android Studio?
I found a way.
Just select any file -> format -> scope -> All changed files
My project is configured with the usual builds: debug and release.
Unfortunately I'm having troubles creating build-specific Res folders: the debug Res folder is created correctly, while the release Res folder is created as a standard folder.
The procedure I followed is:
I selected "Project" in the top left dropdown
Inside App\src I created two folders: debug and release.
On each of these new folders: Right click -> New -> Folder -> Res folder -> (the correct path is shown) -> Finish
This is the result:
The Res folder inside release has the wrong icon.
I tried to use the release Res folder as is, placing the needed files in it:
Unfortunately, files in release\Res don't get recognized:
I tried to find a way to somhow "convert" a standard folder to a Res one, without success.
UPDATE:
As suggested by aiqency I tried ctrl+shift+a -> Mark Directory as -> Resource root.
Folder icon changes to the right one (with orange lines), but in Android view documents are still not shown for (release).
If i close and reopen Android Studio, Res folder icon reverts to standard one (no orange lines).
UPDATE 2:
I tried to update Android Studio to the latest version (3.6.1 build #AI-192.7142.36.36.6241897).
Then I created a new, no-activity project.
Same behaviour...
Any clue?
Thank you!
I filed a bug on Android Studio bug tracker.
They answered me that this is the intended behavior, this is their answer:
Only one variant is active at the same time (generally debug by default), so it's normal you do not see release/res as an active (re)source folder.
The view in android mode will also only show you the resources associated with the current variant so this is expected.
You can use the variant switcher (on the left border at the bottom) to switch between release and debug.
It's called Mark as Directory and you can access it from the action search menu.
It is mentioned Here
How can I hide the file path in android studio (it is captured on the screenshot)? I am talking about this:
app -> src -> main -> java -> com -> son...
Sorry for the stupid question but I didn't manage to find it it preferences and this path is not shown on my old mac with the same version of android studio.
On my Mac, I am able to hide the file path by going to the View menu, then unchecking the checkbox next to "Navigation Bar".
In Android Studio, project.gradle file is not show when in Android View, but is when in Project view
Android View
Project View
How can I fix this ??
From the Gradle Tool Window in Android Studio (View > Tool Window > Gradle),
Right click on the the project's Gradle config with (root) next to its name.
Click on Ignore Gradle project,
and right click again then click on Unignore Gradle project.
The trigger to this 'buggy' phenomenon actually lies outside your project folder.
Assuming a project name of 'SilverBirch', try this:
(a) Close the project in Android Studio 3.0.1.
(b) Rename your project folder (inside the workspace folder) to 'SilverBitch'
(c) Re-open it via Android Studio (you obviously can't do so using 'recent projects')
(d) You should get a window titled Import Gradle Projects with text that reads: The modules below are not imported from Gradle anymore. Check those to be removed from the ide project too:
(e) Tick the (old) project name and click OK.
(f) At last your 'Android' view shows build.gradle(Project:SilverBitch)
(g) Repeat whole process, renaming back to original.
Alternatively, if you're insane, do this:
Locate the project.dat file AND folder for your project - it will have a path that looks something like this (assuming Windows)
C:\Users\<userid>\.AndroidStudio3.0\system\gradle\Projects\5be1ee38\project.dat
[The system-generated hex-string container name will vary, but the file is always project.dat]
The first line of this file references the 'missing' build.gradle and will clearly identify the owning project.
Delete the file AND its containing folder then re-open the project via Android Studio.
Because googling 'project.dat' yielded nothing, and because I made a rude assumption that this contained only system-generated data, and because I couldn't resist 'seeing what happens' I actually deleted
the entire Projects file [C:\Users\<userid>\.AndroidStudio3.0\system\gradle\Projects]
So far, so good - no serious side-effects yet! Maybe those plugins needed re-specifying anyway? etc.
Close Android Studio -> Remove project .idea folder -> Open Android Studio -> Open your project. This worked for me!
NOTE: when you remove .idea folder you will also lose project related preferences (such as XML code style for project)
Right Click on "Gradle Scripts"
Click Load/Unload modules
Load unloaded project module
Done
In my case, I found that my project.iml located in project/.idea
So I move it to project/
and change one line like following:
<module fileurl="file://$PROJECT_DIR$/My_Project.iml" filepath="$PROJECT_DIR$/My_Project.iml" />
the old one should look like this:
<module fileurl="file://$PROJECT_DIR$/.idea/My_Project.iml" filepath="$PROJECT_DIR$/.idea/My_Project.iml" />
After that, go back to android studio, every thing seems perfect!
This worked for me:
In your root project folder, open the *.iml file, and make sure that the value in module external.linked.project.id=, the *.iml filename, and the project directory name are all the same.
Now my build.gradle (Project: X) shows.
This worked for me.
Simply go to your AndroidStudioProjects Directory.
Search for your Project
Rename it with some other name
Strat your Android Studio, and then Import Project (Gradle, Eclipse ADT, etc.)
mode. let the Gradle Build Finish.
And that's it.
Intellij - How do I change the file extension of a file from within the IDE? I want to change a file from .java to .groovy, but I can't figure out how from inside the IDE.
Use project view -> right click on file -> refactor -> rename file
By default there is no shortcut assigned to this refactoring (Using Intellij 12.1.6)
Refactor | Rename as CrazyCoder mentioned does not work for me. The file extension is not displayed.
Use Refactor | Rename File….
This action has no default shortcut, but you can assign one in the Keymap settings.