Xamarin cross platform - Couldn't connect debugger - android

After installing everything it couldn't create emulator. Running emulator from android studio. Using a Hello world Xamarin app. It installs on the emulator successfully but stops after showing a white screen. Then closes automatically showing this error:
Couldn't connect debugger. You can see more details in Xamarin Diagnostic output and the full exception on logs.
Manually opening the app also fails to show second time but opeing it third time shows the UI that has only a label and a button.
Third time it works. Also closed android studio so that theres no conflict on debugger.
Now what is wrong here?

Clean and Rebuild the Solution Is working fine for me, also in some cases you need to uninstall the app from Device.

I got the same problem after updating Android Sdk from Android Studio, then Visual Studio showed that error. A restart will help.

I hope this should mainly because of the device connectivity, so I change the cable and the issue was solved. 😀

Doing a factory reset on my emulator device via Android Device Manager fixed this for me.

Related

Android Studio no connected device problem

I have a freshly installed android studio on my PC for flutter development, but I am facing this issue.
As seen in the photo the virtual device shows up.
https://drive.google.com/open?id=1mcGs0qxKVZafD4j0J02n44n-3fbu1iHR
but it shows loading in the android studio toolbar.
https://drive.google.com/open?id=1yJ18a7DL4Livfc31pKryXrRJCUjkO1hW
when I try to run the application this message shows up
https://drive.google.com/open?id=18cWfhtbh4M9Nkn8KQAaRRSvLi8R0DPMR
but when I run "flutter doctor" everything seems to be fine.
https://drive.google.com/open?id=1E6MoIvWEnwFjOl-E_gjYQAjxJSlvs6fz
though if try to run it using "flutter run" nothing happens it just gets stuck on "running gradle task"
https://drive.google.com/open?id=1f6D1V63c06uu6LyY077zP6DLkEkggnTN
for android device, I solved it using this :
flutter config --android-sdk /path/to/android/sdk
not sure if it'll work with iOS devices as well.
Please check your studio is loading current active device.
On top there are four option:
1) One is for on which active device you want to run apk(phone icon available).
2) Second is represent starting point of app(flutter logo icon).
3) Total device available.
4) last on run app
so please check first option where studio find active device.

Debug.waitForDebugger(); not working in Android studio

When I worked with Eclipse, I used Debug.waitForDebugger() to enter debug mode in hard to reach classes like services.
However, since I moved to Android Studio, I was not able to get Debug.waitForDebugger() to work.
When I add it and run the app, it does not enter debug mode at all.
Does anyone know how to make Debug.waitForDebugger() work in Android Studio?
Quoting from AOSP issue 76040 https://code.google.com/p/android/issues/detail?id=76040 -
"DDMS in Eclipse will monitor apps run on a device. When apps show up in ddms in "waiting-for-debugger" mode and the app name (its package) match the package of an app opened in the workspace, then ADT will automatically connect the debugger configured with that particular app.
We should do this in Studio as well. Probably after 1.0 though"
Up until today this problem has not been resolve yet in Android Studio.
try android.os.Debug.waitForDebugger();
Use the emulator/device entries under "Settings>Development Options" as advised here

AVD not opening in Android Studio

I recently installed Android studio and the first time around AVD worked fine and the emulator was up and running no problem with that. But when I turned off my computer and booted it up again. But now when i try to open avd the following error message is displayed
when i reinstalled the android studio the same thing happens again,for the first time around it works but second time around the same error message comes.
Not able to find solutions over the internet as well.
This is a common problem that many people have faced. The Access Denied is indicating that Android Studio is trying to access files that require elevated privileges.
To solve this error, right click your Android Studio launcher, and click Run as Administrator.

Android Logcat is empty when debug with device in android studio

