VS 2015 + Cordova + Emulator for Android = error "unable to deploy" - visual-studio-cordova

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

Related

iOS Remoted Simulator on windows

iOS Remoted Simulator in windows. My visual studio connected to mac successfully and also all Simulator show in visual studio on windows but problem is when clicked on any Simulator its just connecting window show a long time but not connect
First, you need to exclude the connecting problem. If it is not, that's maybe the simulator problem(official docs:https://learn.microsoft.com/en-us/xamarin/ios/get-started/installation/windows/connecting-to-mac/).
The simulator list shows on visual studio, can't make sure you pair to the mac successfully, it's maybe the cache. You should check the 'Pair to Mac' icon in visual studio, make sure it's green, as it will check the connection situation regularly. You can click it for the connection details.
If the 'Pair to Mac' icon is green, and shows a connected mac as you click it for details.
That's maybe the simulator problems. You'd better check it on mac. But it's really a small probability event.
And This is a standard solution to this problem:
Some suggestions :
Upgrade everything to the latest (VS for mac , VS for windows , XCode ).
Restart PC and visual studio .
Delete bin and obj folder on windows side.
Reconnect mac agent .
Clean and rebuild .
Change simulator(iPhone X e,g)
Disable remote simulator to Windows (Tools - Options - Xamarin - iOS Settings)
If problem persists , attach your build log here (Help - Xamarin - Open Logs).
(https://forums.xamarin.com/discussion/176150/simulator-doesnt-show-up)

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.

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

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

Debugging cordova app for Windows Phone

I have cordova 5.3.3 and my app is already working very well for Android. Now I'm trying to build it for Windows Phone 8 and Windows Phone 8.1.
The problem is that I found out that some .css files are not loaded (I'm running the app with both emulator and device with Visual Studio 2013 on Windows 8.1 x64).
How can I debug the app to find what files are not loaded during app running?
I tried to use ripple-emulator (https://github.com/apache/incubator-ripple) but I think it does not work with Internet Explorer on Windows or maybe I can't make it work (I already use it on Linux with Chromium and the Android platform and it works).
I also tried to use Visual Studio 2013: I have opened the .sln file in /platforms/wp8 and ran the app, so I have whatched the output console, but I think that it does not help me because I could not find the informations I need about the .css files that are not loaded.
Any help please?
Thanks
If you run the app in the vs debugger the f12 tools will attach and you can view the Dom from visual studio. Just press f5 in vs to build, deploy and run with the debugger attached.

Deployment failed for running windows phone8 app

I wrote first app using VS2012, Its giving error that is "Error 1 Deployment failed because no Windows Phone 8 phone was detected. Make sure a phone is connected and powered on.
"
but I did not attach any phone; I just want to run it on emulator. I am unable to select emulator from Visual Studio Device option as Its only showing me "Device" option. please help me how emulator options will come in Device options
After you install the SDK bundle. XDE emulators begin to setup themselves immediately consuming a large ram from your rig. It might have happened that you restarted your pc/laptop while the XDE was setting up.
So i would suggest you to Unistall and Reinstall again the SDK package with Update 3 to enjoy no problems. Also please note that you are running windows 8.1 pro or Enterprise/Embedded Industry pro edition.
You should have the Windows 8.
You should have a Hyper-V compatible computer.
You should enable and configure the Hyper-V. Look here: http://msdn.microsoft.com/en-us/library/windowsphone/develop/jj863509(v=vs.105).aspx
If you use a laptop, development on the emulator will be a hell.
Try grant all permission level to all user for your virtual machines in this path:
C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Emulation\Images
Only restart the device or the emulator and the deployment will success
You need to have Hyper-V installed using Control Panel|Programs & Features|Turn Windows Features On/Off.
If you installed Hyper-V AFTER Visual Studio 2013, you will need to repair Windows Phone x.x Emulators in Control Panel|Programs & Features.
Reboot.
The Emulator should appear in the Visual Studio Run/F5 button.
It will take several minutes to start the emulator on the first try. It will appear to hang. Wait at least 10min. You can use Hyper-V Manager to connect to the emulator directly and view progress.

Resources