Can't click on emulator's buttons - android

I'm trying to use the Nexus S API 21 emulator on android studio, It works, except that the Buttons of the smartphones don't work.
Here is a screenshot :

You are using hardware keys instead. So I think esc and Home will work. If you want to enable the keys on the device, try hw.mainKeys=no in the emulators .ini file:
On OS X and Linux, you can find this ~/.android/avd/<avd_name>/config.ini.
Change line hw.mainKeys=yes to hw.mainKeys=no then restart your emulator.
At one time, there was a checkbox when you were creating the emulator to select to use hardware keys or not. I have since moved on to Genymotion, an excellent android emulator replacement. If you can get this to work, I recommend trying that.

Related

Is it possible to rename the emulator in Android Studio?

Is there a way to give an emulator a name in Android Studio?
In the emulator pull-down box in Android Studio, the emulators created from AVD manager are labelled simply: "Android SDK built for x86 (mobile)(emulator-nnnn)", where n is an integer.
If you're running multiple emulators, this isn't very helpful. Is there a way to rename each emulator to something more helpful? For example, when I created each emulator, they have names of e.g. "Pixel 4 API 29", and "Nexus 5 API 24" - why aren't these used?
Update: Two screenshots show what I mean. In the top one, the "Nexus 5 API" has been selected; yet it shows as "Android SDK etc". If I select e.g. "Pixel 4 etc", it shows as exactly the same (it actually has an emulator number added that only shows when you open the pull-down).
Of course you can edit the name of your AVD.
In the AVD Manager, clic on the pen to the right to edit your configuration and then, you can rename your AVD
Edit: There names are correctly shown in the pull-down menu, even if launched
Well what #Bruno said is the easiest way, if it does not work that way you can either try this one, is a little bit tricky though.
In case you use Mac that's an example of how to do it, if you do not use Mac let me know and I'll put the steps to do it on Windows / Linux
Open in Finder
user.name/.android/avd/
Pd: To be able to show the hidden files press ⌘ + ⇧ + .
Find your emulator, in my case I'll show this one :
Open the Pixel_4_API_30_-_Android_11.avd folder (in your case will be different) and open config.ini file and change these two params (AvdId,avd.ini.displayname)
And now restart your IDE and it should be updated.
I'm sure you could change more names, but to ensure the functionality of the emulator, I wouldn't touch too much if you do not know what you are changing.
Let me know if it works :)
You can not change the device name "emulator-nnnn" from Android Studio as that name belongs to the device. This is the name that you see in "adb devices" output.
For a real device, you have to change its name by opening the Settings app from the device.
For an emulator, in theory you can do the same, you open the Settings app inside the emulator when emulator is running. But I haven't tested this because my emulator is very slow.

Can't change emulated performance of AVD in Android Studio

