Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using Picasso without Okhttp/Okio #2192

Open
Alireza-Farahani opened this issue Dec 25, 2020 · 4 comments
Open

Using Picasso without Okhttp/Okio #2192

Alireza-Farahani opened this issue Dec 25, 2020 · 4 comments

Comments

@Alireza-Farahani
Copy link

Alireza-Farahani commented Dec 25, 2020

I'm working on an app with limitation of being offline (No internet permission in manifest) and small Apk size (2mb). I think Picasso should not be bound to online/remote images and it would be great if I can use Picasso for its caching and transformation pipeline and other features.

I tried to exclude Okhttp and Okio dependency from Picasso in Gradle, create a dummy Downloader and added Okio and Okhttp as compileOnly dependencies (Downloader is never used when using device resources), but it crashes in runtime on this lines from Utils.java class because ByteString belongs to Okio

private static final ByteString WEBP_FILE_HEADER_RIFF = ByteString.encodeUtf8("RIFF");
private static final ByteString WEBP_FILE_HEADER_WEBP = ByteString.encodeUtf8("WEBP");

Is it possible at all to use Picasso without Okio and Okhttp?

I know that you keep Github issues for bugs and feature request, but I thought this questions is too relevant to Picasso internals to be asked in Stackoverflow.

@JakeWharton
Copy link
Member

You can use it without OkHttp. Okio is required.

@Alireza-Farahani
Copy link
Author

Is my approach for excluding Okhttp OK or do you recommend anything else?

@TacoTheDank
Copy link

TacoTheDank commented Dec 26, 2020

@JakeWharton What do you think about separating classes that use OkHttp into their own module? (Something like picasso-okhttp). Would that be possible?

@Alireza-Farahani Alireza-Farahani changed the title Using Picasso in an without Okhttp/Okio Using Picasso without Okhttp/Okio Dec 28, 2020
@JakeWharton
Copy link
Member

We can certainly consider making it easier to exclude OkHttp long-term (assuming Picasso will ever see another release), but it would likely always be an opt-out thing rather than requiring the overwhelming majority of users to opt-in to OkHttp.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants