Installed VS 2017 (prof & community) RTM for xamarin development. Getting the below error while running the app. I have verified that installed the Intel Acceleration component. Any insights ?
1>C:\Users\Sowmyan\documents\visual studio 2017\Projects\App1\App1\App1.Android\App1.Android.csproj : warning XA0105: The $(TargetFrameworkVersion) for FormsViewGroup.dll (v7.1) is greater than the $(TargetFrameworkVersion) for your project (v6.0). You need to increase the $(TargetFrameworkVersion) for your project.
1>C:\Users\Sowmyan\documents\visual studio 2017\Projects\App1\App1\App1.Android\App1.Android.csproj : warning XA0105: The $(TargetFrameworkVersion) for Xamarin.Forms.Platform.Android.dll (v7.1) is greater than the $(TargetFrameworkVersion) for your project (v6.0). You need to increase the $(TargetFrameworkVersion) for your project.
1>C:\Users\Sowmyan\documents\visual studio 2017\Projects\App1\App1\App1.Android\App1.Android.csproj : warning XA0105: The $(TargetFrameworkVersion) for Xamarin.Forms.Platform.dll (v7.1) is greater than the $(TargetFrameworkVersion) for your project (v6.0). You need to increase the $(TargetFrameworkVersion) for your project.
1> Processing: obj\Debug\res\layout\tabbar.xml
1> Processing: obj\Debug\res\layout\toolbar.xml
1> Processing: obj\Debug\res\values\styles.xml
1> Processing: obj\Debug\res\layout\tabbar.xml
1> Processing: obj\Debug\res\layout\toolbar.xml
1> Processing: obj\Debug\res\values\styles.xml
2>Starting deploy VisualStudio_android-23_x86_phone ...
2>Starting emulator VisualStudio_android-23_x86_phone ...
2>C:\PROGRA~2\Android\ANDROI~1\tools\emulator.EXE -partition-size 512 -no-boot-anim -avd VisualStudio_android-23_x86_phone -prop monodroid.avdname=VisualStudio_android-23_x86_phone
**2>emulator: ERROR: x86 emulation currently requires hardware acceleration!**
2>Please ensure Intel HAXM is properly installed and usable.
2>CPU acceleration status: HAXM is not installed on this machine
2>Emulator VisualStudio_android-23_x86_phone cannot be started.
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
========== Deploy: 0 succeeded, 1 failed, 0 skipped ==========
I had a similar problem on my laptop. It turned out the Virtualization was turned off in my BIOS. My recommendation is to enter the BIOS setup on reboot (refer to manual as all machines are different) and see if Intel Virtualization is enabled. If not, you will need to enable it.
Related
I made that question to the Microsoft community months ago, the solution I came up with was to install the previous version of Visual Studio, 17.2.6, that could work with that phone. Then I got a new testing phone and I could debug on it just fine with any later Visual Studio version. But that old problem resurfaced when I tried to debug on my old phone again lately.
So, when I try to debug on the Samsung J5 I get the message that deployment is successful but debugging and the app stop. The app gets installed on the phone just fine, I can run it and test things, and for those parts that I would have added breakpoints I add temporary log entries to see what is happening. But debugging would be so much faster and easier. So I don't know what happened to Visual Studio 2022 after version 17.2.6 and the debugging on the J5 stopped working without changing the Android project's settings.
On to the output. The last lines of the Build output:
Found device: dbb6c608
Creating "obj\Debug\130\upload.flag" because "AlwaysCreate" was specified.
Creating directory "obj\.cache\".
Done building project "iService5.Droid.csproj".
Build succeeded.
2>Deployment was successful to Samsung SM-J510FN.
========== Build: 1 succeeded, 0 failed, 3 up-to-date, 0 skipped ==========
========== Elapsed 02:07,822 ==========
========== Deploy: 1 succeeded, 0 failed, 0 skipped ==========
========== Elapsed 02:07,824 ==========
Last lines of Build Order output:
2>Starting deployment to Samsung SM-J510FN ...
2>Deploying to Samsung SM-J510FN ...
2>Deployment was successful to Samsung SM-J510FN.
========== Build: 1 succeeded, 0 failed, 3 up-to-date, 0 skipped ==========
========== Elapsed 02:07,822 ==========
========== Deploy: 1 succeeded, 0 failed, 0 skipped ==========
========== Elapsed 02:07,824 ==========
On Debug output:
This debug engine does not support exception conditions. The condition(s) will be ignored.
Forwarding debugger port 8815
Detecting existing process
> am start -a "android.intent.action.MAIN" -c "android.intent.category.LAUNCHER" -n "com.bshg.iservice5.droid/crc649586142a72936f38.MainActivity"
> Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.bshg.iservice5.droid/crc649586142a72936f38.MainActivity launchParam=MultiScreenLaunchParams { mDisplayId=0 mBaseDisplayId=0 mFlags=0 } }
The error I get in Xamarin Diagnostics window:
[E:]: Index (zero based) must be greater than or equal to zero and less than the size of the argument list.
System.FormatException: Index (zero based) must be greater than or equal to zero and less than the size of the argument list.
at System.Text.StringBuilder.AppendFormatHelper(IFormatProvider provider, String format, ParamsArray args)
at System.String.FormatHelper(IFormatProvider provider, String format, ParamsArray args)
at System.String.Format(String format, Object[] args)
at Mono.AndroidTools.AndroidLogger.LogError(String task, String format, Object[] args) in D:\a\_work\1\s\External\androidtools\Mono.AndroidTools\AndroidLogger.cs:line 63
at Mono.AndroidTools.AndroidDevice.<>c__DisplayClass118_0.<RunShellCommandAsync>b__0() in D:\a\_work\1\s\External\androidtools\Mono.AndroidTools\AndroidDevice.cs:line 1012
[D:RunShellCommand]: dbb6c608 setprop "debug.mono.extra" ""
-- Start SetProperty - 12/02/2022 13:15:16 (148.7124ms) --
[INPUT] setprop "debug.mono.extra" ""
[OUTPUT]
-- End SetProperty --
[D:RunShellCommand]: dbb6c608 am force-stop com.bshg.iservice5.droid
-- Start ForceStop - 12/02/2022 13:15:16 (1794.4007ms) --
[INPUT] am force-stop com.bshg.iservice5.droid
[OUTPUT]
-- End ForceStop --
I have searched and searched and I can't find anything usefull. As for the configuration:
Android Options
Advanced Android Options
Deleting bin and obj after testing different Android options made no difference. The same options debug on the new phone just fine. And I haven't changed the developers setting in the J5. They are the same ones that VS 17.2.6 could debug with.
I am currently installing 17.2.6 to exist in parallel with 17.4.2 on my pc to see if that will help. But any insights regarding the reason behind my problem would be greately appreciated!
Edit: Community is not available for versions before 17.2.10 anymore. So I'll try 17.2.10.
Edit 2: 17.2.10 debugs on my old phone just fine. Same settings, same everything. So, since our target android version is now 13 on the solution on latest vs, I also created a clone of the repo to work with on the old phone because older vs can have only up to android 12.1 as a target version.
I am trying to follow the instructions on this webpage: https://devblogs.microsoft.com/visualstudio/hyper-v-android-emulator-support/
I have reached step 2 and downloaded the zip file. However, there is no executable. How do I install this preview? Is the preview the same as this: https://visualstudio.microsoft.com/xamarin/ ?
Update
Following Rajesh Sonars answer, here is the error I get running inside Visual Studio 2019:
1>------ Build started: Project: App1, Configuration: Debug Any CPU ------
1>App1 -> C:\Users\bert\Desktop\Xamarin2019\App1\App1\App1\bin\Debug\netstandard2.0\App1.dll
2>------ Build started: Project: App1.Android, Configuration: Debug Any CPU ------
2> App1.Android -> C:\Users\bert\Desktop\Xamarin2019\App1\App1\App1.Android\bin\Debug\App1.Android.dll
2> No way to resolve conflict between "mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" and "mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e". Choosing "mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" arbitrarily.
3>Starting deployment to my_device ...
3>Starting emulator my_device ...
3>C:\Program Files (x86)\Android\android-sdk\emulator\emulator.EXE -no-boot-anim -avd my_device -prop monodroid.avdname=my_device
3>Warning: Quick Boot / Snapshots not supported on this machine. A CPU with EPT + UG features is currently needed. We will address this in a future release.emulator: ERROR: x86 emulation currently requires hardware acceleration!
3>
3>Please ensure Windows Hypervisor Platform (WHPX) is properly installed and usable.
3>CPU acceleration status: HAXM is not installed on this machine
3>Emulator my_device cannot be started.
========== Build: 2 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
========== Deploy: 0 succeeded, 1 failed, 0 skipped ==========
Update 2
My processor is: Intel (R) Core i7 950 # 3.07 GHz. I have the following BIOS: P6X58D-E version 0502
I initially enabled the two settings in the BIOS:
advanced/cpu configuration/Intel(R) Virtualisation Tesc
advanced/chipset/intel vt-d configuration/intel vt-d
Is there anything else I need to enable. I accessed my BIOS this morning to retrieve these settings (so I could update my question) and it appears the second one is disabled. I definitely enabled it (I even took a photo at the time and checked the photo today). I am going to try and enable it later. I want to research what it is first though because I tend to experience BSOD when I change BIOS settings.
On Windows:
To try out Xamarin Preview features, you need to install Visual Studio Preview version which can be install side by side of your stable/release Visual Studio.
On Mac: You can select preview update channel
Observation :
If I try to launch emulator by running the app, I get following error and deployment get cancelled.
But, If I launch emulator explicitly from Tools > Android > Android Device Manager > Start, then it launches and I can deploy and test on it.
Yesterday I decided to try out VS2019 for Xamarin projects, so I created a Xamarin.Forms project and selected Master-Detail template.
Once it was created, I simply debug it (F5) and I see the test app in the Android emulator. Everything works fine.
Today, I try to run the app again, I have changed absolutely nothing in the code. I rebuild the solution and it builds successfully.
When I run the app, it fails for this reason:
1>Starting deployment to Android_Accelerated_x86_Oreo ...
1>Starting emulator Android_Accelerated_x86_Oreo ...
1>C:\Program Files (x86)\Android\android-sdk\emulator\emulator.EXE -no-boot-anim -avd Android_Accelerated_x86_Oreo -prop monodroid.avdname=Android_Accelerated_x86_Oreo
1>emulator: ERROR: This AVD's configuration is missing a kernel file! Please ensure the file "kernel-qemu" is in the same location as your system image.
1>emulator: ERROR: ANDROID_SDK_ROOT is undefined
1>Emulator Android_Accelerated_x86_Oreo cannot be started.
========== Deploy: 0 succeeded, 1 failed, 0 skipped ==========
The only solutions I have found deal with Android Studio, but I'm using Visual Studio 2019.
What can the issue be?
I tired xamarin native android and forms but both does seems to work. Both gives errors.
Tried creating blank xamarin android app without any code written in it, tired with xamarin forms app. Did a build, rebuild, clean, restarted system, restarted visual studio, running vs as admin all possible things but nothing worked out.
Below is the Device Log Information
Time Device Name Type PID Tag Message
10-13 23:18:30.003 Motorola XT1068 Error 19565 AndroidRuntime java.lang.RuntimeException: Unable to get provider mono.MonoRuntimeProvider: java.lang.RuntimeException: Unable to find application Mono.Android.DebugRuntime!
at android.app.ActivityThread.installProvider(ActivityThread.java:5177)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:4769)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4709)
at android.app.ActivityThread.-wrap1(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1415)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5443)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:728)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
Time Device Name Type PID Tag Message
10-13 23:18:30.003 Motorola XT1068 Error 19565 AndroidRuntime Caused by: android.content.pm.PackageManager$NameNotFoundException: Mono.Android.DebugRuntime
at android.app.ApplicationPackageManager.getApplicationInfo(ApplicationPackageManager.java:304)
at mono.MonoRuntimeProvider.attachInfo(MonoRuntimeProvider.java:41)
... 11 more
Time Device Name Type PID Tag Message
10-13 23:18:30.003 Motorola XT1068 Error 19565 AndroidRuntime Caused by: java.lang.RuntimeException: Unable to find application Mono.Android.DebugRuntime!
at mono.MonoRuntimeProvider.attachInfo(MonoRuntimeProvider.java:47)
at android.app.ActivityThread.installProvider(ActivityThread.java:5174)
... 10 more
Below is the Output information
2>An existing connection was forcibly closed by the remote host
2>Done building project "demoapp.csproj".
2>Build succeeded.
2>An existing connection was forcibly closed by the remote host
2>
2>Deploy failed on Motorola XT1068
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
========== Deploy: 0 succeeded, 1 failed, 0 skipped ==========
System Information:
Windows 10 Operating System
Microsoft Visual Studio Enterprise 2017
Version 15.4.0
VisualStudio.15.Release/15.4.0+27004.2002
Microsoft .NET Framework
Version 4.7.02046
Xamarin 4.7.10.22
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.
Xamarin.Android SDK 8.0.0.33
Xamarin.Android Reference Assemblies and MSBuild support.
Xamarin.iOS and Xamarin.Mac SDK 11.2.0.8
Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.
After changing to x86 and to release mode, now able to run in emulator. Below is the image.
But still not able to run on Android Devices
Edited
Android csproj file contents
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<SelectedDevice>Motorola XT1068</SelectedDevice>
<DefaultDevice>5" KitKat %284.4%29 XXHDPI Phone</DefaultDevice>
<AndroidDesignerPreferredDevice>Nexus 4</AndroidDesignerPreferredDevice>
</PropertyGroup>
</Project>
Android Project Properties
I'm trying to remotely debug a Windows 8.1 app on an x86 tablet.
The Remote Debugger is started on the Tablet, but every time I try to deploy the app to the Tablet, the Visual Studio output window shows this:
1>------ Build started: Project: $REDACTED, Configuration: Debug x86 ------
1> $REDACTED-> C:\Users\$REDACTED\bin\x86\Debug\$REDACTED.exe
2>------ Deploy started: Project: $REDACTED, Configuration: Debug x86 ------
2>Error: The method or operation is not implemented.
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
========== Deploy: 0 succeeded, 1 failed, 0 skipped ==========
Also, the Remote Debugger on the tablet prints Failed attempt to connect from $REDACTED
Changing remote machine (VS 2015 Remote Debugger settings) from No Authentication to Windows Authentication fixed the problem for me.