This is what worked for me:
In your build.gradle (project) write mavenCentral() in the buildscript{} and allprojects {}. It should look like this:
buildscript {
repositories {
jcenter()
**mavenCentral()**
}
//more code ...
}
allprojects {
repositories {
jcenter()
**mavenCentral()**
}
}
Then, in build.gradle(module) add in dependencies{} this snippet:
compile 'pl.droidsonroids.gif:android-gif-drawable:1.2.4'
it should look like this:
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.0'
testCompile 'junit:junit:4.12'
**compile 'pl.droidsonroids.gif:android-gif-drawable:1.2.4'**
}
Put your .gif image in your drawable folder. Now go to app > res > layout > activity_main.xml and add this snipped for your .gif:
<pl.droidsonroids.gif.GifImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/YOUR_GIF_IMAGE"
android:background="#000000" //for black background
/>
And you're done :)
Helpful links: https://github.com/koral--/android-gif-drawable
https://www.youtube.com/watch?v=EOFY0cwNjuk
Hope this helps.