From ab1d7e2ab1b0a2790d010b814d4a6c63cea2aa9f Mon Sep 17 00:00:00 2001 From: Konrad Pozniak Date: Tue, 16 Mar 2021 21:14:04 +0100 Subject: [PATCH] remove okhttp dependency from runtime classpath to save appsize --- app/build.gradle | 6 +++++- .../kotlin/com/simplemobiletools/gallery/pro/App.kt | 12 ++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/app/build.gradle b/app/build.gradle index 6e8c346b6..39b6370a9 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -87,7 +87,11 @@ dependencies { implementation 'com.google.vr:sdk-videowidget:1.180.0' implementation 'org.apache.sanselan:sanselan:0.97-incubator' implementation 'info.androidhive:imagefilters:1.0.7' - implementation 'com.squareup.picasso:picasso:2.71828' + implementation('com.squareup.picasso:picasso:2.71828') { + exclude group: 'com.squareup.okhttp3', module: 'okhttp' + } + compileOnly 'com.squareup.okhttp3:okhttp:4.9.0' + implementation 'com.squareup.okio:okio:2.10.0' implementation 'com.caverock:androidsvg-aar:1.4' implementation 'com.github.tibbi:gestureviews:a8e8fa8d27' implementation 'com.github.tibbi:subsampling-scale-image-view:961f7b5f2d' diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/App.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/App.kt index 07e9a4097..62d2c3332 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/App.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/App.kt @@ -3,11 +3,23 @@ package com.simplemobiletools.gallery.pro import android.app.Application import com.github.ajalt.reprint.core.Reprint import com.simplemobiletools.commons.extensions.checkUseEnglish +import com.squareup.picasso.Downloader +import com.squareup.picasso.Picasso +import okhttp3.Response class App : Application() { override fun onCreate() { super.onCreate() checkUseEnglish() Reprint.initialize(this) + Picasso.setSingletonInstance(Picasso.Builder(this).downloader(object: Downloader { + override fun load(request: okhttp3.Request): Response { + return Response.Builder().build() + } + + override fun shutdown() { + + } + }).build()) } }