Android Debugging Failing With "Couldn't connect to logcat, GetProcessId returned: 0" FFImageLoading.Platform.dll.so Not Found - xamarin.forms

I am having issue debugging Android project. I can deploy to device and run it, all works fine but if I try to debug, the app gets deployed to the device and very briefly opened, splash screen shows up but the app then closes.
I am using Xamarin Forms on Visual Studio 2015.
Device is running Android Oreo (8.0.0). Another device running Android 6.0.1 is debugging fine.
The output shows following:
InspectorDebugSession(11): StateChange: Start -> EntryPointBreakpointRegistered
InspectorDebugSession(11): Constructed
Android application is debugging.
InspectorDebugSession(11): HandleTargetEvent: TargetExited
InspectorDebugSession(11): Disposed
Couldn't connect to logcat, GetProcessId returned: 0
I checked Logcat and it seem to be having issues finding FFImageLoading library:
Time Device Name Type PID Tag Message
09-18 14:35:52.361 Huawei Nexus 6P Debug 1560 Mono AOT:
image '/usr/local/lib/mono/aot-cache/arm/FFImageLoading.Platform.dll.so'
not found: dlopen failed: library "/data/app/myapp.android.dev-
WEb1bz8edgF7vwx6uCoZ-A==/lib/arm/libaot-FFImageLoading.Platform.dll.so" not found
I have added Nuget package for FFImageLoading to my projects and Droid project references show it as in image below:

This worked for me :-
Deselecting the 'Use Shared Runtime' in Project Properties > Android
Options > Packaging properties

I also had this issue with Android 8.1 and Visual Studio 2017 15.7.4.
There are three steps to got it working again.
Under Android Options, go to Advanced and add your device architecture, in my case it was x86_64.
Go to Tools -> Options -> Xamarin > Android Settings and enable: Provide debug symbols for shared runtime and base class libraries.
And the final step is to delete following Apps from your device:
All Xamarin.Android API Support libraries
Mono Shared Runtime
Your App
After these steps you don't need to disable "Use Shared Runtime" and can Deploy and Debug much faster.

This is a known issue with Oreo and Xamarin Android on Visual Studio for Windows. It works on Visual Studio for Mac apparently. It will be fixed in an upcoming release. In the mean time there is a work around down near the bottom of the bug link above (comment 20).

deselecting 'Use Shared Runtime' in Project Properties > Android Options
delete bin & obj files from solution
clean solution
rebuild the solution it works

One another reason for that is if you dont enable usb debugging on your device, VS 2017 still recognizes your phone and installs the app on your phone. Just after debugging starts, it will throw this error and not continue debugging. Make sure to enable Developer Mode -> Usb debugging like described here
https://learn.microsoft.com/en-us/xamarin/android/get-started/installation/set-up-device-for-development

Related

breakpoint not working on Xamarin PCL but working fine on .Android

Hello I have been trying to debug an Android project on mac os that was built with Xamarin Forms but have been unable to hit a single breakpoint in the Portable Class Library.
After deployment I get hollow type debugger.
Hollow breakpoint image
But its working fine on .Android and .IOS
Here is a list of everything I have tried so far:
Deleting the bin and obj folders then clean and rebuild Setting the
Android build property "Link Behavior" to "Don't Link" Unselecting Strip
native debugging symbols Removed all symbols on path to debug file
Fresh installation of Xamarin
fresh cloning
changing Debug information to "Symbol only"
Can you please suggest any answer that can help me in this ?
This issue was introduced in a recent visual studio update and should be fixed soon
Visual studio for Mac
While I wait for the new visual studio update I manage to fix this by enabling Fast Assembly Deployment located at: Android Project Options -> Android build
https://developercommunity.visualstudio.com/t/Debugging-of-Xamarin-application-on-Andr/10001903
Visual studio for Windows
Try enabling Use Fast Deployment check this thread:
https://developercommunity.visualstudio.com/t/breakpoint-not-hit-debugging-xamarin-android-proje/1561025
According to the screenshot you provided, it seems on Windows Visual Studio.
The hollow red circle in your screenshot means disable a breakpoint without deleting it. It shows the breakpoint, but it would not work in debug.
You could click the black circle in the screenshot to enable breakpoint.
For more details, you could refer to the MS docs. https://learn.microsoft.com/en-us/visualstudio/debugger/using-breakpoints?view=vs-2022

A deployment error in Xamarin.Forms UWP when deploying from a PC to itself

When I just installed a Visual Studio 2017 and created my Xamarin.Forms application, it ran fine on my Windows 10 PC. However, I then installed some apps from Steam (which is the only thing I can think of that could change system settings). After that, when I try to create another Xamarin.Forms project, it does not deploy well to my machine and gives the following error:
DEP6200: Bootstrapping failed. Device cannot be found.
SmartDeviceException - Deployment failed because no
device was detected. Make sure a device is connected
and powered on. [0x80131500]
Strangely enough, my first app continues to build and run fine, even if I uninstall it from Windows and then deploy it again.
What could be the issue?
I have just noticed that Visual Studio makes ARM the default architecture. Changing it to "Any CPU" brought back the option to run the app on my machine.

