Last active
November 23, 2018 21:59
-
-
Save akaita/5101c22d311c9f79a43fd0c729b4808c to your computer and use it in GitHub Desktop.
Glide4 and Stetho integration - https://medium.com/@akaita/glide4-and-stetho-to-easily-debug-your-image-loading-system-c274d0d9966b
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:tools="http://schemas.android.com/tools"> | |
<application> | |
<meta-data android:name="com.bumptech.glide.integration.okhttp3.OkHttpGlideModule" tools:node="remove" /> | |
</application> | |
</manifest> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apply plugin: 'kotlin-kapt' | |
dependencies { | |
// Stetho | |
implementation 'com.facebook.stetho:stetho:1.5.0' | |
implementation 'com.facebook.stetho:stetho-okhttp3:1.5.0' | |
// Glide | |
implementation 'com.github.bumptech.glide:glide:4.8.0' | |
implementation 'com.github.bumptech.glide:okhttp3-integration:4.8.0' | |
kapt 'com.github.bumptech.glide:compiler:4.8.0' | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MyApplication : Application() { | |
override fun onCreate() { | |
super.onCreate() | |
Stetho.initializeWithDefaults(this) | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@GlideModule | |
class OkHttp3GlideModule : AppGlideModule() { | |
override fun registerComponents(context: Context, glide: Glide, registry: Registry) { | |
val client = OkHttpClient.Builder() | |
.addNetworkInterceptor(StethoInterceptor()) | |
.build() | |
registry.replace(GlideUrl::class.java, InputStream::class.java, OkHttpUrlLoader.Factory(client)) | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# GLIDE | |
-keep public class * implements com.bumptech.glide.module.GlideModule | |
-keep public class * extends com.bumptech.glide.module.AppGlideModule | |
-keep public enum com.bumptech.glide.load.ImageHeaderParser$** { | |
**[] $VALUES; | |
public *; | |
} | |
-keep class com.bumptech.glide.GeneratedAppGlideModuleImpl | |
# OKHTTP3 | |
-dontwarn javax.annotation.** | |
-keepnames class okhttp3.internal.publicsuffix.PublicSuffixDatabase | |
-dontwarn org.codehaus.mojo.animal_sniffer.* | |
-dontwarn okhttp3.internal.platform.ConscryptPlatform |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment