When using Android Studio, I want to be able to just put the mouse cursor on top of a code word with a compiler error and get a drop down list with fix suggestions. Right now in order to open that list, I must press ALT + ENTER. How can I make Android Studio to open the list automatically when the coursor is above the error line?
In your Android Studio go to:
Settings > Editor > Code Completion and check in 'Autopopup code completion'
You might check as well the other options in the tab - e.g. delay in ms.
It seems that there was an update to the Android Studio and this feature was added. You need to play with the error line a bit (sometimes there's a need to press it a few times) and then you'll get the option to view code fixes.
Related
In previous android studio releases we used to have a button (in the bottom right side) that would enable you to disable inspections and do syntax check only .
But since I have updated to android studio arctic fox I am unable to find this button any more (I am not sure if it is disabled by default or if I have somehow disabled it).
is there a way to achieve this ? or add this shortcut back again .
Kindly check the images below .
Finally I was able to find out how to do it by chance .
From the top right side of the IDE where you type your code . There is a small area that provide counters of errors and warning within the file .
click on it .then click on highlight options.
you have 3 options : None, Syntax and all problems .
checkout the screenshot for more details .
I was targeting SDK version 21 or 22 in one or my old projects.But now I have updated to the latest SDK version. Now I can see a lot of redundant casts of views (As view casts are redundant now). Is there any alternate to remove all those redundant casts at once Via any short cut way rather going through each and every file and remove? I am using Android Studio version 3.2 now.
Pressing ctrl+shft+A will open action dialog. In it type clean in and from suggestion list select Code Cleanup. This will open a separate dialog from which you can select your relative scope. Select which option suits your need and press OK.
Right click on directory which you want clean up.
Select Analyze > Code Cleanup
Click OK.
Here you go!
Select Your Project folder or app (according to your project explorer view)
Select Analyze from menubar
choose option Code cleanup or silent code cleanup .
Where Code cleanup prompt you dialog with options like Project or module and silent code cleanup cleanup without displaying the Code Cleanup dialog. from currently selected project or module.
I'm following the course "Developing Android Apps" on udacity.
I have a problem on Lesson4A with the test suite (TestUtilities) complaining "Task 'cleanTest' not found in root project 'Sunshine'.
And then it points me to run with --stacktrace option.
But I don't know how I can run the command on the terminal in the first place.
How can I see what gradle-tasks that android studio is running?
Thanks :)
At the bottom right corner of Android Studio you have different views:
Gradle console
Event Log
Additionally, if your Gradle is running, will appear a 3rd one where you can see a progress bar with some information about the process. But if you want a full details use the 2 first views.
I believe you have not do the configuration at first, as the default configuration is not appropriate for this project.
Select Edit Configurations next to Run button on toolbar
Make a testing configuration, by click the + button and select Android Test.
Make sure you choose "Show Chooser dialog" in target device section if you are using Virtual devise like Genymotion
Hit OK and press the run button.
PS. Make sure your have this configuration under Android Test, and nothing under JUnit dropdown.
I was confused at first, but not anymore after I tried above steps from Udacity notes.
I have a question transitioning from Eclipse whenever I start to type something for a string or even for a Log.d i would get "" to automatically appear, which I've found out how to do this in Android Studio no problem, but in eclipse I use to be able to hit [TAB] and it would instantly jump outside of the " on the end so I can continue to type quickly anyone know if this is possible in Android Studio?
Unfortunately, this is currently not supported in Android Studio. The closest command to the desired behaviour would be Complete Current Statement (Ctrl+Shift+Enter) which only really works if you have only one parameter.
I renamed a project in Eclipse via 'Refactor > Rename' as suggested in this answer.
I now want to rename it again, but the Refactor menu has only one menu item now (Android > Extract Android String...) which is also greyed out!
I am using Eclipse 3.6.1 with the latest Android SDK 9.
Why is that and how to I restore this to normal?
Update (1): After following Sankar Ganesh's suggestion (selecting a string), the Refactor menu appeared again. I then selected the Rename... menu item again and I received the following error message box:
This is much better than the previous situation, in which I had no idea why the Refactor menu had been disabled and what to do. Still, I don't understand why this is and what rules I should follow when using the Refactor function. I only wanted to rename a project... that's all. :)
Update (2): I just tried the same exact operation again again (Refactor > Rename while the project is selected in Project Explorer) and it worked! (without issuing the message box shown above).
What's going on?
Must be a bug, because this is clearly inconsistent.
I was wonder,why you struggling for Renaming a project,
if you want to rename your project, then simply you can select your project, then click refactor menu, then Rename, that's it
step1:
Step2: Now see My project name is updated,initally it was friend finder, now friendfinderupdated
Also , you can use Extract Android String for Valid Java Identifiers and not for packages and files, because see window here
Pls select a String in your java code and do that Refactor -> Android -> Extract Android String, now you can see dialog, what i had shown below
and see next image
Mystery solved!
The problem turned out to be that I was trying to 'Refactor > Rename' while in the Resource perspective.
Once I switched to the Java perspective, this (inconsistent) behavior didn't repeat itself and I was even able to check the Update references checkbox.
Wow!
(thanks #Sankar Ganesh for posting the snapshots, because that allowed me to notice that there is an "Update references" checkbox and that the text on your caption bar is different than mine)