Android Studio not detecting Microsoft Android Emulator - android

I installed Microsoft's Android Emulator from here which can now work without disabling Hyper-V on Windows 10. I was following the instructions in this post and everything was working smooth until yesterday. I was successfully able to debug my app in MS android emulator.
Today morning I closed the emulator and started it again. Now, When I start running the app to test it then the MS Android emulator is not showing up in Select Deployment Target window of Android Studio as below. Nexus 5X API 28 emulator visible under Available Virtual Devices is Google's Android emulator which doesn't work with Hyper-V enabled due to reasons mentioned here.
I've already launched the MS Android simulator and it is up and running:
I can see it running in Hyper-V as well as shown below:
Not sure what happened suddenly and it stopped working altogether. Can anyone suggest me the reason behind it or I'm missing something?

If it didn't detected by IDE, try to rerun the emulator and check if it is detecting again or not.
Also, you can try this too:
Tools -> Android -> Enable ADB Integration
If it is already enabled, try to disable and re enable it, seems like this works most of the times.
EDIT: You may want to check:
https://stackoverflow.com/a/38788436/4409113
Changing the value Path then running following commands:
adb kill-server
adb start-server
Might help.

I happened to resolve it by chance. Sharing my experience in case it helps someone in future.
Initially what I was doing is as below:
Start Visual Studio Emulator for Android application which contains the list all the device profiles.
Choose an appropriate device profile and install it.
Run the installed profile and launch the emulator.
Start Android studio, open the project and launch the app.
I simply reversed the above steps to resolve my issue. First close everything including Android Studio, emulators, device profile window etc.:
At first, start Android studio, open the project and hit Run app button to show Select Deployment Target window.
Now, start Visual Studio Emulator for Android application which contains the list of all the device profiles.
Choose an appropriate device profile and install it.
Run the installed profile and launch the emulator. Wait for the Android operating system to get started fully.
The Connected Devices section in Select Deployment Target window would refresh on its own to start showing Microsoft's Android Emulator.

The adb.exe can be seen as an infected file by antivirius software. So need to exclude once reinstated.

Related

Android Studio not installing app on device, no error messages

I have a clean Android project on Android Studio (just with a "hello world' screen), and I'm trying to install the app on my Samsung Galaxy S10e.
I click the Run button, and this is what I see in the Build Output:
And the apk is generated successfully.
But it's not launched and not installed on the device (no icon, and it doesn't appear in the apps list).
When I try manually installing the apk by adb install app-debug.apk, it works. The app shortcut appears on the device, it's added to the apps list, and I can launch the app.
At first also adb install didn't work, giving out the error INSTALL_FAILED_TEST_ONLY, but I solved that by adding android.injected.testOnly=false to gradle.properties.
I tried changing Gradle version to 6.0.1 (looks like this is the latest at the moment), and it didn't help.
I also have my device selected at the top:
How can I make Android Studio install and launch the app on my device?
Android Studio version: 3.5.3
Edit:
I'm seeing the same behavior on an Emulator. I opened AVD from Android Studio and chose Pixel 3A. The emulator opens up, I run the app, nothing happens on the emulator (and I see the same Build Output messages).
The same happens to me. It is probably a bug in Android Studio. At the second compilation the app installs correctly. It is tedious.
There isn't enough information to find the cause of this issue.
But since it works with adb, it means you run adb command. There could be only one instance of adb daemon running. So if it's involved externally my guess is Android Studio won't have access to it.
Possibly try adb kill-server and running again from Android Studio and see if that helps.
I encountered the same problem, which I solved by checking the running devices. The connected phone had 2 accounts (might be personal & work) which was listed on the list of devices, so I had to select the second option, and it ran successfully on my phone. see the attached image.
One thing it might be:
Enable usb debugging
Settings
System
Developer options
Turn the setting on for usb debugging
If it does not appear go to settings about phone. Then click on build number like 7-10 times and it will enable you to have the developer options appear.

Not able to install .apks via adb

