Aghajari / AXrLottie

AXrLottie (Android) Renders animations and vectors exported in the bodymovin JSON format. (Using rLottie)
Apache License 2.0
147 stars 26 forks source link

Crash when load lottie by url with extension ".json" #1

Closed chihung93 closed 3 years ago

chihung93 commented 3 years ago

My Code: link url = https://files-5.gapo.vn/sticker/origin/234f279b-1342-4b8a-8673-5fc11e3bfbba.json

binding.imgSticker.lottieDrawable = AXrLottieDrawable.fromURL(stickerUrl)
                .setSize(size,size)
                .setAutoRepeat(true)
                .setAutoStart(true)
                .build()

My error console: java.net.MalformedURLException: no protocol: lottie_cache_httpsfiles5gapovnstickerorigin6525deecc18545a58adea943441c0bd9json

Thanks.

chihung93 commented 3 years ago

I have tried your example but not work


public class SimpleActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_simple);

        final AXrLottieImageView lottieView = findViewById(R.id.lottie_view);

       lottieView.setLottieDrawable(
               AXrLottieDrawable.fromURL("https://files-5.gapo.vn/sticker/origin/234f279b-1342-4b8a-8673-5fc11e3bfbba.json").setSize(140,140).build()
       );
       lottieView.playAnimation();

    }
}
chihung93 commented 3 years ago

I think the problem is this.url = "lottie_cache_" + url.replaceAll("\\W+", "");

Aghajari commented 3 years ago

Hi @chihung93 , You're right, i have released v1.0.3 and fixed this issue.

implementation 'com.aghajari.rlottie:AXrLottie:1.0.3'

Your code works fine now :

chihung93 commented 3 years ago

@Aghajari I think the lib is getting the wrong cache from the URL. 2021-01-12 09 39 08

Aghajari commented 3 years ago

Fixed on v1.0.4