question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

crash on Android using Xamarin.Forms 2.4.0 and FFImageLoading 2.2.22

See original GitHub issue

Hello,

I get crash on Android using Xamarin.Forms 2.4.0 and FFImageLoading 2.2.22:

My xaml-page:

<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:ffimageloading="clr-namespace:FFImageLoading.Forms;assembly=FFImageLoading.Forms"
             xmlns:local="clr-namespace:Bug"
             x:Class="Bug.ImgList">
    <AbsoluteLayout HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand">        
                               <ListView
                                               HasUnevenRows="True"
                                               SeparatorVisibility="None"
                                               SeparatorColor="Transparent"
                                               IsGroupingEnabled="True"
                                               ItemsSource="{Binding ImageSrc}"
                                               ItemSelected="OnItemSelected"
                                               CachingStrategy="RecycleElement"
                                               VerticalOptions="FillAndExpand">
                                               <ListView.ItemTemplate>
                                                               <DataTemplate>
                                                                              <local:ViewCell/>
                                                               </DataTemplate>
                                               </ListView.ItemTemplate>
                               </ListView>
    </AbsoluteLayout>
</ContentPage>

Where ViewCell:

<ViewCell xmlns="http://xamarin.com/schemas/2014/forms" 
          xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
          xmlns:ffimageloading="clr-namespace:FFImageLoading.Forms;assembly=FFImageLoading.Forms"
          xmlns:ffimagetransforms="clr-namespace:FFImageLoading.Transformations;assembly=FFImageLoading.Transformations"
          x:Class="Bug.ViewCell">
    <Grid x:Name="ViewCell" Margin="0, 0, 0, 22" RowSpacing="0">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="72" />
            <ColumnDefinition Width="*"/> 
        </Grid.ColumnDefinitions>

        <AbsoluteLayout HorizontalOptions="FillAndExpand" VerticalOptions="StartAndExpand" Grid.Column="0">
            <ffimageloading:CachedImage 
                Aspect="AspectFit"
                HeightRequest="40"
                WidthRequest="40"
                AbsoluteLayout.LayoutBounds="0.5, 0.5, AutoSize, AutoSize"
                AbsoluteLayout.LayoutFlags="PositionProportional"
                Source="{Binding Img}">
                <ffimageloading:CachedImage.Transformations>
                    <ffimagetransforms:CircleTransformation/>
                </ffimageloading:CachedImage.Transformations>
            </ffimageloading:CachedImage>
            <Label
                Text="{Binding Text}"
                FontSize="16"
                TextColor="White"
                AbsoluteLayout.LayoutBounds="0.5, 0.5, AutoSize, AutoSize" 
                AbsoluteLayout.LayoutFlags="PositionProportional"
                IsVisible="{Binding HasText}"/>
        </AbsoluteLayout>
    </Grid>
</ViewCell>

ImageSrc class:

public class ImageSrc
{
        public bool HasText { get; }

        public string Text
        {
                get
                {
                      return "TT";
                }
       }

       public ImageSource Img { get; } //here some different source values - some from Android resources, some from stream.
}

Create at least several hundreds of items and start scrolling list view up and down – you’ll get crash (on Android 7.0) with one of the following errors:

“JNI ERROR (app bug): attempt to use stale global reference” Or “JNI ERROR (app bug): accessed deleted global reference”

Seems to be race condition somewhere in image loading.

I don’t have any crashes when I use FFImageLoading version 2.2.6 and 2.2.11.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:12 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
grasdycommented, Nov 14, 2017

@daniel-luberda I check version 2.2.25 and it’s look like this bug is fixed. Thanks a lot!

1reaction
daniel-luberdacommented, Nov 13, 2017

Could you check if it’s solved in 2.2.25?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Xamarin Forms: Crash reports are not showing in App ...
I have implemented the App Center crash analytics into my Xamarin forms application. Step 1: Installed Microsoft.AppCenter.
Read more >
After installing FFImageLoading images don't show at all
Under Android, in OnCreate method of MainActivity.cs , I added FFImageLoading.Forms.Platform.CachedImageRenderer.Init(enableFastRenderer:true); ...
Read more >
Xamarin.FFImageLoading.Forms 2.4.9.961
Xamarin Library to load images quickly and easily on Xamarin.Forms. ... Multiple image views using the same image source (url, path, ...
Read more >
Xamarin Forms app crashes when replication started on ...
I have a small test app that I use to test various aspects of Couchbase Lite and sync'ing with a Couchbase server.
Read more >
Xamarin out of memory error, when camera takes pictures
I use this as a folder to store camera data. I use Xam.Plugin.Media for photos. string folder = Path.Combine("/storage/emulated/0/Android/data ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found