Xamarin Forms Push Notification: Android.Support.v7.MediaRouter Error - xamarin

I am trying to add push Notifications to my application and I have added xamarin.google.playservices.Gcm package into my project and now I am getting the following error.
Error XA5207: Please install package: 'Xamarin.Android.Support.v7.MediaRouter' available in SDK installer. Java library file /Users/xyz/.local/share/Xamarin/Android.Support.v7.MediaRouter/23.3.0.0/embedded/libs/internal_impl-23.3.0.jar doesn't exist. (XA5207) (NotificationExamplenew.Droid)

1) Check MediaRouter NuGet package was added to you project and project References.
2) Check Android SDK manager for latest update on our target SDK
And latest Support Library

Make sure , u don't add the these package manually , some time xamarin forms are not compatible with newest releases of android pkgs,
simply remove all the package , and add Xamarin forms from nuget ,this will automatically download all the required dependency
also make sure to install required packages , from tool-> android sdks manager -> select relevant listiings (extras in last).
I have succesfully implemented GCM based push notification let me know if u get stuck somewhere

If you already have Android Support Library installed and still you get this error then the following solution might work.
I deleted the folder 23.3.0.0 from the folder C:\Users(UserName)\AppData\Local\Xamarin\Android.Support.v7.MediaRouter and rebuilt the project again to fix it.
Basically, Xamarin picks the right version from Android SDK and extracts files in the above mentioned folder.

Related

Could not install package

Could not install package 'Xamarin.Kotlin.StdLib.Jdk8 1.6.10'. You are trying to install this package into a project that targets 'MonoAndroid,Version=v11.0', but the package does not contain any assembly references or content files that are compatible with that framework.
You can fix that by targeting Android 12.
Change:
<TargetFrameworkVersion>v11.0</TargetFrameworkVersion>
To:
<TargetFrameworkVersion>v12.0</TargetFrameworkVersion>
This has to be done in all your Android projects, including Library projects.
Make sure your Xamarin.Android tooling is up to date, along with having API 32 installed in your Android SDK manager.
Also don't get fooled by the AndroidUseLatestPlatformSdk property if you do not have the correct SDK installed. It will just grab the latest you have installed and if that is lower than 12, you will still have the issue.
Also make sure to restore NuGet packages after this change.

Xamarin: Try to run the Project. I'm new bee for xamarin and want to run my xamarin ios project

I want to run the xamarin ios project and maybe its native code for ios xamarin.
I install visual studio for mac and open the project, then add missing packages.
But in One package Zxing.Mobile I get the error (I can't find relative package) So I comment related code and try to run the project. So I get the few errors and here I attached that snap
So please help me I'm iOS native developer and want to run this xamarin project.
This error generally occurs when a dependency of your nuget package is having an issue and can't be linked. You can try installing the dependency nuget package manually and that should resolve it.

Xamarin - Updating nuget packages caused errors

I created a "Cross-Platform App (Xamarin.Forms)" app, and i immediately went and update the nuget packages (this is what i was told to do). Then i tried to built it, and not only I got several errors(see bellow) that were about the updated packages, I had code errors as well. I swear the God that i didn't touch the code of the project at all, and here is what I get:
I googled, but i couldn't find out a clean solution for this. I am just one step before quitting this (unprofessional) product, because i cannot run the ready template. Is there someone that can give me a piece of advice for these ridiculous errors ?
Could not install package 'Xamarin.XXXXXXX'. You are trying to install this package into a project that targets 'MonoAndroid,Version=vX.X'
You need to increase your "Compile Target Framework" to at least 7.0 as this error indicates.
You can review the dependancies of a package on the Nuget.org site by looking at the Dependencies section of a particular package:
https://www.nuget.org/packages/Xamarin.Android.Support.v7.AppCompat/
Another SO question/answer example that requires at least MonoDroid 8.0:
https://stackoverflow.com/a/49138485/4984832
Example:
Xamarin.Android.Support.v4 27.0.x.x requires at least MonoAndroid 8.1 to be set as the Compile Target Framework:
You have to use newer android SDK version. You can download the SDK from android SDK manager and then select it from project properties

Xamarin version of Android SDK packages are not found (both Xamarin.Android and Xamarin.Forms)

After an upgrade of Xamarin.Android solution I've encountered the following error:
Please install package: 'Xamarin.Android.Support.v7.AppCompat' available in SDK installer. Java library file C:\Users\YOURUSERNAME\AppData\Local\Xamarin\Xamarin.Android.Support.v7.AppCompat\24.2.1.0\content\classes.jar doesn't exist.
There are number of other android support packages mentioned too. I can reproduce exactly the same situation with Xamarin.Forms.
I've checked the paths mentioned, but i can see the correct .jar in there. Forcing a reinstall of the NuGet package does not fix the problem.
The problem is caused by broken downloaded archives or broken extracted archives content. The solution is:
Ensure you have the latest version of the packages via Android SDK
Manager (e.g. Extras -> Android Support Library)
Delete the content of
C:\Users\YOURUSERNAME\AppData\Local\Xamarin\zips
Delete the content of the corresponding to the error message
C:\Users\YOURUSERNAME\AppData\Local\Xamarin\Xamarin.Android.PACKAGE_NAME
folders
Rebuild the solution from Visual Studio
NOTE: Do not interrupt rebuild process. It takes some time to download the archives. They are relatively big.

Attempting to add an MQTT library from NuGet into Xamarin project

I saw that Xamarin was now free and decided to try writing a mobile app using it instead of what another technology I was playing with. After some various hiccups, I was able to get the new Xamarin Android project to build, deploy and run on the simulator. I then decided to try out MQTT connectivity from it before I went any further. No matter which MQTT library I to install from NuGet, for example the System.Net.Mqtt one from Xamarin, I get the following error:
"Could not install package 'System.Net.Mqtt 0.3.12-pre'. You are trying to install this package into a project that targets 'MonoAndroid,Version=v6.0', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author."
I tried several others with no success. It does the same for the ios and Android projects. I did try changing the Android SDK version to use for compiling, but still had the same result. I also don't understand why it says MonoAndroid since I thought all the Mono references were changed to Xamarin? I'm using Visual Studio 15 with Update 2. I tried the stable Xamarin version and also tried the latest alpha. I'm not sure what else to try, I'd really to give Xamarin a try for this project. I did some searching and couldn't find anything that appeared to help with this issue.
Thanks in advance for any help.
Use the Package Manager Console. Then, either:
Install the latest version of MQTT library.
Or install first its dependency, RX-Main and then MQTT.
If you still get an error, please share with us the Log that is shown in the PM Console.

Resources