tbaggett / xfgloss

New styling properties for standard Xamarin.Forms controls
Other
160 stars 25 forks source link

Xamarin.iOS: Unable to locate assembly 'XFGloss' (culture: '') #21

Closed jdivins closed 6 years ago

jdivins commented 7 years ago

I get this error and the app crash.

Xamarin.iOS: Unable to locate assembly 'XFGloss' (culture: '') Why?

The xaml file:

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:maps="clr-namespace:Xamarin.Forms.GoogleMaps;assembly=Xamarin.Forms.GoogleMaps"
             xmlns:xfg="clr-namespace:XFGloss;assembly=XFGloss"
             x:Class="ApliPur.SeleccionarRecintePage"
             Title="Recintes">
    <StackLayout>
        <maps:Map x:Name="mapaRecintes"/>
    <ListView x:Name="llistaRecintes" ItemSelected="escollirRecinte">
      <ListView.ItemTemplate>
        <DataTemplate>
          <ViewCell xfg:CellGloss.BackgroundColor="{Binding color}">
            <StackLayout Margin="20,0,0,0" Orientation="Horizontal" HorizontalOptions="FillAndExpand" Style="{StaticResource TextLlista}">
                <Label Text="{Binding nomApp}" VerticalTextAlignment="Center" HorizontalOptions="StartAndExpand" Style="{StaticResource TextLlista}"/>
                <Label Text="{Binding stringDistancia}" VerticalTextAlignment="Center" HorizontalOptions="StartAndExpand" Style="{StaticResource TextLlista}"/>
                <Label Text="{Binding hectarees}" VerticalTextAlignment="Center" HorizontalOptions="StartAndExpand" Style="{StaticResource TextLlista}"/>
                <Label Text="{Binding nitrogenPerTirar}" VerticalTextAlignment="Center" HorizontalOptions="StartAndExpand" Style="{StaticResource TextLlista}"/>     
            </StackLayout>
          </ViewCell>
        </DataTemplate>
      </ListView.ItemTemplate>
    </ListView>

  </StackLayout>

</ContentPage>
jbachelor commented 7 years ago

Did you make sure to add the XFGloss nuget package to your iOS project in addition to your PCL project?

jdivins commented 7 years ago

Yes, I am sure Ansuria.XFGloss is added in all packages

tbaggett commented 7 years ago

Hi @jdivins,

Did you also call the Init function in your AppDelegate class?

namespace XFGlossSample.iOS
{
    [Register("AppDelegate")]
    public partial class AppDelegate : global::Xamarin.Forms.Platform.iOS.FormsApplicationDelegate
    {
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            Xamarin.Forms.Forms.Init();

            /********** ADD THIS CALL TO INITIALIZE XFGloss *********/
            XFGloss.iOS.Library.Init();

            LoadApplication(new App());

            return base.FinishedLaunching(app, options);
        }
    }
}
tbaggett commented 6 years ago

Hi @jdivins, is this still an issue with the new 1.1.0 release? Thanks

VirtualNomad00 commented 6 years ago

Still getting error Failed to resolve assembly: 'XFGloss, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' for both iOS and Android in a xamarin.Forms app xamarin.Forms version : 2.5.0.28055 XFGloss version : 1.1.1.83

Below is my code

Xaml code

<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:local="clr-namespace:XAMFORM.APP"
             xmlns:behaviors="clr-namespace:Behaviors;assembly=Behaviors"
             xmlns:controls="clr-namespace:XAMFORM.APP.controls"
             xmlns:xfg="clr-namespace:XFGloss;assembly=XFGloss"
             x:Class="XAMFORM.APP.HomePage">
     <xfg:ContentPageGloss.BackgroundGradient>
        <xfg:Gradient Rotation="150">
            <xfg:GradientStep StepColor="White" StepPercentage="0" />
            <xfg:GradientStep StepColor="White" StepPercentage=".5" />
            <xfg:GradientStep StepColor="#ccd9ff" StepPercentage="1" />
        </xfg:Gradient>
...........
</ContentPage>

MainActivity.cs

protected override void OnCreate(Bundle bundle)
        {
            TabLayoutResource = Resource.Layout.Tabbar;
            ToolbarResource = Resource.Layout.Toolbar;
            base.OnCreate(bundle);
            global::Xamarin.Forms.Forms.Init(this, bundle);
            global::Xamarin.FormsMaps.Init(this, bundle);
            LoadApplication(new App());
            XFGloss.Droid.Library.Init(this, bundle);
        }

AppDelegate.cs

public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            global::Xamarin.Forms.Forms.Init();
            global::Xamarin.FormsMaps.Init();
            XFGloss.iOS.Library.Init();
            LoadApplication(new App());
            return base.FinishedLaunching(app, options);
        }

Below is the related console output which might be useful

Dependency "XFGloss, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null".
1>      Could not resolve this reference. Could not locate the assembly "XFGloss, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.
1>          For SearchPath ".........\packages\Ansuria.XFGloss.1.1.1.83\lib\MonoAndroid10".
1>          Considered ".......\packages\Ansuria.XFGloss.1.1.1.83\lib\MonoAndroid10\XFGloss.winmd", but it didn't exist.
1>          Considered 
               .
               .
               .
               .
1>      Required by "XFGloss.Droid, Version=1.1.1.83, Culture=neutral, processorArchitecture=MSIL".

Am new to Xamarin so in case am making some obvious mistake I apologize in advance

tbaggett commented 6 years ago

Thanks for providing the details. I will investigate this issue further tonight after work.

asmundur commented 6 years ago

I'm having this issue as well

tbaggett commented 6 years ago

Hi @VirtualNomad00 and @asmundur, please try the new 1.1.2.89 release. I don't think it will resolve your problem, but please verify first before proceeding.

I have created a new Github repository for the XFGlossSample app. That version of the sample app uses the XFGloss NuGet package. Its available at https://github.com/tbaggett/XFGlossSample. Please download the XFGlossSample source and try to build it on your system if you still have the issue after updating the Nuget package in your project. Please let me know how it goes. Thanks!

VirtualNomad00 commented 6 years ago

@tbaggett the new release did it for me. Thanks a lot for the swift response.

tbaggett commented 6 years ago

That's good news, @VirtualNomad00. You're welcome, though it took me a long while to get back to providing a quick response. 😄 I'm happy it took care of the issue.

MoraesRafa commented 4 years ago

Estou com esse problema na versão 2019 do visual, alguém pode me ajudar??

Falied to resolve assembly: 'XFGloss, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'

xamarim version: 3.6.0.293080 XFGloss version: 1.1.3

help me please!!