flutteranimationcompatibilityfile-formatrive

How to update Rive animation to version 7.0 in Flutter?


I'm facing an incompatibility issue when trying to run a Rive animation in my Flutter app. The error message is:

Unhandled Exception: File contains version 6.3. This runtime supports version 7.0 #0 new RuntimeHeader.read (package:rive/src/rive_core/runtime/runtime_header.dart:58:7) #1 new RiveFile.import (package:rive/src/rive_file.dart:252:45) #2 RiveFile.asset (package:rive/src/rive_file.dart:268:21)

Code:

I've included the relevant code snippets below:

main.dart

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: SimpleAnimation(),
    );
  }
}

animation.dart

import 'package:flutter/material.dart';
import 'package:rive/rive.dart';

void main() {
  runApp(MaterialApp(home: SimpleAnimation()));
}

class SimpleAnimation extends StatelessWidget {
  const SimpleAnimation({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return const Scaffold(
      backgroundColor: Colors.blueAccent,
      body: Center(
        child: RiveAnimation.asset('assets/clock.riv'),
      ),
    );
  }
}

pubspec.yaml:

dependencies:
  flutter:
    sdk: flutter
  rive: ^0.9.0

Explanation:

My Rive animation file seems to be using an older format (version 6.3) that's not compatible with the current Rive runtime in my Flutter project (version 7.0).

What I've Tried:

Question:

How can I update my Rive animation file to version 7.0 or otherwise make it work with my Flutter project? Are there tools available for this conversion?

Thank you!


Solution

  • that means your Rive files have an old version of Rive.

    You need to go to Rive editor and export your rive file using v7(new version of rive).

    Or upload your rive files to Rive editor and export them as new v7.

    Check this out:

    enter image description here