Android Studio / AVD with bumblebee / nvidia optimus - android-studio

When using a computer with linux and a nvidia optimus graphics card for Android Development, is it possible to tell Intellij / Android Studio to launch the Android Virtual Devices with bumblebee?

Yes, it is possible. I do that by using optirun but running avd and android studio separately.
For example, if you have an Android Wear image just run:
optirun ~/Android/Sdk/tools/emulator -netdelay none -netspeed full -avd Android_Wear_Square_API_<api version>
Works with regular android images as well. Its exactly the same command you use to get avd up and running via command line but you just need to prepend optirun to run it with your nvidia card.
After you do that, Android Studio will detect the emulator when you try to build and run your app, even if you don't run Android Studio using optirun.
Sources:
AVD cli docs
Optirun Docs: ArchWiki, UbuntuWiki.
Hope it helps!

Related

Can't run Android Studio's Emulator

I guess it was because after run instrumented test file so become can't open Android Studio's emulator?
But I am not sure.
Error message:
Launching 'app' on No Devices.
Error while waiting for device: The emulator process for AVD Pixel_4_XL_API_30 was killed.
I used follow solution solved this problem.↓
Tools -> SDK Manager -> SDK Tools (tab) -> Deselect 'Android Emulator' -> OK
Now, when you try to run your app, or launch device from AVD Manager, it will give the 'Install Emulator' error -> Click Ok. This will automatically download the correct version.
I experienced the same problem with emulator version 30.6.4 and Android Studio Arctic Fox 2020.3.1 Canary 15. I tried switching from Intel HAXM to Windows Hyper-V and re-installed all android build tool and emulator packages. Afterwards it worked for a day.
The second thing I tried is manually installing an older version (30.5.5) of the emulator which you can get from here. Now Android Studio does not recognize my manual installation of the emulator and I can not start the AVD from the UI. However I can start it via cmd and install apps from within android studio without crashes (at least for the moment).
Start your AVD with the following command (android/sdk/emulator):
emulator -avd <name-with-_-instead-of-spaces>

Android Emulator is not running on Android Studio 3.3.2 (MacBook Air)

I have installed Android Studio 3.3.2, I had some problems with the SDK path and I cannot run the app from my application icon, but from the terminal window using sudo ./studio. I had to set the SDK path and re-install SDK into a new folder.
Now I cannot run the AVD emulator and I get the following error messages:
18:23 Emulator: emulator: ERROR: Unknown AVD name
[Pixel_2_XL_API_28], use -list-avds to see valid list.
18:23 Emulator: Process finished with exit code 1
I have been through all the other fixes, such as re-installing Android Studio, re-installing the emulation, Intel x86 Emulator accelerator enabled, deleting all the virtual devices and re-building them.
There is one problem, which is my MacBook keeps reporting "Your disk is almost full" currently have 1.5GB spare space on the drive.
I have been through all the other fixes, such as re-installing Android Studio, re-installing the emulation, Intel x86 Emulator accelerator enabled, deleting all the virtual devices and re-building them.
I have read the path might be set wrong for the AVD drivers, but cannot see anywhere these are present in the Android Studio.
Could the problem be with the lack of space disk space or something else going?
I re-built by MacBook and re-installed Android Studio and all problems resolved.

Why is Android Studio not finding the x86 emulator when running a flutter app?