Can't debug application on IOS Device

I created a vanilla PCL project in xamarin forms. I tried to run on Android and it works fine.
But when I change de target to IOS and select my real device (Ipad with IOS 11.4.1), Visual studio only allows me to build solution, I wanna to run application on it but I can't.
The target IOS is 8.0, and I already authenticated with my apple account and created a provisioning profile.
I already done this on another project before and works fine.
I really don't know why Visual Studio don't allow me to debug, when I open my oldest project with this device it allows me to debug.
What OS are you running Visual Studio on? IOS requires MAC, whereas Android is compatible with all OS. It's been a while, but I know there's an option to wirelessly connect to a MAC OS so that you can run your IOS Xamarin Forms application anywhere.
I found the solution.
I was trying to use "Debug", and it works fine on the emulator, but to real device I need to use "Debug | Iphone" or otherwise it only builds.
Even when I try to use "Release" it's the same trick.

Xamarin : iOS simulator : the selected execution mode is not supported for .net projects

I've just installed Visual Studio on my Mac and started my first Xamarin Forms project. I've clicked "Getting Started" for my HelloWorld, and tried to run in the iOS simulator and got the following error :
the selected execution mode is not supported for .net projects
Could anyone please explain to me why this problem appears and how to open the simulator? Android simulator works just fine.
For those having similar issues, it seems as though the Getting Started doesn’t quite work well on Mac.
Instead of using it to open the simulators, simply right click your project and run from simulator there instead.

VS 2015 + Cordova + Emulator for Android = error "unable to deploy"

Using the default Blank Cordova project in VS2015 update 1, I try to publish (Debug > Android > Device) to the Android Emulator (Tools > Visual Studio Emulator for Android) and I get the following error:
Severity Code Description Project File Line Suppression State
Error Unable to deploy to Android device, no attached device was found. If you recently attached a device, you may need to wait a few seconds before it is recognized. BlankCordovaApp2
I am also getting the following error when I click Yes in the pop-up deployment errors window :
Operation not supported. Unknown error:0x80070057
Here's the device list from ADB confirming the VM is being detected.
No luck with the following.
I reinstalled Android SDK Manager and updated files.
I removed and then re-installed VS2015 community.
I can use adb.exe to check for the emulator device and it sees the device.
The android emulator appears to be working and displaying properly.
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Android SDK is pointing to the correct location
renamed CoreCon
Ran Dependency Checker (Tools > Options > Tools for Apache Cordova)
I can deploy the .apk package on the Android emulator using adb install folder\location\xxx.apk
Any thoughts?
All I had to do was enable Android USB Debug on my phone.
Go to Configuration > System > About the Phone (My Phone is in Portuguese, so the menu options may differ a little bit)
Scroll to the bottom and tap on "Version number" around 10 times
A new option called "Developer" will be available under Configuration > System. Open it
Enable USB Debugging
Deploy the app again
Windows 10, VS 2015, Cordova 6.3.1, Using Andriod 23
I hab some trouble with different adb.exe errors and i fixed all of them. Perhaps this checklist will help. (Some things were already mentioned but nevertheless^^ her is my list):
Make sure yor device is connected to your Laptop. Check this with the console command "adb devices" (you have to be in the directory where adb.exe is)
If you see more than one an emulator is running , kill him (restart pc) if you see nothing check out another usb cable.
DELETE the app from your phone e.g. if you changed developing machine.
When installing MS Visual Studio you can first uncheck all and then only check Javascript->Cordova. Setup will make the rest. But install node.js and andriod-sdk (only sdk not the wohle andriod development studio... no need)
with the Andriod SDK-Manager make sure you have "Andriod sdk build tools" ONLY for your version installed.... for me 23.. AND Extras->"Andriod Suppot Repository" i have it like this:
here you can see my SDK Manager Part 1
here you can see my SDK Manager Part 2
5.Make sure you have developer options activated on phone and USB-Debugging is enabled. And on startup make sure you allow access from the Machine e.g. laptop to your device e.g. phone. A prompt should appear on your device.
cya
I encountered a similar problem.
Solution:
1)Open Developer tools in android devices and Revoke USB debugging authorizations
2)Then restart USB debugging
I was able to resolve this by editing the config.xml file and changing the Target API Level to match the installed version of the Android OS on my phone for development. Here is a link to the google developer docs:
https://developer.android.com/about/versions/marshmallow/android-6.0.html
It contains info on backward compatibility to help with setting the version appropriately.
Here's a work around to my problem. It doesn't fix the original problem, but it does allow me to debug using the Visual Studio Emulator for Android
Work Around:
Use the Debug > Android > VS Emulator XXX in the drop down to open the emulator and debug. VS Emulators can be added by using Tools > Visual Studio Emulator for Android
Previous Workflow:
Open Tools > Visual Studio Emulator for Android
Launch the Device Profile
Wait for the Device Emulator to open
Debug the project by using Debug > Android > Device
Close VS
Open it as Administrator
Tools > Visual Studio Emulator for Android
Start an emulator
Voilá
It worked for me

Resources