Android Studio reformat code shortcut not working - android

This is my keymap config in Android Studio. I used to use Command+Alt+L to reformat code after I write a bunch of code and it has been a habit of mine. But this shortcut is no longer working, the Show Reformat File Dialog(Alt+Shift+Command+L) works!
This shortcut is so important to me and I don't want to change it to something else, any idea?
PS: I have an external keyboard plugged in to my Mac when I'm at home. Last time this happens was when I'm using the external keyboard, so I unplugged the external keyboard, not fixed, and then I restarted Android Studio, not fixed, then I rebooted the system, worked. This time I rebooted the system, not fixed, invalidated cache and restarted, still not working. I tried to remove the shortcut and add them back, but I'm not able to add shortcut with Alt and Command both pressed, I can add Alt+L and Command+L, but not Alt+Command+L, so I gave up. Then I changed the keymap setting to something else like Eclipse's and change it back to Mac OS X 10.5+, not fixed... The last option I will try now is to uninstall the AS and reinstall it.

Related

Android Studio commands not working on Mac

After upgrading MacOS and Android Studio, a lot of the menu and shortcut commands I rely on no longer work. For example Shift-F6 for renaming vars (I tried from the menu and shortcut). Also, things like Cmd-Shift-o to search a list of files. I would expect equivalent menu options to work, but they don't.
Here's my setup:
Android Studio Dolphin | 2021.3.1 Patch 1
Mac Ventura 13.1
Preferences -> Keymap is set to MacOS.
I use an external Logitech Bluetooth keyboard.
I'm a longtime AS user and I have a second, nearly identical setup, with an external keyboard, on another computer, which all works fine.
I've tried all the usual stuff like rebooting and invalidating caches.
I tried reinstalling AS, just the app, not all the settings files, etc.
Before I try to completely wipe out AS, which I'm not sure will work either, I would be very grateful for any suggestions.
You should also press fn button if you have one on your keyboard.
Or try to turn it off:
Choose Apple menu  > System Settings.
Click Keyboard in the
sidebar.
Click the Keyboard Shortcuts button on the right.
Click
Function Keys in the sidebar.
Turn on “Use F1, F2, etc. keys as
standard function keys”.
Seemed like AS needed a total reset. I found this SO posting.
To restore the AS default settings:
File> Manage IDE settings> Restore defaultsettings
This fixed key mappings that didn't include the FN keys. To get those to work I had to toggle the FN lock button on my keyboard. That button does not turn FN keys on/off, but switches them between different mappings.

Android Emulator Scroll Down Doesn't Work in Home Page

I am new in Android Studio. I am using Android Emulator for call rest API for my backend. Before, i scroll down basicly in main android page. But after i wanted to tried scroll down, as if i right clicked, Home Setting, Widgets and Wallpaper pop-up show me. What is the solution about that. I never changed any setting.
Thanks for reply.
It looks like your emulator is frozen. It happens quite often.
I would suggest you to try these:
Restart your computer and try to run your app in the emulator. After it successfully runs, now try to clear the app cache.
If that didn't help, create another emulator. I recommend to choose different device and API level than the current emulator device but it is not necessary. This should solve your problem.
Tips
If you want to clear data, clear cache, uninstall app, clear cache and restart the app and so many such actions from android studio without touching your emulator then you can use ADB Idea plugin.
For that, in android studio go to Settings -> Plugins
search for ADB Idea in marketplace. Install it.
You need to restart android studio.
To use it:
You can press shift key in your keyboard twice and search for Adb in search window. You will get all the options from the plugin
From android studio menu... Tools -> ADB Idea and then you will see all the options available.

Android Studio 2.1.1 running old .apk file

Start of with, I tried all the suggestions in SO and none helped me.
Suggestion1,Suggestion2,Suggestion3.
I'm doing some debugging (Just running the app on my device through Android Studio) and I noticed that time after time, changes that I made in the app does not applied to the .apk AS is running.
The only solution I know is to delete the app from my device and then running again and it compiles with the changes I made in the code. Alternatively, I restart Android Studio and it fixes that too.
I try all suggestions on the site including: file -> invalidate Chaches / Restart -> invalidate, and changing my Run -> Edit Configuration settings but turned out unsuccesfully.I also read all the documentation here but It just repeats the answers here.
My Run -> Edit Configuration
So what's up with Android Studio not applying my code changes?
EDIT:
So for now still no fix suggestion is working. Even my File -> Invalidate Caches / Restart -> Invalidate and Restart not working either.
There is a bug with the new Instant Run feature, the app is not reloaded correctly.
You can disable Instant Run in File > Settings > Build, Execution, Deployment > Instant Run and uncheck the first checkbox. Now when you click the Run button, the app will be refreshed correctly.
How do you deploy the changes in your app to the device? I used to do it by pressing the green triangle (the "play" button) which is the first on the right from the name of the app in the top toolbar. In the new AS version, when you make changes to your app, that button gets a small thunderbolt icon next to the green triangle, like here:
This new icon means that AS will try to do an "Instant Run", ie. to make a hot swap or a warm swap to your app as it is running. Sadly, this hasn't been working as advertised for me (I have been using the new AS for a week now). Instead, I go for the "ReRun selected configuration" button, the fifth on the right, with the gray square and the curved arrow in order to send the changed .apk to the device.

