Skip to content

Android AAB builds fail to load bundled .lottie assets #37

@rgestudillo

Description

@rgestudillo

Bug Description

When building an Android App Bundle (AAB) for production, .lottie files bundled via Metro's require() fail to load. The animations work correctly in:

  • Development mode (Metro bundler)
  • Debug APK builds

But fail in:

  • Production AAB builds

Root Cause

The DotlottieReactNativeView.kt always uses DotLottieSource.Url(url) to load animations.

In development, Image.resolveAssetSource() returns an HTTP URL like http://10.0.2.2:8081/assets/..., which works.

In production AAB builds, React Native bundles assets differently and the resolved URI is either a resource identifier or file path, neither of which work with DotLottieSource.Url().

Proposed Fix

Modify DotlottieReactNativeView.kt to detect the source type and use the appropriate DotLottieSource (Url, Data, or load from resources).

I'm happy to submit a PR with this fix!

Environment

  • @lottiefiles/dotlottie-react-native: 0.7.1
  • React Native: 0.81.5
  • Android build type: AAB (app-bundle)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions