Lottie.Forms中不存在类型或名称空间“ Droid”

mpa*_*r78 3 xamarin.forms lottie-android lottie

我在Android和iOS上使用Xamarin.Forms。试图使Lottie动画起作用,但是支持.NET Standard 2.0的最新版本的Lottie(2.5.4)在Android项目中给出了构建错误:

The type or namespace name 'Droid' does not exist in the namespace 'Lottie.Forms' (are you missing an assembly reference?)

查看Lottie GitHub源代码显示了名称空间和类,因此我不确定为什么我的Android项目找不到引用。

我曾尝试将Lottie降级,但到目前为止还没有运气。包含参考(2.5.0)的最早版本不适用于.NET Standard。

有想法吗?

mpa*_*r78 6

原来是Xamarin.Forms Android项目的Target Framework版本存在问题。

最新版本的Visual Studio 2017使用Android 7.1目标框架创建新的Xamarin.Forms Android项目。

更改为Android 8.1后,解决了找不到Lottie.Forms.Droid命名空间的编译器问题。

Android项目设置

  • 就我而言,我必须从8.1更改为9.0,然后将Lottie nuget软件包更新为2.7.0 (2认同)