@WorkerThread
  public static LottieResult<LottieComposition> fromRawResSync(Context context, @RawRes int rawRes, @Nullable String cacheKey) {
    final LottieComposition cachedComposition = cacheKey == null ? null : LottieCompositionCache.getInstance().get(cacheKey);
    if (cachedComposition != null) {
      return new LottieResult<>(cachedComposition);
    }
    try {
      BufferedSource source = Okio.buffer(source(context.getResources().openRawResource(rawRes)));
      if (isZipCompressed(source)) {
        return fromZipStreamSync(context, new ZipInputStream(source.inputStream()), cacheKey);
      } else if (isGzipCompressed(source)) {
        try {
          return fromJsonInputStreamSync(new GZIPInputStream(source.inputStream()), cacheKey);
        } catch (IOException e) {
          // This shouldn't happen because we check the header for magic bytes.
          return new LottieResult<>(e);
        }
      }
      return fromJsonReaderSync(JsonReader.of(source), cacheKey);
    } catch (Resources.NotFoundException e) {
      return new LottieResult<>(e);
    }
  }
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