airbnb / lottie-android

Render After Effects animations natively on Android and iOS, Web, and React Native
http://airbnb.io/lottie/
Apache License 2.0
35.03k stars 5.41k forks source link

Add Wear OS support? (Wear OS is pretty much Android at many levels) #2129

Closed Actualization closed 1 year ago

Actualization commented 2 years ago

When adding lottie-android to a Wear OS 3 project in Android Studio it compiles well but adding any lottie elements to the view such as the basics examples in the documentation http://airbnb.io/lottie/#/android?id=from-xml results in the error: Cannot resolve class com.airbnb.lottie.LottieAnimationView WearOS appears to be a paired down Android with tweaks, developed in Android Studio using Android files and APIs.

To Reproduce

I haven't been able to find any documentation on the web for using lottie on the new codebase of WearOS3 ( or earlier versions). Google has been using WebP as an animation option on WearOS 3.

gpeal commented 1 year ago

The issue is that LottieAnimationView extends AppCompatImageView which isn't added as a dependency in wearOS by default. Add implementation 'androidx.appcompat:appcompat:1.5.1' (or whatever the latest version is) and it'll work.

CleanShot 2022-11-25 at 18 16 14@2x