Unable to add Xamarin Google Play Services - xamarin

I'm unable to add GCM to my Xamarin app. This is the output from the package console:
Adding Xamarin.GooglePlayServices.Gcm...
Attempting to resolve dependency 'Xamarin.GooglePlayServices.Base (= 29.0.0.1)'.
Attempting to resolve dependency 'Xamarin.GooglePlayServices.Basement (= 29.0.0.1)'.
Attempting to resolve dependency 'Xamarin.Android.Support.v4 (≥ 23.1.1.1)'.
Attempting to resolve dependency 'Xamarin.GooglePlayServices.Measurement (= 29.0.0.1)'.
Updating 'Xamarin.Android.Support.v4 23.0.1.3' to 'Xamarin.Android.Support.v4 23.3.0' failed. Unable to find a version of 'Xamarin.Forms' that is compatible with 'Xamarin.Android.Support.v4 23.3.0'.

For this version you must install an earlier version of Xamarin.GooglePlayServices.Gcm. I had no problems with 27.0.0.
If you need the newest version, you could do this:
uninstall xamarin.forms nuget package
update all android packages to 23.3.0
install Xamarin.GooglePlayServices.Gcm
search for xamarin.forms and set in options ignore dependencies
install newest version
Of course you must be aware of problems, since this is not recommended with good reasons.

You need to Update your Xamarin.Forms package. Open Packages (Dropdown) in Solutions pane and Right-Click on Xamarin.Forms and click on Update
If you are using PCL, you can find this package in the PCL (Xamarin.Forms) project.
If you are using Shared Asset Project, you will find this package in both Xamarin.Android and Xamarin.iOS project.

You have to update Android SDK Platform-tools to revision 26.0.2 (or equivalent).
Open Android SDK Manager, check update, and select
"Update avaiable rev.26.0.2" and install it.

Related

Error NU1107 Version conflict detected for Xamarin.AndroidX.Lifecycle.LiveData

I get the following error:
Error NU1107 Version conflict detected for Xamarin.AndroidX.Lifecycle.LiveData.
Install/reference Xamarin.AndroidX.Lifecycle.LiveData 2.4.1.1 directly to project MyProject.Android to resolve this issue.
MyProject.Android -> Xamarin.GooglePlayServices.Ads 121.2.0 -> Xamarin.GooglePlayServices.Ads.Lite 121.2.0 ->
Xamarin.AndroidX.Work.Runtime 2.7.1.3 ->
Xamarin.AndroidX.Lifecycle.LiveData (>= 2.4.1.1)
MyProject.Android -> Xamarin.Forms 5.0.0.2515 -> Xamarin.AndroidX.Lifecycle.LiveData (>= 2.3.1.1 && < 2.4.0).
Which packages should I upgrade or downgrade in order to achieve compatibility?
I have created a new project to test the packages you mentioned. And I found two solutions:
Just use the following package in your project's android part:
Xamarin.AndroidX.Browser version 1.4.0.1
Xamarin.AndroidX.Lifecycle.LiveData version 2.4.1.1
Xamarin.GooglePlayServices.Ads version 121.2.0
Xamarin.Forms version 5.0.0.2515
This solution just adds the reference to the project's android part according to the error messages. And the project will build successfully even though there are still some warnings about the package.
The second solution:
use the Xamarin.Forms version 5.0.0.2545
and the Xamarin.GooglePlayServices.Ads version 120.4.0
The Xamarin.GooglePlayServices.Ads version 120.4.0 is the newest version which is compatible with the Xamarin.AndroidX.Browser (>= 1.3.0.6 && < 1.4.0). If you use the two packages above, there will not be any warnings or errors about the reference.
If you can, you should upgrade to Xamarin.Forms 5.0.0.2545. It allows for LiveData to be high enough. It's a minor upgrade for XF, so it shouldn't cause you any issues to upgrade.
If for whatever reason you can't upgrade Xamarin Forms, you'll need to downgrade GooglePlayServices.Ads to a version that allows for the lower Work.Runtime version which in turn allows for the lower LiveData version.

Xamarin MSAL NuGet error - Version conflict detected for Xamarin.Android.Support.Compat

I'm trying to add the MSAL NuGet package https://www.nuget.org/packages/Microsoft.Identity.Client to a Xamarin forms project but keep getting the following error:
Package restore failed. Rolling back package changes for
'MobileApp.Android'.
Error NU1107 Version conflict detected for
Xamarin.Android.Support.Compat. Install/reference
Xamarin.Android.Support.Compat 27.0.2.1 directly to project
MobileApp.Android to resolve this issue.
MobileApp.Android -> Xamarin.Android.Support.v7.MediaRouter
27.0.2.1 -> Xamarin.Android.Support.v7.Palette 27.0.2.1 ->
Xamarin.Android.Support.Compat (= 27.0.2.1)
MobileApp.Android -> Microsoft.Identity.Client 2.2.0-preview ->
Xamarin.Android.Support.CustomTabs 27.0.2 -> Xamarin.Android.Support.Compat
(= 27.0.2).
I've tried clearing the NuGet cache from Visual Studio 2017 -> Tools -> Options -> NuGet Package Manager, and also manually clearing the cache by deleting the contents of the following folders:
%userprofile%\.nuget\packages
%localappdata%\NuGet\v3-cache
%temp%\NuGetScratch
%localappdata%\NuGet\plugins-cache
I've also tried creating a new blank project and just adding the NuGet package but continue to receive the same error. NuGet seems to working OK for other types of projects.
Any ideas much appreciated.
Xamarin MSAL NuGet error - Version conflict detected for Xamarin.Android.Support.Compat
This is nuget package version conflict issue.
To resolve this issue, you should install the package Xamarin.Android.Support.CustomTabs 27.0.2.1 at first, then install the package Microsoft.Identity.Client.
The reason for this issue:
Since you have already installed the package Xamarin.Android.Support.v7.MediaRouter
27.0.2.1 in your project, which have a indirect dependence Xamarin.Android.Support.Compat (= 27.0.2.1). When you install the package Microsoft.Identity.Client to the project, which also have a indirect dependence Xamarin.Android.Support.Compat (= 27.0.2). You could notice that the versions are different, a project cannot reference the same reference different version, which cause the version conflict.
To resolve this issue, we need to unify the references of these two different versions. Check the Dependencies of the package Microsoft.Identity.Client 2.2.0-preview, this package have a dependency Xamarin.Android.Support.CustomTabs (>= 27.0.2) and the dependency Xamarin.Android.Support.CustomTabs (>= 27.0.2) also have a dependency Xamarin.Android.Support.Compat (= 27.0.2). So to resolve this issue, we just need to install the dependency Xamarin.Android.Support.CustomTabs (>= 27.0.2.1) at first, which have the dependency is Xamarin.Android.Support.Compat (= 27.0.2.1):
Hope this helps.

