Lottie-android: You must set an images folder before loading an image.IllegalStateException

Created on 8 Jun 2017  Â·  6Comments  Â·  Source: airbnb/lottie-android

Hello
I'm using this repo and have one problem.
I generated .json file with images from Adobe After Effect successfully.I inserted my json file in assets folder and images(5 images) in assets/Image.WeAccept folder.This is a part in my code
``` android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="32dp"
android:background="@color/colorPrimary">
android:id="@+id/animation_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
app:lottie_fileName="Test.json"
app:lottie_loop="true" />
``

But when i run my app i have IllegalStateException.
More about log message:

java.lang.IllegalStateException: You must set an images folder before loading an image. Set it with LottieComposition#setImagesFolder or LottieDrawable#setImagesFolder

How i can solve this problem?
Thanks

```

Most helpful comment

Hello
I used version 2.70。The same problem has occurred。
I used image resources。
mLottieAnimationView.setImageAssetsFolder("images");
mLottieAnimationView.setAnimation("data.json");

You must set an images folder before loading an image. Set it with LottieComposition#setImagesFolder or LottieDrawable#setImagesFolder
com.airbnb.lottie.manager.ImageAssetManager.bitmapForId(ImageAssetManager.java:107)

All 6 comments

@Bekakk if you're trying to test it in the sample app, add your animation to this map

Found out that removing and reloading Assets folder removed the error

Hello

Hello
I used version 2.70。The same problem has occurred。
I used image resources。
mLottieAnimationView.setImageAssetsFolder("images");
mLottieAnimationView.setAnimation("data.json");

You must set an images folder before loading an image. Set it with LottieComposition#setImagesFolder or LottieDrawable#setImagesFolder
com.airbnb.lottie.manager.ImageAssetManager.bitmapForId(ImageAssetManager.java:107)

Hello
I used version 2.70。The same problem has occurred。
I used image resources。
mLottieAnimationView.setImageAssetsFolder("images");
mLottieAnimationView.setAnimation("data.json");

You must set an images folder before loading an image. Set it with LottieComposition#setImagesFolder or LottieDrawable#setImagesFolder
com.airbnb.lottie.manager.ImageAssetManager.bitmapForId(ImageAssetManager.java:107)

Thank you so much @fang1994042128 . It is very helpful.

Was this page helpful?
0 / 5 - 0 ratings