I can't change the graphics to software as I'm sure this is the fix for my AVD not launching.
The option is greyed out (see screenshot). Has anyone has experience with this? I couldn't find anyone who had the same issue.
I'm running the latest version of Android Studio on Ubuntu 17.04.
Actually, this problem seems to be limited to devices with Play Store available, so Nexus 5X and Nexus 5 images will be forced to use Automatic Graphics, but all other devices allow you to choose either Automatic, Hardware or Software graphics.
edit: I've just tested this today and it seems to no longer be the case. At least on MacOS with Android Studio 3.3.2, I can now make a Nexus 5X image with Play Store and Hardware Graphics. I'll do more testing at home later, on Windows and Linux to see if it's related to OS or graphics drivers.
I also think it's related to whether the Playstore is contained or not, but I cannot explain why.
Dielson Sales already gave the answer which worked for me - unfortunately only in a comment to this answer. I just thought it's worth to make a "real" answer out of it:
Edit the config.ini file of the AVD. Under Linux it's located under /home/<user>/.android/avd/<AVD-name>/config.ini
(in my case <AVD-name> is Nexus_5X_API_29.avd).
In a text editor change the lines
hw.gpu.enabled=no
hw.gpu.mode=auto
either to
hw.gpu.enabled=no
hw.gpu.mode=off
or to
hw.gpu.enabled=yes
hw.gpu.mode=host
This setting remains even if opened in the Android Virtual Device Manager of Android Studio. It's just not editable there.
I also tried this, which I found in another AVD:
hw.gpu.enabled=yes
hw.gpu.mode=software
But this is then changed to "no" / "off" by the Android Virtual Device Manager.
I didn't look any further so far. hw.gpu.mode=off worked for me. Otherwise my whole Kubuntu hangs (using the Nouveau driver, not the NVidia driver)
Seems like the problem was with the choosen VM. If I choose a Nexus 4, it runs just fine.
I am little late on this thread but following are my findings and solution. I am using Ubunut 18.04 and faced the same issue. The solution is to edit AVD and under Emulated Performance, change the grpahics to Software. The problem was that this option was disabled for me. I was unable to change graphics drop down.
I did some more research and found that while creating AVD if you choose default/existing device definition on first screen, you will not be able to edit graphics drop down.
The solution is to create a "New Hardward Profile" while creating AVD and use your new profile. Now, you will be able to edit "Grahics" drop down.
Hope this helps....
It seems all emulators with Play Store cannot emulated performance. I am using AS 4.0
Open Android Virtual Device Manager Android Studio, change VMHeap to 512, RAM to 4096 MB. Then restart Android Studio.
I think It's just a bug!
Solved the issue by selecting any virtual device had the option enabled and after finishing the installation I just clicked on edit and reselected the device I wanted and the option was still enabled.
Click on edit button from here.
Then change the device to the one you want.
For those who are still searching for solutions on how to make it work with an image containing google play store: install / update your GPU drivers solves the problem. On my Ubuntu 20 this was the issue.
I'm working on mac os - after i upgrade my os my emulator stoped working and one of the solution was to change the graphic settings from hardware to software - since i couldn't - came here ---> turns out Android Emulator HAXM on macOS High Sierra is left out from security reasons
follow this link : https://developer.android.com/studio/known-issues#deploy

Is Adding custom android skins to virtual device missing in ADT Eclipse(Juno)

