xamarinxamarin.androidlottie

Java.Lang.IllegalStateException: 'Unable to parse composition' using Lottie in splashscreen xamarin forms (android)


I'm getting an error Java.Lang.IllegalStateException: 'Unable to parse composition' when I try to use it on the splash screen

I'm using lottie vs 4.1

the code is:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <com.airbnb.lottie.LottieAnimationView
        android:id="@+id/animation_view"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        app:lottie_loop="false"
        app:lottie_speed="2.0"
        app:lottie_fileName="xamarin.json"
        app:lottie_autoPlay="true"/>
</LinearLayout>

Is there a specific "build action" to set to the "xamarin.json" file? the default I have is set to "none"


Solution

  • The xamarin.json file will need to live in your resource/raw folder and have the build action set to AndroidResource (this should normally automatically happen when you add files to resources). If you set it to none it won't even be included in your project.