Home > Enterprise >  android library glide is not working. only this form of url
android library glide is not working. only this form of url

Time:10-05

I want to set this url photo "http://file.koreafilm.or.kr/thm/02/00/01/66/tn_DPF002814.JPG" in my app with glide library.

   Glide.with(context).
                load(movieImageArray.get(position)).error(R.drawable.gray_profile)
                .fallback(R.drawable.profile)
                .into(holder.imageMovieResult);

I wanna set this url photo into image view from Recycler view adapter. Other url is working in this code but only this form of url is not working. (I get url form other API. I can't change url form) please help me!!!

CodePudding user response:

For image url with http you have to add in you manifest file

<application android:usesCleartextTraffic="true" ...

</application>

CodePudding user response:

You need to allow traffic from unsecure host, First of all create a file network_security_config.xml under res/xml directory

<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
    <domain-config cleartextTrafficPermitted="true">
        <domain includeSubdomains="true">file.koreafilm.or.kr</domain>
    </domain-config>
</network-security-config>

Where file.koreafilm.or.kr is the domain name you whant to allow in unsecure mode (not https)

Then in AndroidManifest.xml

<application
    android:allowBackup="true"
    android:icon="@drawable/app_icon"
    android:label="@string/app_name"
    android:networkSecurityConfig="@xml/network_security_config"

The most important part here is this line android:networkSecurityConfig="@xml/network_security_config"

CodePudding user response:

For those URLs which are started by HTTP instead of HTTPS, you have to add the following statement in the application tag at the manifest file of your application.

android:usesCleartextTraffic="true" 
  • Related