How to Open a PAG File on Android (and Online)
Open a .pag file in your browser in seconds, or play it inside an Android app with libpag and a PAGView — plus when to pick PAG over SVGA for gift animations.
SVGA Store team4 min read

A PAG file (.pag) is an animation exported from Adobe After Effects with Tencent's PAG exporter and played by libpag, the PAG runtime for Android, iOS, the web and desktop. Live and social apps use PAG for gifts, frames and banners because one compact file can hold vector shapes, images, text layers and After Effects effects. This guide shows how to open a PAG file on Android — in the browser in a few seconds, or inside your own app with libpag — and when PAG is a better pick than SVGA.
The quick way: open a PAG file in your browser
You don't need to install anything to look at a .pag file. The free PAG viewer plays it in any modern browser, including Chrome on Android:
Open svgastore.com/viewer/ on your phone or computer.
Tap Choose files and pick the .pag file from your downloads (or drag it onto the page on a computer).
It plays straight away with libpag — the same engine apps use — and shows the canvas size, frame rate and duration read from the file.
The viewer opens .svga and VAP .mp4 files too, so you can compare formats side by side.
Play a PAG file in an Android app with libpag
To show a PAG animation inside your app, add libpag and put the file in a PAGView.
1. Add the libpag dependency
libpag is published on Maven Central. In your app module's build.gradle:
dependencies {
// check github.com/Tencent/libpag/releases for the latest version
implementation 'com.tencent.tav:libpag:4.2.41'
}libpag supports Android 5.0 (API level 21) and above.
2. Keep libpag's classes in release builds
If you shrink your release build, add these rules to proguard-rules.pro:
-keep class org.libpag.** {*;}
-keep class androidx.exifinterface.** {*;}3. Put the file in your assets
Copy the animation to app/src/main/assets/, for example app/src/main/assets/gift.pag.
4. Show it in a PAGView
You can declare the view in a layout:
<org.libpag.PAGView
android:id="@+id/pag_view"
android:layout_width="300dp"
android:layout_height="300dp" />Then load the file and play it (Kotlin):
import org.libpag.PAGFile
import org.libpag.PAGView
val pagView = findViewById<PAGView>(R.id.pag_view)
val pagFile = PAGFile.Load(assets, "gift.pag")
pagView.setComposition(pagFile)
pagView.setRepeatCount(1) // play once — 0 (or any negative value) loops forever
pagView.play()PAGView can also load a file by path in one call: pagView.setPath("assets://gift.pag"). A path to a downloaded file works the same way, and PAGFile.Load(bytes) reads a file you already hold in memory — handy when you cache gifts yourself.
5. Pause it and free memory
A gift that has finished, or a frame that has scrolled off screen, doesn't need to keep running:
pagView.pause() // stop drawing; play() resumes from here
pagView.freeCache() // release the view's caches when you're done with itTo react when a one-shot gift ends — to hide the view or start the next gift in a queue — register a listener with pagView.addListener(…); it reports when an animation starts, repeats, ends or is cancelled.
Check a PAG file before you ship it
The numbers that matter are the same as for any gift animation:
Canvas. Tall canvases (750×1334, 750×1624) are full-screen gifts; squares suit avatars and seats; wide strips are banners.
Duration and frame rate. Long, high-frame-rate effects cost more to render on budget phones.
File size. A PAG file is usually compact, but embedded images make it grow — check the size before you bundle it.
Open the file in the viewer and compare those numbers with the slot it is going into. If it plays there but not in your app, check your libpag version: a file exported with a newer exporter may use features an old runtime doesn't know.
When to pick PAG over SVGA
Both formats are common for live-app gifts, and many stores — this one included — sell both.
Pick PAG when your designers work in After Effects and use effects, text layers or masks that are hard to rebuild by hand, or when you want to change text inside the animation at run time.
Pick SVGA when the gift ecosystem you plug into already expects .svga, when you need the player on Flutter or another platform where SVGA support is simpler, or when your animations are mostly moving bitmap pieces — where SVGA files are small and very fast to play. See What is an SVGA file? for how it works.
Pick VAP for video-like effects — dense particles, real footage, 3D renders — where an MP4 with alpha is smaller than either.
For a side-by-side of all four formats, read SVGA vs Lottie vs VAP vs PAG for gift animations.
Ready-made PAG animations
SVGA Store has 700+ PAG animations among its 4,500+ files: VIP animations, avatar frames, broadcast banners and more, each playable on its page before you buy. Browse all animations and filter by format to see only PAG.


