Image not showing/crashing app on some versions

leeyoleeyo USMember ✭✭

Hi,

I've made an APK of my application to deploy it on a friend's Android device. Everything goes well but one image doesn't show on his device and it does show on my device and other friend's one (with same APK source file, of course).

Bugging device: Galaxy Note 3 with Android 5.0
Working devices: Oneplus 3 with Android 8.0 & Samsung A3 with Android 6.0.1
Android project: MinTarget=4.0.3 & compiled with Android 8.0

The code looks like this:

<Grid HorizontalOptions="Fill" VerticalOptions="Fill">
<Image Source="{Binding Source={x:Static resources:ImagesIndex.Background}}" Aspect="AspectFill" />
<StackLayout Orientation="Vertical" HorizontalOptions="Fill" VerticalOptions="Fill" Margin="10" Padding="10" BackgroundColor="#AAFFFFFF">
// some content
</StackLayout>
</Grid>

Just so you know, the "{x:Static resources:ImagesIndex.Background}}" syntax is used for every other images and there is no problem with them. It points to a string "background.jpg" and this background file is located under AndroidProject/Resources/drawable as AndroidResource.

I've made some other tries:

  • Removing the « BackgroundColor="#AAFFFFFF" » from child StackLayout but no difference
  • Expanding the Image with HorizontalOptions & VerticalOptions as "Fill" but no difference
  • Finally, I went to call this image in the background of parent page with « BackgroundImage="{x:Static resources:ImagesIndex.Background}}" » and the app went to crash after splashscreen on each run

One more thing: This "Grid" code (shown above) works on the bugging phone with a ScrollView in place of the StackLayout, so could the StackLayout be the cause of troubles even if this explanation still doesn't tell me why app is crashing with BackgroundImage applied on the parent page (ContentPage)?

Thanks for reading.

Posts

  • CharwakaCharwaka INMember ✭✭✭✭✭

    @leeyo said:
    Hi,

    I've made an APK of my application to deploy it on a friend's Android device. Everything goes well but one image doesn't show on his device and it does show on my device and other friend's one (with same APK source file, of course).

    Bugging device: Galaxy Note 3 with Android 5.0
    Working devices: Oneplus 3 with Android 8.0 & Samsung A3 with Android 6.0.1
    Android project: MinTarget=4.0.3 & compiled with Android 8.0

    The code looks like this:

    <Grid HorizontalOptions="Fill" VerticalOptions="Fill">
    <Image Source="{Binding Source={x:Static resources:ImagesIndex.Background}}" Aspect="AspectFill" />
    <StackLayout Orientation="Vertical" HorizontalOptions="Fill" VerticalOptions="Fill" Margin="10" Padding="10" BackgroundColor="#AAFFFFFF">
    // some content
    </StackLayout>
    </Grid>

    Just so you know, the "{x:Static resources:ImagesIndex.Background}}" syntax is used for every other images and there is no problem with them. It points to a string "background.jpg" and this background file is located under AndroidProject/Resources/drawable as AndroidResource.

    I've made some other tries:

    • Removing the « BackgroundColor="#AAFFFFFF" » from child StackLayout but no difference
    • Expanding the Image with HorizontalOptions & VerticalOptions as "Fill" but no difference
    • Finally, I went to call this image in the background of parent page with « BackgroundImage="{x:Static resources:ImagesIndex.Background}}" » and the app went to crash after splashscreen on each run

    One more thing: This "Grid" code (shown above) works on the bugging phone with a ScrollView in place of the StackLayout, so could the StackLayout be the cause of troubles even if this explanation still doesn't tell me why app is crashing with BackgroundImage applied on the parent page (ContentPage)?

    Thanks for reading.

    Post in Xamarin Forms forum

Sign In or Register to comment.