Search code examples
androidandroid-fileandroid-assets

asset path doesn't work with "/android_asset/" path


I am trying to use this library, like this:

        val imageUrl = "file:///android_asset/error_apng.png"
        val animator = ApngAnimator(this@MainActivity).loadInto(iv_circle)
        animator.load(imageUrl)
        animator.play()

But it shows nothing. However, the sample url with https://works fine.

I tried with the followings:

file://android_asset/error_apng

file:///android_asset/apng/error_apng

asset://error_apng.pn

assets://error_apng.png

assets://error_apng.png

The README.md says I can use url or file path. What's wrong with it?


Solution

  • The library doesn't seem perfect. Try using this library instead: https://github.com/penfeizhou/APNG4Android