Issue
I have simple layout with ImageView
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/activity_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.vbusovikov.glidetest.MainActivity">
<ImageView
android:id="@+id/image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
/>
</RelativeLayout>
And simple Glide expression to load an image to this ImageView just to test Glide
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ImageView imageView = (ImageView)findViewById(R.id.image);
Glide.with(this)
.load("http://you-ps.ru/uploads/posts/2013-08/1376601606_1273.png")
.error(R.mipmap.ic_launcher)
.into(imageView);
}
However, error icon is shown. What kind of problem it can be? I have proxy server on my network, and appropriate gradle.properties for that case.
systemProp.http.proxyHost=proxy******.ru
systemProp.http.proxyPort=****
But even if i try to launch this little app outside of any proxies, it won't work for some reason.
My build.gradle file
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.example.vbusovikov.glidetest"
minSdkVersion 15
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.1.1'
compile 'com.github.bumptech.glide:glide:3.7.0'
testCompile 'junit:junit:4.12'
}
UPD. This simple app can load pictures from internet, but it cannot load pictures from my server. Some pictures of my server are being loaded fine, but others are not. I'm lost with this already
Solution
Unfortunately, all answers were right, but they did not work in my condition. Server settings were not suitable for downloading pictures from it.
==UPDATE==
After a while, I figured out that the pictures on my server were broken. You can check if your picture at provided URL is valid by opening this URL in Mozilla Firefox. The last few kilobytes in pictures may be deleted, but browsers like Google Chrome ignores that and shows image normally. However, Firefox is more sensitive, so it helps to localize the problem.
==UPDATE2==
After another while, I figured out that not only broken pictures can cause the problem. Try add android:usesCleartextTraffic="true"
in Manifest in application. It will solve some issues with picture loading.
Answered By - TrueCH
Answer Checked By - Mary Flores (JavaFixing Volunteer)