public static LottieTask<LottieComposition> fromRawRes(Context context, @RawRes final int rawRes, @Nullable final String cacheKey) {
    // Prevent accidentally leaking an Activity.
    final WeakReference<Context> contextRef = new WeakReference<>(context);
    final Context appContext = context.getApplicationContext();
    return cache(cacheKey, () -> {
      @Nullable Context originalContext = contextRef.get();
      Context context1 = originalContext != null ? originalContext : appContext;
      return fromRawResSync(context1, rawRes, cacheKey);
    }, null);
  }
Parse an animation from raw/res. This is recommended over putting your animation in assets because
it uses a hard reference to R.
The resource id will be used as a cache key so future usages won't parse the json again.
Note: to correctly load dark mode (-night) resources, make sure you pass Activity as a context (instead of e.g. the application context).
The Activity won't be leaked.
<p>
Pass null as the cache key to skip caching.
lottie/src/main/java/com/airbnb/lottie/LottieCompositionFactory.java