Reputation: 1043
I am using Xamarin Forms with visual studio 2017 .. the new project is always has Xamarin.Forms v 2.3.3.191. The project doesn't work .. it stops on (InitializeComponent) on the MainPage .. just stops and nothing happening. I thought the problem is with Xamarin.Forms version, so I installed the update of Xamarin.Forms .. the version 2.5.0.121934 (Last Stable) Then when I rebulid the Android project it gives me that error
Severity Code Description Project File Line Suppression State Error Exception while loading assemblies: System.IO.FileNotFoundException: Could not load assembly 'Xamarin.Android.Support.Fragment, Version=1.0.0.0, Culture=neutral, PublicKeyToken='. Perhaps it doesn't exist in the Mono for Android profile? File name: 'Xamarin.Android.Support.Fragment.dll'
And these are the packages
<package id="Xamarin.Android.Support.Animated.Vector.Drawable" version="23.3.0" targetFramework="monoandroid60" />
<package id="Xamarin.Android.Support.Design" version="23.3.0" targetFramework="monoandroid60" />
<package id="Xamarin.Android.Support.v4" version="23.3.0" targetFramework="monoandroid60" />
<package id="Xamarin.Android.Support.v7.AppCompat" version="23.3.0" targetFramework="monoandroid60" />
<package id="Xamarin.Android.Support.v7.CardView" version="23.3.0" targetFramework="monoandroid60" />
<package id="Xamarin.Android.Support.v7.MediaRouter" version="23.3.0" targetFramework="monoandroid60" />
<package id="Xamarin.Android.Support.v7.RecyclerView" version="23.3.0" targetFramework="monoandroid60" />
<package id="Xamarin.Android.Support.Vector.Drawable" version="23.3.0" targetFramework="monoandroid60" />
<package id="Xamarin.Forms" version="2.5.0.121934" targetFramework="monoandroid60" />
I tried to update Xamarin.Android.Support.v7.AppCompat but it gives me an error
Severity Code Description Project File Line Suppression State Error Unable to resolve dependencies. 'Xamarin.Android.Support.v7.AppCompat 26.1.0.1' is not compatible with 'Xamarin.Forms 2.5.0.122203 constraint: Xamarin.Andr
Now I have two cases:
I am working with Android 6 Marshmallow API 23
PLEASE HELP ME
Upvotes: 2
Views: 1190
Reputation: 1141
I solved the same issue by setting the Android Target Framework (not to be confused with the Android Target Version) to Android 7.0 as described in the Xamarin.Forms 2.5.0 release notes:
With Xamarin.Forms 2.3.4, the restriction limiting developers to Android Support Library 23 was lifted allowing developers to choose new Google Play Services and Android Support Library dependencies. This opens up more possibilities and flexibilities for developers, but also vastly complicates resolving dependencies in projects using different libraries. Now in Xamarin.Forms 2.5.0, in order to support Google Play Services 42.1024.0 or greater, Xamarin.Forms depends on Android Support Libraries 25.4.0.2 or greater.
When using Xamarin.Forms 2.5.0, be sure to start with a baseline of these dependencies as appropriate to your project. This is the combination of dependencies with which Xamarin.Forms has been tested.
- Android Target Framework 7.0 (monoAndroid70)
- Android Support Libraries 25.4.0.2
- Google Play Services 42.1024.0
Afterwards I deleted the Xamarin.Forms package and all its referencing Android Support packages and reinstalled Xamarin.Forms version 2.5. However, this kept always the Android Support libraries in version 23.3 being installed. By choosing Update from the Xamarin.Forms package's context menu the correct Android Support Libraries in version 25.4.0.2 were installed.
Upvotes: 1