Eclipse issue with ADT plugin

Does anyone know how to repair/clean install eclipse?
My version of Eclipse Juno with the ADT plugin has been behaving very strangely, but since Eclipse runs straight away without installing, I don't know how to reconfigure it to its initial state.
I was working on an Android layout when I noticed that lines of xml layout code was disappearing as I typed. The code itself was not being deleted, it just wasn't displaying - sometimes I couldn't even see the code I was typing or it was looking as if it was overwriting something else.
And the final straw just happened now. Somehow, my keyboard got stuck on the Ctrl button via eclipse. So after I quit the program, my Ctrl button was still pressed in. So trying to type "s" in notepad was bringing up the Save dialog and when I opened Word, it asked me if I wanted to start in safe mode since the ctrl key was being pressed. The solution was to restart my laptop (this bug was still present when I plugged a keyboard in before restarting)
Did you try eclipse -clean from command line.
If that doesn't help try reinstalling the ADT plugin by first removing it from Help -> About -> Installation Details and then reinstalling following the instructions at http://developer.android.com/sdk/installing/installing-adt.html
Perhaps Ctrl getting stuck wasn't the final straw, but the whole problem? This sort of thing happens to me fairly frequently (in Windows). Control, Shift, Alt get stuck down causing confusing behaviour. What's actually happening is that for some reason the key-up event is getting lost, so the OS thinks the key is still down. It happens especially often if you're alt-tabbing into a VM, or using a hardware debugger (where the key up happens within the debug session).
The solution, whenever you think this is happening to you, is to just press all the modifier keys one at a time (left shift,right shift, alt, left control, right control etc) so the OS knows the state of them. No need to reboot the PC.

Why doesn't logcat show anything in my Android?