When I try to debug using android device in android studio Logcat shows nothing. But when I use emulator LogCat shows all the messages. How should view the Logcat messages when debugging on actual device?
Thank You !
In Android studio 0.8.0 you should enable ADB integration through Tools -> Android, before run your app. Then the log cat will work correctly. Notice that if you make ADB integration disabled while your app is running and again make it enable, then the log cat dosen't show anything unless you rebuild your project.
Restart the phone. And it solves magically
I was using Lenovo A7000plus powered by Android 6.0 M and found out that my Android Studio was unable to record the debug process, but somehow other's phone debug report could be recorded. Plus, I tried use Memu emulator and it recorded normally.
Strangely, that device was recognized by Android Studio and ready to be debugged, but no recorded debug report at all from all application that ran on the device. Of course, USB debug was tuned on.
What I did before, I turned off Developer option on that phone in order to play my favourite mobile game (F/GO) which forbids USB Debugging is turned on in the device.
A few hours later, after trying any method in Internet and not success, accidentally I found simple but strange solution that is Restart the phone. I restarted the phone while it was connecting to PC, and somehow the logcat showed all debug process in Logcat like normal.
It sounds like non-engineering solution at all, but that's really work for my case.
As of 0.4.0 I have noticed that the logcat tab does not work in the debugger window - only in the Android DDMS window (hit Alt+6 to bring up the working logcat while debugging). Awkward I know :)
In Android studio 1.0.2 or later: you should enable ADB integration through Tools -> Android, before run your app
In Android studio 1.* if logcat messages have disappeared for me helps the next trick:
Tools -> Android -> disable )) "enable ADB integration" (if it've been enabled)
Tools -> Android -> enable it again "enable ADB integration"
In 0.8.2 the DDMS window doesn't show up. However restarting the adb logcat windows by pressing Alt+6 (Twice, if it's already opened) fixes the issue. It worked for me.
I understand that this question is over 2 years old, but from my searches a few people are still having a persistent problem with this. One possible solution to this (which worked for me after two hours!) is that your phone settings may have its "Log Switch" set to off, hence it isn't sending your log data to the IDE.
Here is the solution - "Unable to open log device '/dev/log/main': No such file or directory"
Hope it helps!
If anyone's still having trouble with this despite trying all the answers here, just use System.out.println instead of log.* and your debug messages will output.
Updated: I finally got the cause of the problem in my case. If I switch of my device's wifi, the log shows. Otherwise, the log will not show. I tried several times and it the always show full logs when I turn off my wifi.
My device is: Gsmart Classic, OS: Android OS, v5.1 (Lollipop). I met the problem when I updated the gradle build tool from 'com.android.tools.build:gradle:2.0.0-alpha1' to 'com.android.tools.build:gradle:2.0.0-alpha3' in Android Studio 2.0-preview. After trying all the solutions with no luck, I tried un applied all the instant run choices and re-apply it again. Then the logs show up.
Note: if it still doesn't help. You can as well try to switch back-and-forth the back ground process limit. Unfortunately, I couldn't reproduce the error.
In Android Studio 2.x I used to have to restart to get it working but often switching back and forth between the applications works or running
adb kill-server;
adb start-server;
to restart adb fixes many things as well.
The problem seems to have different causes.
For me, the issue was that I had two emulators with the same name (I created it, deleted it, and then created it again with the same name). There were two emulator entries in the logcat dropdown and it was connected to the wrong one. All I had to do was switch to the other one. I prevented the problem permanently by renaming the emulator.
I believe that the problem has various causes for different users. I experienced the same issue with logcat not displaying any information when my application crashed, and we all know how frustrating this can be.
The following are the solutions that worked for me.
Invalidating caches and restarting android studio
In the developer option in your physical device make sure the logger Buffer size is set to 1MB per logger buffer.
Restart your physical device.
Hope this helps.

trouble debugging and running sample android project

I installed the Android 2.2 SDK (2.2 is the version i have on my smartphone). I've tried running the NotePad sample project as an Android project. Here is what happens: the emulator loads, but when I click on the app, the screen goes blank. There are no errors being thrown. Has anyone else run into this problem? If so, how have you fixed it?
When you press run, the emulator loads AND the application should automatically open and run. Also, make sure there are no errors with the code itself.
If all else fails, try a new/ different SDK and make sure the app has no errors during it's installation into the SDK. Look at the Console and LogCat to make sure that there are no errors the emulator runs.

Categories

Resources