I have been working on a particular Android application for sometime and have been able to run these apps via Android Studio quite fine before but since applying a recent update I have not been able to run the app via Android studio because of the following error:
android.os.TransactionTooLargeException
Error: Could not access the Package Manager. Is the system running?
I have tried to troubleshoot this issue by connecting via a different TCP/IP instead of through USB (thinking it was a cable fault of sorts), reinstalling ADB, removing the ADB driver and restarting Android Studio, and all of the above yielded the same error when trying to run the app from Android Studio.
The update that was applied was the addition of the YouTube Android Player to a fragment. The fragment that contains YouTube Player was added to FragmentManager of the parent Activity during the onCreate method of this fragment. Could this be the problem? Or am I looking in the wrong place
Any insight would be appreciated.
You may have gotten this error while attempting to run an Android application on an emulator or device using Android Studio. The most common cause of this error is simple as stated in this link: You have to manually unlock your Android Virtual Device by swiping the "lock" icon on the screen. Security measures prevent the emulator from letting you connect the debugger before doing this. Make sure also that you are running Android Studio version above 0.3.2 or the latest version. There was some issue reported in AS 0.3.2. You can update it from Help >Check for update.
Found this thread which states that it might be an issue with your emulator not with Android Studio. Maybe you are trying to install application before even the emulator started properly. Wait till the home screen appears in the emulator before trying to install any application.
Also try to install any apk in Emulator from command line
Steps to install
Go to $Android_SDK_DIR\platform-tools, right click there keeping shift key pressed and Chose "Open Command Window here".
Run command adb devices to make sure yout emulator is running properly. It will show all your running emulators.
Now if emulators are showing properly, type the command adb install YOUR_FULL_APK_PATH , YOUR_FULL_APK_PATH is of any .apk
file path in your system.
You need to wait for the emulator to full start which may take a few minutes. Once it is fully started (UI on the emulator will change), it should work. You will need to restart the app after the emulator is running and choose the running emulator when prompted. You can check on this bug report the full details.
Hope this helps!
I'm not sure, but check if this works.
menu>> tools>>Android>>Enable ADB integration check it

Genymotion Device doesn't appear on Device Chooser - Android Studio