Software
MacOS Sierra 10.12.6
Android Studio 3.1.2
Flutter 0.3.2 • channel beta
Tools • Dart 2.0.0-dev.48.0.flutter-fe606f890b
Flutter doctor (no problems found)
Problem
I am using Android Studio IDE to develop flutter apps, but I can't get any of the Android virtual device emulators to launch from the IDE. Whenever an Android virtual device is selected, such as the Pixel P, an error message appears saying "PANIC: the emulator program for the x86 CPU is missing". However, the emulator does work when it is launched from the command line:
$ cd /Users/$USER/Library/Android/sdk/emulator
$ emulator -avd Pixel_API_P
The problem seems to be specific to flutter projects, given that the same virtual devices are being launched normally with Android projects.
I changed the virtual device's x86 image to x86_64 and the problem was solved. Still don't undertand the underlying cause, but it worked:
ADV Manager > edit device > (name_of_device) Change... > x86 images > download & select x86_64 image
Check if your GPU rendering is activated in your BIOS settings.
Generally the BIOS keeps the GPU rendering off. You can change it, then clean your Android Studio, then reload your ADB.
Hope this helps. :)

I can't run the Android Emulator

I'm completely new to Android and Android Studio. I was just coding.
So I was running the previous version of Android Emulator and it worked perfectly fine.
However, when I downloaded the latest Android Emulator 27.1.12, my Emulator couldn't run properly.
Issue: The code is running fine, but the Emulator can't display my application. When I click on the Emulator screen, I can still hear the Audio of my app. So I think the problem would be with my computer's hardware.
Because the Emulator couldn't run, I uninstalled the Android Emulator 27.1.12 and Android Studio reported these errors:
Issue:
08:32 Emulator: [6684]:ERROR:android/android-emu/android/qt/qt_setup.cpp:28:Qt library not found at C:\Users\dell\AppData\Local\Android\Sdk\emulator\lib64\qt\lib
08:32 Emulator: Could not launch ‘C:\Users\dell\AppData\Local\Android\Sdk\emulator/qemu/windows-x86_64/qemu-system-i386.exe’: No such file or directory.
So, when I install the Emulator, it crashes, when I un-install it, I encounter these 2 errors. So is there a way for me to use the Emulator without causing the 2 errors?
I am not sure from your question, whether or not you have uninstalled and reinstalled the AVD Manager, so in the case you haven't:
I suggest you completely uninstall and then reinstall the Android Virtual Devices SDK (AVD Manager).
You can use the following instructions to help you out:
To uninstall/install the AVD Manager, go to Tools > SDK Manager > Android SDK and select the SDK Tools Tab. Then scroll down until you find the Android AVD/Virtual Devices SDK.
Also, make sure that the Android Emulator SDK is also installed.
I see in the new update of Android Studio, the Android Emulator option is not enabled by default.
So, let enable it in the Settings as the bellow and run Android Emulator again.
Have Android 3.2.1 which you need to install emulator manually by going into
Tools > SDK Manager > Android SDK and then select the SDK Tools Tab. Check the 'Android Emulator' then Apply.

Android studio,, AVD emulator

I have a problem with avd emulator. It wont start, I try everything and it still doesn't work. Here is the problem:
"D:\Android SDK\tools\emulator.exe" -avd Slim_Shady_API_22 -netspeed full -netdelay none distrib/android-emugl//host/libs/Translator/GLES_V2//GLESv2Imp.cpp:glAttachShader:187 error 0x501 distrib/android-emugl//host/libs/Translator/GLES_V2//GLESv2Imp.cpp:glAttachShader:187 error 0x501 TextureDraw: Could not create/link program:
emulator: device fd:584
HAX is working and emulator runs in fast virt mode
ERROR: Could not create window texture: Texture dimensions are limited to 2048x2048
Error accepting connection, aborting
1) Install the Intel x86 Emulator Accelerator (HAXM installer) from the Android SDK Manager
2) Run (for Windows):
{SDK_FOLDER}\extras\intel\Hardware_Accelerated_Execution_Manager\intelhaxm.exe
or (for OSX):
{SDK_FOLDER}\extras\intel\Hardware_Accelerated_Execution_Manager\IntelHAXM_1.1.1_for_10_9_and_above.dmg
3) Start the emulator
If you own an android phone or tablet, then you can install the .apk of your app on it. You can find the apk here AndroidStudioProjects\AppName\app\build\outputs\apk\app-debug.apk

Resources