Reputation: 1017
Im trying to do a simple loading with lottie. I found this animation: https://lottiefiles.com/18563-cooking#_=_
<com.airbnb.lottie.LottieAnimationView
android:id="@+id/animation_view"
android:layout_width="200dp"
android:layout_height="200dp"
app:lottie_autoPlay="true"
app:lottie_loop="true"
app:lottie_rawRes="@raw/test"
/>
It's stored in SRC/Main/res/raw but I get this error:
You must set an images folder before loading an image. Set it with LottieComposition#setImagesFolder or LottieDrawable#setImagesFolder
I try to add to assets folder with app:lottie_fileName
So I think the animation is bug, because of this I want to know if exist some tools or command to know if animation works.
Upvotes: 3
Views: 7514
Reputation: 1391
in my case ,my lottie json file contains code fragment like this:
{
"id": "image_0",
"w": 1241,
"h": 802,
"u": "images/",
"p": "image_01.png",
"e": 0
}
it means it need image image_01.png
to work. and it will look for it from folder images/
.
if you don't provide this images folder location it will throw this exception.
here is the step i solved my problem.
assets
folder, the folder sturcture:+-assets +----images ---------image_01.png
app:lottie_imageAssetsFolder="images"
in the xml( oryou can addsetImageAssetsFolder("/images");
in code. )
Upvotes: 5