I'm trying to figure out with Xamarin Android Blank Application basics. I use Visual Studio 2015 and C# on PC Windows 10
But each time I make some changes in my code, I got deployment errors massage window with debugging and can't run emulator through time. If I start a new project with copy/paste of MainActivity.cs content from broken project and proper Main.axml interface, same code works. then if I add something new to new project code, or just restart VS deployment errors appears again, with only output below. Not sure what I'm doing wrong, rebuild does not helps in this case
1>------ Build started: Project: Android_App, Configuration: Debug Any CPU ------
1> Android_App -> D:\folder\Android_App\bin\Debug\Android_App.dll
1> Processing: obj\Debug\res\layout\main.xml
1> Processing: obj\Debug\res\values\strings.xml
2>Please select a valid device before running the application.
2>------ Deploy started: Project: Android_App, Configuration: Debug Any CPU ------
2>Error: Cancelled
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
========== Deploy: 0 succeeded, 1 failed, 0 skipped ==========
So, now I'm trying to run into device:
I've installed Android SDK with Android SDK Manager from Visual Studio
Build Number
Developer Options, USB debugging
USB Connection by default I checked Media Device (MPT)
Google USB driver is also installed and it is inside C:\Users\User\AppData\Local\Xamarin\MonoForAndroid\AndroidSDK\extras\google\usb_driver
in my Device Manager after Updating of Driver Software and Browse my Computer for Driver Software by path above with include sub folders checking, I see Portable Device/MyPhone and Samsung Android Phone/Samsung Android ADB Interface.
I did not installed driver for my Samsung Phone because I already can see new category Samsung Android Phone/Samsung Android ADB Interface I guess
So in Devices of Android Device Monitor I see my Phone as number not the name, and its status is Online
In VS2015 it is checked now as Samsung SM-G3815 (Android 4.2 - API 17)) for Android_App1, where is also: Android_Accelerated_x86 (Android 6.0 - API 23) and Android_ARMv7a (Android 6.0 - API 23)
Deployment error is gone, but it's just starts debug without any window and automatically stops debugging process in few seconds.
In Solutions Properties/Application:
Compile using Android version: Use Latest Platform (Android
6.0(Marshmallow))
Minimum Android to target: Android 4.1 (API Level 16 - Jelly Bean)
Target Android Version: Use Compile using SDK version
and same result with Minimum Android to target: Android 4.2 (API Level 16 - Jelly Bean) and Compile using Android version has only Use Latest Platform (Android 6.0(Marshmallow))
So I'm not sure how to go further, how to run it
Edit:
logcat final line:
02-22 22:13:03.843 Samsung SM-G3815 Warning 31153 System.err at com.ksmobile.business.sdk.data_manage.k.run(DataManager.java:109)02-22 22:36:04.811 D/Mono (32250): AOT module '/Users/builder/data/lanes/3511/501e63ce/source/monodroid/builds/install/mono-armv7/lib/mono/aot-cache/arm/System.Collections.dll.so' not found: Cannot load library: load_library(linker.cpp:746): library "/data/app-lib/Android_App1.Android_App1-8/libaot-System.Collections.dll.so" not found
and there is also a lot of different errors, not only these:
02-22 22:31:05.091 Samsung SM-G3815 Error 1340 Auth at com.google.android.gms.auth.be.o.a(:com.google.android.gms:260)
02-22 22:31:05.091 Samsung SM-G3815 Error 1340 Auth at com.google.android.gms.auth.firstparty.dataservice.x.a(:com.google.android.gms:558)
02-22 22:31:05.091 Samsung SM-G3815 Error 1340 Auth at com.google.android.gms.auth.o.a(:com.google.android.gms:276)
02-22 22:31:05.091 Samsung SM-G3815 Error 1340 Auth at com.google.android.gms.auth.o.a(:com.google.android.gms:196)
You have to check the output build logs by extending the trace log.
Go to tools->xamarin->output verbosity, set level to diagnostic and check the detailed build error you have.
Related
I am using a MAC Book Pro and I wrote my Android App in Visual Studio using Xamarin in Parallels (virtual machine).
When starting the app, it builds, but then the "mobile screen" freezes and when I stop the application then I get two Error Messages:
-) Error ADB0010: Unexpected install output: cmd: Can't find service: package
-) Error ADB0000: Deployment failed
Mono.AndroidTools.InstallFailedException: Unexpected install output: cmd: Can't find service: package
How can I fix this?
The App looks like this when I've started it
Try the below suggestions:
Make sure you have the latest Android Emulator version running.
Try a different Android version If you're using Visual Studio 2019 like me you have to go with Android 8.1 Oreo or higher.
3.Read this: StackOverflow Question
It normally caused by that the android emulator does not run well. Please check that you have installed all the emulator package.
After that, when I get this issue, I always stop the android device, in the device manager, edit to change the disk.dataPartition.size value to ‘5000M’(You could set the value according to your device.).
I've just installed Xamarin to start mobile development nevertheless looks like i have some emulator issues. See below the details.
This one i get when start project:
This what output shows:
You can continue with your emulator choice, but it will run slowly. For a better experience you should target a device or develop outside of a VM.
1>App4 -> C:\Users\Robert\source\repos\App4\App4\App4\bin\Debug\netstandard2.0\App4.dll
2>------ Build started: Project: App4.Android, Configuration: Debug Any CPU ------
C:\Program Files (x86)\Android\android-sdk\tools\emulator.EXE -partition-size 512 -no-boot-anim -no-accel -avd Android_Accelerated_x86_Oreo -prop monodroid.avdname=Android_Accelerated_x86_Oreo
PANIC: Missing emulator engine program for 'x86' CPU.
Emulator Android_Accelerated_x86_Oreo cannot be started.
Runtime checks failed
Following some articles i enabled virtualization in bios which doesn't solve the issue as well as disabling hyper-v.
You could use a physical device (solves it for me all the time) or you can open the Android Device Manager, remove all the default devices, and start by adding the devices based on specifications.
For example, what I did in my case was
Open Android Device Manager from Visual Studio (you can use the quick launch)
Next is to spec up your device emulator to about 1 GB RAM
Make sure you have installed Intel HAXM and restarted your PC after disabling Hyper-V
Make sure to accept all prompt pop-ups.
I hope this helps.
I have been getting the below error for a while now. I have tried all possible options that are available on various blogs to do with appinitializer. I have also tried to run the same xamarin UI test from USB connected local device and on visual studio Kit Kat emulator. However for some reason I get the below said error with each and every device/emulator and any appinitializer setting. I am using Visual Studio 2017 latest update and xamarin corss platform project with git source control. I had to move my android SDK on a different drive due to space constraint on C drive. I have changed the registry key for Android SDK and this doesn't solve the error. (Not sure if this could have been cause of failure)
Even if i dont run my test and just run the below command, i get same error and adb.exe process crashes:
E:\Android\android-sdk\platform-tools\adb.exe -s emulator-5554 shell pm list packages -f -e
The interesting bit is everything works fine on Mac.
I have raised this with Xamarin developers support however haven't heard fro them yet!!!!
Any help is highly appreciated!!
SetUp : System.Exception : Failed to execute:
E:\Android\android-sdk\platform-tools\adb.exe -s emulator-5554 shell pm list packages -f -e - exit code: -1073740940
package:/data/app/SmokeTestApp/SmokeTestApp.apk=com.android.smoketest
package:/data/app/WidgetPreview/WidgetPreview.apk=com.android.widgetpreview
at Xamarin.UITest.Shared.Processes.ProcessRunner.Run(String path, String arguments, IEnumerable`1 noExceptionOnExitCodes)
at Xamarin.UITest.Shared.Android.Adb.AdbProcessRunner.Run(String adbArguments, Int32[] noExceptionsOnExitCodes)
at Xamarin.UITest.Shared.Android.Queries.QueryAdbInstalledPackages.Execute(AdbProcessRunner processRunner)
at Xamarin.UITest.Shared.Android.LocalAndroidAppLifeCycle.EnsureInstalled(String appPackageName, ApkFile testServerApkFile)
at Xamarin.UITest.Android.AndroidApp..ctor(IAndroidAppConfiguration appConfiguration, IExecutor executor)
at Xamarin.UITest.Configuration.AndroidAppConfigurator.StartApp(AppDataMode appDataMode)
at iBCU.UI.Test.AppInitializer.StartApp(Platform platform) in C:\Users\Source\Repos\Test\AppInitializer.cs:line 15
at UI.Test.Tests.BeforeEachTest() in C:\Users\Source\Repos\Tests.cs:line 26
Full log file: C:\Users\AppData\Local\Temp\uitest\log-2017-07-13_13-58-38-861.txt
Skipped IDE integration, connection failed.
Android test running Xamarin.UITest version: 2.0.9
Initializing Android app on device emulator-5554 with installed app: com.bcu.ibcu.activities
Skipping local screenshots. Can be enabled with EnableScreenshots() when configuring app.
Signing apk with Xamarin keystore.
It worked for me when I replaced the SDK platform tools with the 23 version.
You can download it here:
https://dl.google.com/android/repository/platform-tools_r23-windows.zip
At the first deploy the app is installed on my device and everything works well, but when I try to deploy the second time I get this error:
1>Deployment of application to device failed.
1>Error writing file '%FOLDERID_APPID_INSTALL%\{5ea233c7-23db-4a36-b02b-2554d58aba56}\resources.pri'. Error 0x80070005: Access is denied.
1>
========== Deploy: 0 succeeded, 1 failed, 0 skipped ==========
I tried to look after this issue, but I can't find the solution for my problem with that "resources.pri".
Someone know how can I resolve this problem?
I have this issue too. Windows Phone 8.0 application, has been working well for several years, has 30,000 users, and all I want to do is update some text. The app will deploy successfully to an HTC 8x running Windows Phone 8.1, but has the above error when deploying to a Lumia 950 running Windows 10 Mobile.
This is not a bug in the app. [And ProcMon is no use or relevance, because this is a problem of deploying to a Windows Phone, thanks for replying without reading the question]
This is a bug in Windows 10 Mobile working with Visual Studio. It needs fixing.
On my primary development machine I created an app that can be deployed but lacked advertising. That machine broke and was sent in for repair, thankfully after I committed the working application to source control. I brought up a spare machine, checked out my project making many improvements including successfully displaying adds in the windows 10 UWP application. After repairs were completed on my primary development machine I updated templates, and SDKs that had changed during the repair, ?I believe I got them all?. I checked out the project and after a successful build attempted to deploy and debug.
2>------ Deploy started: Project: Decisive.Uwp.T10, Configuration: Debug x86 ------
2>Updating the layout...
2>Copying files: Total 1 mb to layout...
2>Checking whether required frameworks are installed...
2>Framework: Microsoft.Advertising.Xaml/x86, app package version 10.0.1510.0 is not currently installed.
2>Installing missing frameworks...
2>Error : DEP0800 : The required framework "C:\Program Files (x86)\Microsoft SDKs\Windows Kits\10\ExtensionSDKs\Microsoft.Advertising.Xaml\10.0\.\AppX\x86\Microsoft.Advertising.Xaml.x86.10.0.appx" failed to install.
2>error 0x80070005: Opening the package from location Microsoft.Advertising.Xaml.x86.10.0.appx failed.
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
========== Deploy: 0 succeeded, 1 failed, 0 skipped ==========
I removed the Microsoft.Advertising.Xaml, Version=10.0 leaving the Microsoft.AdMediator.Universal, Version=1.0 The app will now deploy and run but doesn't appear to display adds. I noticed the following warning;
(I don't know how to format the following with wrap so it doesn't need to be scrolled many page widths. I've left it as a paragraph.)
The SDK "Microsoft.AdMediator.Universal, Version=1.0" depends on the following SDK(s) "Microsoft.Advertising.Xaml, Version=10.0", which have not been added to the project or were not found. Please ensure that you add these dependencies to your project or you may experience runtime issues. You can add dependencies to your project through the Reference Manager.
The versions of these two libraries match between the two machines used to created this app.
I'm at a loss attempting to resolve this error Error : DEP0800 : The required framework "C:\Program Files (x86)\Microsoft SDKs\Windows Kits\10\ExtensionSDKs\Microsoft.Advertising.Xaml\10.0.\AppX\x86\Microsoft.Advertising.Xaml.x86.10.0.appx" failed to install.
Additional Information 10/21/2015 2008 MST
FWIW With both references intact, in a state where it won't deploy to my windows 10 notebook locally or in the emulator, I deployed to a windows phone mobile emulator. No errors, app runs. Doesn't appear to be displaying ads though.
On the spare machine where the app will deploy to windows 10 locally and display ads, ads are displayed in both the win10 emulator and the mobile emulator.
Additional Information 10/22/2015 0930 MST
The comments on this post regarding WinTools 1.1, TypeScript 1.6 RTM, and Tools for Apache Cordova Updates may shed some light on the problem. They detail a problem that some developers have experienced installing the win tools 1.1 update that apparently the AdMediator relies on.
I had some great hindsight and you can see what assumptions made out of me.
I got in touch with a PM at Microsoft who stated;
Yes, we are aware of the issue that you are talking about. But that
issue might be a red herring in this context – it is all about just
false notifications showing up when you do the upgrade. That should
not have really caused the issue with the AdControl (if you truly had
the issue with a bogus install of the tools, you could not even create
or build a UWP app of any kind).
Eventually I tried running Visual Studio as Administrator. I was able to deploy the app. Afterwards I exited Visual Studio then restarted with normal privileges. I am now able to deploy the app without running Visual Studio as Administrator.