I installed Genymotion with a virtual Box and the Genymotion plugin (Android Studio), created a new device and runs properly, even from Android Studio.
However when I hit the Run button, the Genymotion device does not appear on the Device Chooser, it says 'Nothing to Show' under the 'Choose a running device' radio button. How can I get the Genymotion device to appear on the Device Chooser and run my app? Is it something I am missing from the SDK manager?
This happens because Genymotion is shipped with outdated Android tools. To solve follow the steps:
Open Genymotion app,
Go to Settings -> ADB
Select 'Use custom Android SDK tools'
And select location of your Android SDK.
On Mac with a recent version of Studio that would be:
/Users/username/Library/Android/sdk/
I had the same problem,
but I solved it.
Before running genymotion you have to first click on run and wait until project compile and show you the empty device list and then you have to start your genymotion, after that it will appear.
click the run button to compile project
device empty list appear
start genymotion
device will appear in the list
That worked for me. Hope it helps.
Got the same issue on AS 3.3.2, I tried to select location of the Android SDK, or kill / restart the server. Still they didn't work.
After that, I install the genymotion plugin in AS and open the genymotion device manager, then check the actual ip address of the active genymotion device.
adb connect device_ip_address:5555
Now the device can be detected on device chooser.
P.S. Thanks #Ismail Iqbal for pointing out that the genymotion plugin is not necessary. You can also get the ip address from the emulator header.
I also am facing the same issue in new version of Android studio. following is my routine that everyday i am doing to solve this issue:
Click Run icon to see empty list of device
Close this list
Kill adb by:
adb kill-server
Sometime you need to run this command twice.
Start adb again by:
adb start-server
Click run again. Now I will see list of my emulators but not my Genymotion that is already up and running!
I will add my Genymotion by:
adb connect 192.168.56.101
This command has to be run when select device dialog is still open.
Now everything will be OK.
On Android Studio 2 :
Click on button "Attach debugger to Android process" on Toolbar.
Click restart.
Try run again.
Goodluck.
Tools->Android-> Remove check "Enable ADB Integration"
Run your app with appeared device.( you will get an error)
Set check "Enable ADB Integration"
Run your app
You can solve it quickly.
First make sure that genymotion emulator is opend.
close device chooser (On andoid studio)
open task manager(on windows ctrl + shift + esc)
pick process tab
find adb.exe maybe its adb.exe*32
right click and select kill process tree
adb will again appear shortly kill its process tree again( maybe
more than one adb will be found kill all.)
then open device chooser (click run on android studio).
I solved mine by:
First start android studio before starting genymotion. Then run the app in android studio and wait until you see the device chooser then start genymotion
Just in case someone is still looking for an answer. The software versions in which i faced the above issuue is -
Android Studio - 3.3.2
Genymotion - 3.0.1
So, now let's start with the problem. Just try the following steps:
Check if you have enabled Genymotion Plugin in Android Studio. For Windows, go to File -> Settings -> Plugins -> Search for Genymotion and see if it is checked. If you can't find it, Click on Browse repositories , search for Genymotion and install it.
Check the tick in the plugin:
Check if the Genymotion Emulator is running or not and Genymotion Main Screen shows status as Running or ON
(This was my problem. Although my emulator was up and running but Genymotion's Status was showing Booting). It usually takes some time to get the status from Booting to ON
Check for emulator status:
Check if your Min SDK Version is less than the Emulator's SDK Version. I faced it quite a lot in my initial days. For that, Go to your Module:app gradle file and see the Min SDK Version and the Emulators SDK Version is same or higher.
Check for Min SDK Version as highlighted in the image:
Hope this helps. If you still get any problem do let me know.
When you close the device, it is no longer available to the device chooser. You need to keep running the device from Android Studio.
I tried adb kill-server/start-server. But, It didn't worked.
Instead hitting this command 2-3 times quickly worked.
adb reconnect
In my case the genymotion path was not set ..so I solved it by clicking the genymotion icon from the tool bar and enter the path (the default in windows is C:\Program Files\Genymobile\Genymotion) then after starting the emulator it now appears in android studio
First you will have to run the genymotion from the android studio by pressing the genymotion icon after genymotion starts then press the run button, you will see the genymotion device option on deployment target dialog box.
In addition to the answers of this question :
My problem was about windows viruses , Last days i turned off my windows defender and i have't any other antivirus software in my system .
My SDK folder was full of virus , when i scanned Many viruses detected .
After removing viruses from my PC i had to remove SDK completely and download it again .
Finally notice that : For any reason , if the SDK files are
damaged may cause this error .
Now the problem is solved .
For This Problem:
Go to Project structure/project
In project SDK select simulator API version.
Done. Now your genydevice is added in the list.
I've tried from the android studio version 2.0 and the version 2.1, both does not compitable to genymotion. please use the version 1.5.1 or older than that.

App not run in visual studio emulator for android in visual studio 2015

I create blank xamarin android project without add any code when i debug this project debugging without problem but when i run app with visual studio emulator for android emulator is running but not starting my app and deploy failed and don't show me error
why ?
please help me
I had the same issue. VS 2015 can launch the VS emulator but can't deploy the app.
I was able to solve the issue like this:
Launch the emulator (F5 in VS, then cancel the deployment using the Build/Cancel menu)
Click on the chevron icon (») in the toolbar to the right of the emulator
Select the Network tab
Locate the preferred network ip address
Back in VS, click on the Open Adb Command Prompt toolbar button
Type adb connect [the emulator ip address]
Press F5 again in VS
Looks like a VS bug to me.
I had the same issue. It turned out the root cause was that the VS Emulator couldn't find adb.exe.
When that happens it won't connect to the emulator unless you do the manual connection following the steps CSharpRocks gives. The emulator also won't be listed under "adb devices".
The fix for me was to reinstall the Android SDK, using the Windows EXE based installer (not the zip installer). The EXE installer sets the HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Android SDK Tools key, Path value, in the registry, pointing to the Android SDK root directory.
The VS Emulator uses that registry setting (or the Android Studio install registry setting) to find the SDK, assuming you didn't install the Android SDK with Visual Studio itself. With that, it should be able to find adb.exe and work.
Have a look here:
Xamarin Forms Android App Crashes Running Debug with VS Android Emulator
Start the Hyper-V manager
Select the emulator you are trying to use
Right-click, hit settings
Click processor
Click Compatibility
Set checkbox “Migrate to a physical computer with a different processor version”
I'm having a very similar issue. I have found two different kind-of-work-arounds, but have not yet figured out a full solution.
Start the emulator before trying to deploy to it
Launch the Visual Studio Emulator for Android application from the start menu.
Launch one of the available emulators via the green arrow
Attempt to again launch your application from visual studio, selecting the VS Emulator N-inch... emulator from the drop down menu
For me for some reason the app still doesn't "launch" on the emulator, although it is installed. So I have to open the application menu and select my app. Additionally it will usually crash the first several times I try to open it, but eventually displays my single default label, Welcome to Xamarin Forms!.
Run the application in Ad-Hoc mode
Before running the application, change the solution configuration (from the top toolbar next to the green "run" button) to Ad-Hoc.
The problem with both of these methods though is that I'm still not able to actually debug an application. I can run it, but my breakpoints are ignored and I think that will make finding bugs difficult once I actually start to write a real application.
I hope to update this answer once I figure out an actual solution.
I had the same problem yesterday. The problem appeared (probably) because I tried to start development after a long break. I updated VS and everything, but faced many issues.
Eventually you need to start fresh
Make sure SDK for emulator points to the right place (HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Android SDK Tools)
Run Visual Studio with Administrator privileges
Go to Hyper-V Manager and delete ALL Virtual Switches - let the system recreate them when needed. It will do it properly
Delete all existing emulators and recreate them in Visual Studio. I even found a comment to name them without spaces - not sure if it is needed, but wouldn't hurt.
Doing all this helped me. But I was on the verge of reinstalling Windows 10 clean. I think lots of things and configuration changed and are no longer compatible.
Try it enabling Hyper-V and using a Visual Studio Emulator from android; that worked for me after a lot of attempts and research
I had the same issue but in my case it was not the registry. After doing a release build, I deployed the app to the emulator device in release mode which pushes the app to the device and then effectively "disconnects". This leaves a version of the app on the device which seems to block further attempts at debugging or deploying.
I solved it by starting the emulator, going to "settings -> apps" and manually uninstalling my app. Then the next debug build & deploy worked again.
You could probably also manually start the emulator and say "wipe device" option so it starts fresh.
In VS2017, on a Windows10 machine, all I had to do to get the app to show up was turn off Mobile Data.
(swipe down or use settings, then click Mobile Data and confirm to turn it off).
After I turned it back on, I could access the app. Before doing this, it always seemed that the emulator ran, but wouldn't run the app.
... no idea why this worked, but I'm posting it here in case it helps someone.
During my troubleshooting process, I also looked at these articles:
VS Android Emulator wont run application
Troubleshooting the Visual Studio Emulator for Android
Update Your Path For The New Android Emulator Location
Install apache in VS 2015 here.
Visual studio requires apache to develop android apps.
You also may want to look at some other suggestions:
notshowing, troubleshooting
I had such issues before with the android SDK emulator, now I'm using Genymotion emulator instead of it, it is more light and faster and will be detected automatically by you VS once launched.
you can download the free version from here : https://www.genymotion.com/
and also you can download any device emulator.

Android studio: emulator is running but not showing up in Run App "choose a running device"

I have launched my emulator via the AVD manager and once it's running I have clicked on run app. I have waited a couple of minutes for my running device to show up in choose a running device but the window always stays blank.
Probably the project you are running is not compatible (API version/Hardware requirements) with the emulator settings. Check in your build.gradle file if the targetSDK and minimumSdk version is lower or equal to the sdk version of your Emulator.
You should also uncheck Tools > Android > Enable ADB Integration
If your case is different then restart your Android Studio and run the emulator again.
This thread helped me to solve my problem, in particular this answer:
In Android Studio go to Menu -> Tools
Android
Uncheck Enable ADB Integration
Had similar issue with my emulator.
Solved by Wiping Data of emulator
Tool > ABD Manager > Down arrow under Action Wipe Data
Note : This is remove all data inside emulator.
For anyone else having the issue - none of the answers provided worked for me.
My case may be different to others but I had Android Studio installed first which installs the SDK by default to: C:\Users\[user]\AppData\Local\Android\sdk. We then decided to use Xamarin for our projects, so Xamarin was installed and installed an additional SDK by default, located here: C:\Program Files (x86)\Android\android-sdk.
Changing Xamarin to match the same SDK path worked for me which I did in the registry (although through the VS settings I'd guess it's the same):
\HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Android SDK Tools\Path
Change the path to match the Android Studio SDK path, close everything, start the VS Emulator, run Android Studio, ensure ADB integration is off and try. It worked for me.
If you uncheck the ADB Integration, you cannot use the debug any more.You may just restart the adb server, run
$adb kill-server
$adb start-server
in Terminal to restart the adb server without restarting the Android Studio. Then the emulator shows up.
My emulator used to suddenly disappear but the app still continues to run.
Solution-
Open task manager and kill qemu-system (Under Android Studio). This will stop the emulator. Then restart emulator.
Your adb connection is broken.
close eclipse
open cmd-prompt type adb kill-server then adb start-server
reopen eclipse
run the project!
Wipe the data of your Android virtual Device and then start the emulator. Works for me.
I had the same issue on a brand new computer, and the reason was simple. Although I downloaded and unzipped the Android SDK, I didn't add it to the PATH. So:
On Windows, you have to launch envvar and there, add the path to your android/platform-tools
On MacOS, edit the .zshrc file in your home, and add
export PATH="$PATH:/your/own/path/to/android/platform-tools"
This answer is not proposing a solution. Just a workaround in case someone is looking
I am using Idea based Android Studio (some people are talking about eclipse one here)
When I launch the app in the emulator (using the Run App button of Android Studio) AVD shows up but the app does not launch or run.
However when I connect my mobile and launch the app on my mobile the App works (this itself took some time, enabling developer options on mobile and doing the right configuration)
Because My app is launching on connected mobile, I can say nothing wrong with App.
There is some problem with AVD integration which I could not figure out so As of now I am working around my problem following way.
1 - I installed the app manually by dragging the APK file on AVD. (APK file is app\build\outputs\apk\debug folder)
2 - Then my AVD was not showing the installed APP list.
3 - I searched my APP using Google bar on AVD and dragged the APP icon on the home screen of AVD.
4 - I can now launch the APP using my APP icon on the home screen of AVD.
**That's how I am working around my problem. **
I have verified that Run App Icon does install the Application. Installation, not launching, appears to be the problem for me.
try to open the emulator and run it parallel with android studio/eclipse and the option will be displayed to select in the choose the device(emuator name, mine is Genymotion).
Check the android path of the emulator.
I had to change the registry in here:
HKEY_LOCAL_MACHINE > SOFTWARE > WOW6432Node > Android SDK Tools
to the actual path of the sdk location (which can be found in android studio: settings-> System Settings -> Android SDK)
All the credit goes to the author of this blogpost www.clearlyagileinc.com/
start device from genymotion button (have to install genymotion before and setup genymotion folder location on settings)
run application
choose genymotion running device
in your device you want to run app on
Go to settings
About device >> Build number triple clicks or more
and back to settings you will found "Developer options" appear
go to and click on "USB debugging"
Done

Categories

Resources