Trouble adding package System.Data.Common

I'm building a console project using Xamarin 6.1.1 on Mac OS X 10.11.6.
I've attached a screenshot of my current installed packages. I've tried adding both System.Data.Common 4.0.0 and 4.1.0 all end up with the same error.
ERROR:
"Could not install package 'System.Data.Common 4.1.0'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.5', 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."
Any idea on how to resolve this issue?
the nuget page for System.Data.Common lists the supported frameworks - for .NET you need to be sure your project targets 4.5.1

Appcelerator on Windows 10, module build issues [duplicate]

I have create a new Mobile Module Project, but when i try to build it, i have this error:
BUILD FAILED
C:\ProgramData\Titanium\mobilesdk\win32\5.2.2.GA\module\android\build.xml:165:
no executable specified
Did something wrong? I did the following step:
-Installed Appcelerator Studio
-It automatically installed Titanium SDK and i selected to install Android SDK
-Installed JAVA JDK
-Createed new module and tryed to build it
To fix this, edit the file:
C:\ProgramData\Titanium\mobilesdk\win32\5.2.2.GA\module\android\build.xml
Or for any newer SDK versions, just use e.g. 5.3.1 instead of 5.2.2
On line 159, add ".exe" to aidl, like so:
TO
To develop android module you will have to install some additional component and configure some path variables. There is a nice quick start guide where you will find everything. Thinks that need to install:
Android NDK
Ant
Eclipse Java Development Tools plugin
Android Development Tools plugin
gperf
Python
Documentation Link

Cannot install NuGet package Microsoft.Bcl.Build 1.0.14

I am making a multi-platform app in VS 2013 (iOS, WinPhone and Android). I want to add into the iOS reference folder a Nuget Packages named Microsoft Http Clients Libraries and I cannot do it because I get the following error:
Could not install package 'Microsoft.Bcl.Build 1.0.14'. You are trying
to install this package into a project that targets
'Xamarin.iOS,Version=v1.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.
Can anybody help me with that?
I faced the same problem and apparently the Bcl.Build 1.0.14 can not be installed, but you probably you don't need that old version.
I faced this issue when I tried adding WindowsAzure.MobileService to the iOS Xamarin project. And it failed, because the minimal supported Bcl.Build is required to be 1.0.14, but if you have a newer version, which installs quite fine, you will be able to add other packages that depend on it.
So
1. Install Microsoft.Bcl.Build package separately (the latest)
2. Install your package that depends on it.
Go to -> Solution -> Manage Packages For Solution -> In the tab "Browse" -> Select the two options follow below:
First:
Install package "Microsoft.Bcl.Build" your version more latest 1.0.21
Second:
After this step, now install package "Microsoft.Net.Http" your version mor latest 2.2.29
Result:
For me was solved!
Microsoft.Bcl.Build 1.0.14 can be installed into Xamarin.iOS projects.
It may fail if:
Your NuGet Package manager is not up to date.
You do not have the Xamarin Portable Class Library profiles for Xamarin.iOS installed.
If you have the latest Xamarin version installed it is probably the NuGet Package Manager not being up to date. You can update it from Tools - Extensions and Updates - Updates - Visual Studio Gallery.
In Visual Studio 2017 I encountered above error, and I solved the issue by installing Microsoft.Bcl.Build first on the Xamarin.Android, then installed Microsoft.Net.Http and System.Net.Http, but Xamarin.IOS and Xamarin.UWP there were no issues.
I found the solution and put it here in case some one may face the same problem.
Install "Microsoft.Bcl.Build.1.0.21" first for all your projects.
Now you can install "PortableRest", all dependency that depends on Microsoft.Bcl.Build will be installed correctly.
I was trying to install Microsoft.Net.Http in my Xamarin.Forms project when i faced this issue. Here is what you must try to get rid of this error:
1- Update Xamarin.Forms to latest version in each project of solution.
2- As my primary intention was to install Microsoft.Net.Http, and this package had dependencies on Microsoft.BCL and Microsoft.BCL.Build. I tried installing these packages (Microsoft.Bcl and Microsoft.Bcl.Build) individually and it worked for me. First install latest version of Microsoft.Bcl.Build 1.0.21 (If 1.0.14 did not install, try latest version). Then, install Microsoft.Bcl which should be installed successfully and this solution worked for me and I hope would work for you too. After installing these packages indivisually, I was able to install Microsoft.Net.Http successfully.
NOTE: While installing Packages (Microsoft.Bcl and Microsoft.Bcl.Build) into your projects, check which version you are installing. Try installing another version, if one does not work and let me know If problem does not solve.
Have a great day :)

Resources