I'm using the Eclipse IDE (Juno 4.2) and the latest Android/Google ADK.
The ability to load/use custom skins seems to have disappeared. When creating a device in the AVD (android virtual device manager), it was possible to specify a skin from drop-down {skins had to be loaded into the sdk/android-##/skins}. The directory(s) are still there but adding skins does not allow/permit selecting it in any part of the virtual device creation process.
I'm running Eclipse Juno 4.2 on both a windows and mac os.
developer.android.com docs still show UI that for selecting custom skins.
Is is possible to still use custom skins is there now a restriction on skins?
The only way I've found to do this is to manually edit the config.ini file for your AVD. Change the field "skin_name" to the name of the skin you want to use and change "skin_path" to the path to the skin, relative to the sdk directory.
So if your skin was part of an SDK add-on, an AVD config.ini that looks like this:
skin_name=1280x800
skin_path=1280x800
Would be changed to:
skin_name=MyDevice
skin_path=add-ons\addon_device_vendor_api\skins\MyDevice
Or in your example:
skin_path=platforms\android-##\skins\MySkin
The Docs don't appear to have been updated for revision 21 of the ADT yet, so maybe they'll have more information in the future. I'd really like to know if there's a way to do this from within the Device Manager, but this is the only way I've found to do it.
After Update your ADT to version 21.
In Older Version each time you have to set Add Custom Screen if you want custom Device Configurations.
In ADT21 Oversion you can get this thing done by
open AVD Manager, u can define your custom screen in "Device Definition"
Alternative (Much Easier approach)
in Newest Version you Don't Need to Set Custom Device
Configurations from the above Suggestion as much easier way is available for it. you >Just Have to Make Emulator With your Device
Configurations and after you will see those Configurations with
Emulator Name Inside Graphical Layout of XML
like after Created my Emulator of Nexus7 Emulator with Android 4.2 with Name as "Nexus7_Android_4.2" i will get this Device Configuration in Graphical Layout of xml automatically.
Below is the Screen Shot of it.
Hope it will Help you.

How to configure the Android Emulator to show onscreen buttons like the new Galaxy Nexus?

I would like to convert/adapt my application to Android 4.0.
To do so I plan to use the ActionBar on devices that support it.
All Android version >= 3.0 do so. Furthermore devices that do not have a hardware menu button seem to show an "menu" button on the actionbar automatically.
When I test my application on the emulator using API level 13 this does work as expected...
... but somehow I'm not able to setup the emulator to behave the same way while emulating a phone on API level 14 (Android 4.0).
When I try to set "Hardware Back/Home keys" to false there are no buttons at all (not on the screen and not keypad provided by the emulator).
I have seen on some screenshots and videos from the "Galaxy Nexus" that it is showing an "menu" button on the ActionBar as well ... like Honeycomb tablets do it, but I'm somehow not successful to do the same with the emulator which makes it a bit more complicated to understand how my UI will work on Andoid 4.0 phones.
EDIT:
Here is an image that is showing the On-Screen back and home buttons I would like to see in the emulator:
It seems the issue was fixed with the latest update of the SDK (R16).
Just update your SDK and ADT to R16 and create a new emulator using the updated Android 4.0 system image.
The soft keys showed up for me when I set hw.mainKeys to no:
Open $HOME/.android/avd/YOURS.avd/config.ini
Set hw.mainKeys=no
(This was covered in a deleted answer; don't know why it was deleted.)
When you create new emulator there is grid Hardware, and there you can add options Hardware home and back buttons and Hardware keyboard. So, create new emulator and look at your "Galaxy Nexus" :)
Unfortunately you can't change this properties for existing emulator.
After upgrading to R16 I could only get the on-screen buttons to appear if I created an emulator using the WXGA720 resolution.
Here is my complete config.ini file:
hw.sdCard=yes
hw.mainKeys=no
hw.lcd.density=320
disk.cachePartition.size=256MB
hw.cpu.arch=arm
skin.name=WXGA720
sdcard.size=512M
abi.type=armeabi-v7a
image.sysdir.2=system-images\android-16\armeabi-v7a\
image.sysdir.1=add-ons\addon-google_apis-google-16\images\armeabi-v7a\
hw.gps=yes
skin.path=platforms\android-16\skins\WXGA720
hw.keyboard.lid=no
hw.cpu.model=cortex-a8
vm.heapSize=48
hw.ramSize=1024
Hopefully this helps someone.
If your application includes functionality that would respond to a menu button, the menu button will be added to the black bottom bar.
If you are having trouble seeing this in the emulator, you can do a bit of a workaround by setting it to a tablet resolution (I use 1280x800) and observing your menu button behavior there, as it should be the same as on the phone version.

Android - Emulator in landscape mode, screen does not rotate

When I switch to landscape mode (NUMPAD 7 or CTRL+F11) the emulator rotates the screen to landscape orientation but the Android OS and none of the apps rotate. So everything is sitting sideways. Is there something in the AVD configuration that needs to be set in order for the device to rotate properly?
Another answer here:
in my case the problem was simply that the auto-rotate setting in the android emulator settings (accessible pulling down the notification bar) was disabled, my bad.
I spent more time then I'd like to admit scratching my head why my app was rotating fine on my device but not in the emulator... in the emulator pull the drop-down OS menu and make sure "auto-rotate" is enabled.
In my case it was solved by disabling the "Hardware keyboard present" checkbox in the "Edit Android Virtual Device (AVD)" window.
It is a bug with the 2.3 and 4.4 emulators.
http://code.google.com/p/android/issues/detail?id=13189 [v2.3]
https://code.google.com/p/android/issues/detail?id=61671 [v4.4]
API Level 29 here. By default the rotate is disabled. Pull Down the drop-down of the mobile and enable it.
In my case the Skin option in AVD settings was the problem. When I selected "No skin", it worked.
I had same problem.
Try removing the "Keyboard lid support" option in the settings of the hardwere virtual machine.
It helped me.
I made a silly mistake and spent a lot of time for the problem on API 30. Checked Auto-rotate setting and other answers here but tried the rotation on the main Android screen, which is not rotated! You need to open some app (your own or a default one, like 'Messages' or 'Browser') to see the rotation works.
As of mid 2015 the issue is still open and logged in the android bug tracker
here's the link you can check it out
https://code.google.com/p/android/issues/detail?id=61671
None of the above solutions worked for me and i am using Android 4.4.2 emulator.
As a work around in your graphical layout you can change the orientation and check it out.
Once you click the change orientation button, a small icon displays on the emulator asking if you want to change the orientation of the emulated screen. It only displays for a few seconds, so look next to the "bottom" icons and you will see this temporary icon.
This works with the emulator keyboard on or off.
I am running Pixel 2 API 29, Android 10.0 (latest versions as at today)
Is the accelerometer property of the emulator set to True? please check it. if not, set it to true. it should help. its working fine on mine.
Open AVD Manager -> GoTo 'Device Definitions' tab -> Select an
existing AVD -> Clone
I had to do all the following on an Android 10 device:
verify that I had in config.ini:
hw.accelerometer = yes
hw.sensors.orientation = yes
Set the device to auto-rotate from status bar.
Set the home-screen to auto-rotate
Long press at home screen > "Home settings"
"Allow Home screen rotation" set to ON
I had to install a new virtual device Nexus on API LEVEL 27 On Api Level 28(PIE) I could not rotate the display.
And it works for me.
Regards
As of API 29, it stops working randomly for no reason. Need to shutdown and restart emulator, then it works again.
I got this to work with the latest version of AVD.
Check out the config :
Also, here is the result:
I think wha tmakes it click is the combination of keyboard and Skin.
Also, if you create your own device make sure you add a Gyroscope sensor.
You have to use Android 5.1.1, aka API 22, aka Android 5.1 LOLLIPOP_MR1. Download Android 5.1.1 (API 22) in your Android SDK Manager and when you create a new Android Virtual Device select that as your OS.
As war_Hero mentioned, this bug was reported to Google. The bug is now fixed as of Mar 23 '15:
https://code.google.com/p/android/issues/detail?id=61671
In my case you need to click a small button that would enable the orientation to change, right after you press the main change orientation button.
I had to first press and hold rotate until I got into the menu.
Then toggle Auto-rotate screen to true.
I had the same problem, I instantly fixed it by simply deleting the device from the AVD list and just creating a new one.
Only way to get this to work is to use FroYo API AVD
For anyone with this issue, this is how I set up old Froyo AVD to test this scenario:
My Manifest min version is already 8, which is Froyo
< uses-sdk android:minSdkVersion="8" android:targetSdkVersion="21" />
You can see SDK_API_VERSION information here. http://developer.android.com/guide/topics/manifest/uses-sdk-element.html
In the SDK manager Installed the needed version:
http://screencast.com/t/KKZokotI4T
Created a new AVD for the new version.
http://screencast.com/t/W8VN6fOWGW
On API level 25 (no skin) it worked after going into the setting, searching for "rotate" and toggling both related settings off and on again.
Pixel 2 - API 28 (Android 9)
I had to do this to fix it.
Open AVD Manager
Select Pixel 2 - API X
Edit
Show Advanced Settings
Untick "Enable keyboard Input"
Only this has worked for me.
I am using API29 with Pixel-4 and Android 10.0 on ubuntu-20.04 with React-Native
I tried all the things mentioned here,
enabled auto-rotate on mobile.
unchecked Hardware keyboard present on AVD.
Unfortunately, it doesn't work for me.
Finally after Restarting my system and expo
$ expo start
# OR
$ npm start
When cloning a new virtual device, you have to enable the Accelerometer sensor. But sometimes the configurations are not written to the virtual device's config.ini file properly. Path: \Users\yourusername\.android\avd\virtualdevicename.avd
You have to check the properties and make sure these two properties are set to yes:
hw.accelerometer = yes
hw.sensors.orientation = yes
For Android Emulator 3.7 WVGA Nexus One I should have down graded the Android Version (it was 11 and i downloaded Pie (9) ), the rotation works now.
on expo you must change app.json file
{
"expo": {
"orientation": "default",
}
}
and turn on Auto-rotate from settings panel

Categories

Resources