Why doesn't logcat show anything in my Android (while developing apps with Eclipse)?
It just doesn't print anything. It's empty.
I had this same issue but my fix was much more basic:
If the LogCat panel is empty in Eclipse the emulator doesn't have the focus. Go to the DDMS perspective and try clicking on the 'emulator' entry in the Devices panel (top-left screen).
Dial
*#*#2846579#*#*
and you will see a hidden menu. Go to the Project Menu > Background Setting > Log setting and define the log availability (log switch) and level (log level setting).
Please note this may apply to Huawei phones only as is stated for an Ideos X3 (here) and is tested at a Honor U8860.
If clicking in Devices panel doesn't bring the spam, use reset adb in dropout menu from triangle on the right of the snapshot button.
I have the same problem on/off and the way I solved is by menu File → Restart (restart Eclipse).
Maybe you have Mylyn installed?
http://code.google.com/p/android/issues/detail?id=1808
While the answer provided by MoMo will resolve the problem temporarily it will most likely reoccur the next time you launch Eclipse, or launch on a different Emulator/Device.
Instead of always having to select my device in the devices view I've found a better solution is to go into your Eclipse preferences and navigate to Android -> LogCat in the list on the left and then enable "Monitor logcat for messages from applications in workspace".
This way no matter what device you are using logcat will automatically start showing output from it as soon as the application launches.
It will also setup a filter that ensures that only output from your application is displayed, which you can reuse / disable as needed.
Maybe the log is not enabled in your device.
Try to run the following command.
adb shell
echo 1 > /sys/kernel/logger/log_main/enable
OK. This is how I got it to work. I first followed MoMo's advice, that is...
If the LogCat panel is empty in Eclipse the emulator doesn't have the
focus. Go to the DDMS perspective and try clicking on the 'emulator'
entry in the Devices panel (top-left screen).
But to no avail.
I then attempted to reset adb (Android Debug Bridge) as suggested by fyodorananiev.
How? Menu Window → Devices → upside down triangle menu button → Reset adb.
It also didn't work, but I did get the following message:
Android hierarchyviewer: Unable to get the focused window from device
This meant that MoMo was right in that my Android device or emulator didn't have focus. However, the solution I did in my case is different.
What worked for me:
Replugged my Android device, which was connected to my computer via USB.
Restarted Eclipse, as mentioned by Abu Hamzah (although since I didn't know I can do menu File → Restart, I manually closed down Eclipse, and then restarted the application again.)
I can now see logs in my logcat.
Go to Developer settings and check that for Debugging\Select App for Debugging is empty
If you are using a device, the simplest check is to restart Eclipse.
You don't have to shutdown Eclipse
Use menu File → Restart
In a quick second or two you should see your LogCat return.
The simplest solution worked for me: Shutdown and restart my phone and Eclipse alike.
I had faced the same issue but in my case logs are shown when other devices are connected and not shown when my device is connected.
It took me days and finally, the issue resolved when I restarted my phone.
Below: Really dumb answer, but it happens!
My cat stepped on the space button while I was away and [SPACE]xN was typed in the search bar.
That resulted in an empty Log Cat. I tried restarting and wasted like 1 hour before I realized I should clear my search bar.
TLDR; CLEAR YOUR LOG CAT SEARCH BAR!
I think you haven't selected the device or emulator, on which running your application.
In Eclipse, go to DDMS Perspective and select the device or emulator on which you are running your application.
(Note: No need to restart Eclipse)
In case if you are using CyanogenMod in your mobile, it will disable logging by default. Try this method:
In your device, open "/system/etc/init.d/" folder
If there are many files, try opening each file and find for this line:
rm /dev/log/main
Now, comment this line like this: # rm /dev/log/main
Save the file and reboot.
It gets interesting when you find out that none of all the answers in for this question were helpful.
And then you find out that in your version of ADT 22.6.3.v201404151837-1123206 if you add two filters with the same package name (application name) then the log will not appear.
It was weird, because the log was there two seconds ago, and launching the app in debug mode adds a default filter for the app which collides with the filter I've setup manually, and then ADT magically removes all the logs, and none of the filter worked including the all messages (no filters)!
But it was masking another issue...
I'm working with dual screens. The second one is connected via VGA/RGB - (not really sure what it's called) and what can I do. I'm a ton more comfortable with the logcat away from my code editors, so I've placed it in another window, and as it turns out that is the main reason for the disappearing logs for me.
If using the DDMS to refocus doesn't work, try closing and restarting LogCat. That helped me.
I've had this happen occasionally. Closing and re-opening Eclipse seems to fix it.
If you tried all of the others, and still got losing on an empty logcat. I got another simple way.
Download an old version of ADB, and try again. It might be working, at least working for me with Android 7.0 phone (vendor stopped updating).
Here is the useful link for old versions.
I had the same issue. No need to restart Eclipse or clean your project. You may follow:
Click on LogCat icon on bottom right corner of eclipse.
In Saved Filter Pane (Left side), double click package of your project (in my case it's com.apps..*).
In Logcate Message Filter Settings popup, select desired option of "by Log Level". You can select verbose, info, error etc.
Click Ok.
Run/Debug your project.
This is simple.
Just close the Logcat from eclipse.
Then reopen it by following steps in Eclipse.
Window - Show View - Other - Android - LogCat - ok
Hope this solves your problem.
Many times when I switched to a new Android device, I do see no more logcat messages. Unfortunately, none of the above suggestions worked for me (Eclipse Photon 4.8.0).
I am now using this . It seems to work for different devices.
Check if the Console is telling you something. Usually this happens when the project could not be installed in the device, and just shows the previous one.
The most common case I have seen this is when there are different signatures in the project, and is not running at all.
Please, read all the red letters you see. If the LogCat does not show anything, take for sure that the Console will do.
For OnePlus devices and Ubuntu OS:
Install Wine on Ubuntu
Install ADB tools on Ubuntu
sudo apt-get install android-tools-adb
Now, attach your device to PC with USB.
Open mounted "One Plus Drivers". A disc like icon
Right click on OnePlus_USB_Drivers_setup.exe and run with Wine
Then open the terminal in the present drive where your "OnePlus_USB_Drivers_setup.exe" and other driver files exists. And run
./adb_config_Linux_OSX.sh or sh adb_config_Linux_OSX.sh
Close this terminal
Open a new terminal and run
adb server-start
Your OnePlus device should prompt you to recognise your PC as a debugging agent.
Now, run on the terminal. It should show your device.
adb devices
Reference: [SOLVED] Android Studio does not recognise my One Plus Two in Linux
Set the same date and time in your Android phone and in your laptop.
I had a similar problem of logs not showing, and when I set the correct date in the phone I started seeing the logs (I restarted the phone and the hour was completely wrong!).
What worked for me besides restarting Eclipse was:
Remove custom filters
After removing all filters, logcat was filled with text again
Close logcat and then reopen it from Window → Show View → Others.
If you're using Eclipse v4.5 (Mars) (at least, Mars.1 or Mars.2), try the solution described here: Logcat show invisible messages in Eclipse Mars.
It helped in my case.
In my case (after trying all the answers provided here to no avail), the problem (and solution) has to do with port 8700:
What I needed to do is:
Exit "Android Device Monitor" (monitor.bat)
Exit all instances of Eclipse.
C:\adt-bundle-windows-x86_64\sdk\tools>..\platform-tools\adb.exe kill-server
C:\adt-bundle-windows-x86_64\sdk\tools>..\platform-tools\adb.exe start-server
C:\adt-bundle-windows-x86_64\sdk\tools> monitor.bat
Also, the Scroll Lock button, needs to be "pressed/active":
Not the other way:

Categories

Resources