【问题标题】:Xamarin Forms LottieXamarin 形成 Lottie
【发布时间】:2021-04-18 04:43:06
【问题描述】:

您好,我正在尝试使用 Lottie for Xamarin 运行 xamarin 表单,但它崩溃了。我已经安装了 Forms 包和 Droid 包,但出现以下错误:

Unhandled Exception:

Java.Lang.ClassNotFoundException: Didn't find class "md58995ca22a59cb7d445dac899fcf4189b.AnimationViewRenderer" on path: DexPathList[[zip file "/mnt/asec/com.GIC.AthkarApps-1/base.apk"],nativeLibraryDirectories=[/mnt/asec/com.GIC.AthkarApps-1/lib/arm, /vendor/lib, /system/lib]]

另外,我在 MainActivity 类中添加了以下代码:

namespace EasyNETApp.Droid
{
    [Activity(Label = "EasyNETApp", Icon = "@drawable/icon", Theme = "@style/MainTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
    public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
    {
        protected override void OnCreate(Bundle bundle)
        {
            TabLayoutResource = Resource.Layout.Tabbar;
            ToolbarResource = Resource.Layout.Toolbar;

            base.OnCreate(bundle);

            global::Xamarin.Forms.Forms.Init(this, bundle);
            Lottie.Forms.Droid.AnimationViewRenderer.Init();//Reference for Lottie
            LoadApplication(new App());
        }
    }
}

我已将 .josn 文件作为资产:

【问题讨论】:

  • And you can refer to this,尝试清理、重建、重启、删除项目中的 bin/obj 并重建。
  • @JoeLv 非常感谢您的帮助,但我遵循了完全相同的步骤,但没有运气。我认为问题在于我使用的不是 PCL,而是新的 .NET Standard,所以我对此参考有警告。
  • 嗨,ClassNotFoundException这个异常可能不是你的错,也可能是编译器的错,你试过这个clean, rebuild, restart, delete the bin/obj in your project and rebuild吗?
  • 啊哈,祝你好运!

标签: android xamarin.forms lottie


【解决方案1】:

最好从头开始按照指南,看来你的错误与Lottie包无关。

以下是 Xamarin.Forms 的示例: https://xamarinhelp.com/lottie-animations-xamarin-forms/

这里是如何使用 Xamarin.iOS 和 Xamarin.Android 构建它: https://blog.xamarin.com/bring-stunning-animations-to-your-apps-with-lottie/

【讨论】:

    【解决方案2】:

    最新版本的 Lottie 文件中存在错误。尝试降级一些版本。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-11-16
      • 2014-07-24
      • 2020-11-14
      相关资源
      最近更新 更多