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

Was Fresco 3.0.0 intentionally released? #2714

Closed
darrentaft opened this issue Mar 20, 2023 · 17 comments
Closed

Was Fresco 3.0.0 intentionally released? #2714

darrentaft opened this issue Mar 20, 2023 · 17 comments

Comments

@darrentaft
Copy link

darrentaft commented Mar 20, 2023

Before I go reporting bugs for numerous issues with Fresco 3.0.0, I just wanted to confirm that it wasn't an accidental release. Could someone please confirm? It seems to have too many issues for it to be intentional.

@oprisnik
Copy link
Contributor

oprisnik commented Mar 20, 2023

Hey! Thanks for reaching out. What issues are you seeing? We did make several changes to our release pipeline. We did intend to release a new Fresco version.

@darrentaft
Copy link
Author

The issues found so far are around customisations to default behaviour to override cache control and request headers. The code is many years old now, so there may be better ways of doing this?

The first is this method, which is now marked final so we cannot override:

    /**
     * The default [OkHttpNetworkFetcher] injects a ‘Cache-Control: no-store’ header in the
     * requests, preventing the response cache to work for images loaded via Fresco. This is
     * done because Fresco has its own disk cache which, unfortunately, ignores the response
     * cache headers.
     *
     * We decided to disable that disk cache and rely on the http one, so we need to remove the
     * ‘no-store` header from the request
     **/
    @Override
    protected void fetchWithRequest(OkHttpNetworkFetchState fetchState, Callback callback,
                                    Request request) {
        super.fetchWithRequest(fetchState, callback,
                request.newBuilder().cacheControl(new CacheControl.Builder().build()).build());
    }

Next up, is adding custom headers to images. We've overridden the fetch method as follows:

   @Override
    public void fetch(OkHttpNetworkFetchState fetchState, NetworkFetcher.Callback callback) {
        fetchState.submitTime = SystemClock.elapsedRealtime();
        final Uri uri = fetchState.getUri();

        try {
            final Request.Builder requestBuilder = new Request.Builder()
                    .cacheControl(new CacheControl.Builder().noStore().build())
                    .url(uri.toString()).get();

            final BytesRange bytesRange =
                    fetchState.getContext().getImageRequest().getBytesRange();
            if (bytesRange != null) {
                requestBuilder.addHeader("Range", bytesRange.toHttpRangeHeaderValue());
            }

            Headers.Builder headersBuilder = new Headers.Builder();

            if (fetchState.getContext().getImageRequest() instanceof HeaderedImageRequest) {
                HeaderedImageRequest headeredImageRequest =
                        (HeaderedImageRequest) fetchState.getContext().getImageRequest();
                String[][] headers = headeredImageRequest.getHeaders();
                if (headers != null) {
                    for (String[] header : headers) {
                        headersBuilder.add(header[0], header[1]);
                    }
                }
            }

            requestBuilder.headers(headersBuilder.build());

            fetchWithRequest(fetchState, callback, requestBuilder.build());
        } catch (Exception e) {
            // handle error while creating the request
            callback.onFailure(e);
        }
    }

The issue in this case is with the call to fetchState.getContext() because it returns a ProducerContext class, which extends HasExtraData - but that class cannot be found. It appears to be in a com.facebook.fresco.middleware package that can't be found.

Finally, even if I disable all our customisations, the app compiles OK but then crashes on use because libnative-imagetranscoder.so is missing.

I'm using:

implementation 'com.facebook.fresco:fresco:3.0.0'
implementation 'com.facebook.fresco:imagepipeline-okhttp3:3.0.0'

Thanks

@oprisnik
Copy link
Contributor

Sorry for that!

Related to middleware: Can you try if adding com.facebook.fresco:middleware:3.0.0 fixes your issues?

https://repo1.maven.org/maven2/com/facebook/fresco/middleware/3.0.0/

@darrentaft
Copy link
Author

That fixes the HasExtraData class, but the native library is still missing (and fetchWithRequest is still final, obviously).

I don't want to push you guys to fix it if it wasn't ready. I genuinely expected you to say 3.0.0 was released by accident. I'm happy to wait for the final release. The real reason I'm keen to update, is to see if it has fixed a distortion issue I'm seeing with 2.6.0.

Take this URL: https://images-live.youview.tv/images/entity/77502239/ident/1_256x144.png?overlaygradient=0

When rendered in the app with fresco:actualImageScaleType="fitCenter" is displays this (see the stripes either side):

image

When rendered using centerInside, it works fine (but isn't the correct size). This happens with all our channel logos.

@oprisnik
Copy link
Contributor

oprisnik commented Mar 21, 2023

Hey!

  • We're going to change fetchWithRequest shortly so that it can be overridden again.
  • Regarding the distortion, yes as you've mentioned that should be fixed with the new version (Rounded Corners Distort Images #2541)
  • I cannot reproduce the missing native lib on my end unfortunately. I've created a new Gradle sample app and added:

Gradle deps:

    implementation 'com.facebook.fresco:fresco:3.0.0'
    implementation 'com.facebook.fresco:imagepipeline-okhttp3:3.0.0'

Init logic:

Fresco.initialize(requireContext(), OkHttpImagePipelineConfigFactory.newBuilder(requireContext(), OkHttpClient()).build())

XML layout:

    <com.facebook.drawee.view.SimpleDraweeView
        android:id="@+id/drawee"
        android:layout_width="100dp"
        android:layout_height="100dp" />

Loading image:

binding.drawee.setImageURI("https://images-live.youview.tv/images/entity/77502239/ident/1_256x144.png?overlaygradient=0")

Your channel log seems to render fine and I don't see any crash.

Can you try and also add implementation 'com.facebook.fresco:nativeimagetranscoder3:3.0.0' to your Gradle file? That's what should include the missing native lib

@Hunteryoo
Copy link

java.lang.UnsatisfiedLinkError: dlopen failed: library "libnative-imagetranscoder.so" not found
at java.lang.Runtime.loadLibrary0(Runtime.java:1087)
at java.lang.Runtime.loadLibrary0(Runtime.java:1008)
at java.lang.System.loadLibrary(System.java:1664)
at com.facebook.soloader.nativeloader.SystemDelegate.loadLibrary(SystemDelegate.java:24)
at com.facebook.soloader.nativeloader.NativeLoader.loadLibrary(NativeLoader.java:52)
at com.facebook.soloader.nativeloader.NativeLoader.loadLibrary(NativeLoader.java:30)
at com.facebook.imagepipeline.nativecode.NativeJpegTranscoderSoLoader.ensure(NativeJpegTranscoderSoLoader.java:33)
at com.facebook.imagepipeline.nativecode.NativeJpegTranscoder.(NativeJpegTranscoder.java:59)
at com.facebook.imagepipeline.nativecode.NativeJpegTranscoderFactory.createImageTranscoder(NativeJpegTranscoderFactory.java:43)
at com.facebook.imagepipeline.transcoder.MultiImageTranscoderFactory.getNativeImageTranscoder(MultiImageTranscoderFactory.kt:59)
at com.facebook.imagepipeline.transcoder.MultiImageTranscoderFactory.createImageTranscoder(MultiImageTranscoderFactory.kt:40)
at com.facebook.imagepipeline.producers.ResizeAndRotateProducer$TransformingConsumer.onNewResultImpl(ResizeAndRotateProducer.java:166)
at com.facebook.imagepipeline.producers.ResizeAndRotateProducer$TransformingConsumer.onNewResultImpl(ResizeAndRotateProducer.java:84)
at com.facebook.imagepipeline.producers.BaseConsumer.onNewResult(BaseConsumer.java:89)
at com.facebook.imagepipeline.producers.AddImageTransformMetaDataProducer$AddImageTransformMetaDataConsumer.onNewResultImpl(AddImageTransformMetaDataProducer.java:49)
at com.facebook.imagepipeline.producers.AddImageTransformMetaDataProducer$AddImageTransformMetaDataConsumer.onNewResultImpl(AddImageTransformMetaDataProducer.java:33)
at com.facebook.imagepipeline.producers.BaseConsumer.onNewResult(BaseConsumer.java:89)
at com.facebook.imagepipeline.producers.MultiplexProducer$Multiplexer.onNextResult(MultiplexProducer.java:510)
at com.facebook.imagepipeline.producers.MultiplexProducer$Multiplexer$ForwardingConsumer.onNewResultImpl(MultiplexProducer.java:569)
at com.facebook.imagepipeline.producers.MultiplexProducer$Multiplexer$ForwardingConsumer.onNewResultImpl(MultiplexProducer.java:562)
at com.facebook.imagepipeline.producers.BaseConsumer.onNewResult(BaseConsumer.java:89)
at com.facebook.imagepipeline.producers.EncodedMemoryCacheProducer$EncodedMemoryCacheConsumer.onNewResultImpl(EncodedMemoryCacheProducer.java:181)
at com.facebook.imagepipeline.producers.EncodedMemoryCacheProducer$EncodedMemoryCacheConsumer.onNewResultImpl(EncodedMemoryCacheProducer.java:123)
at com.facebook.imagepipeline.producers.BaseConsumer.onNewResult(BaseConsumer.java:89)
at com.facebook.imagepipeline.producers.DiskCacheReadProducer$1.then(DiskCacheReadProducer.java:113)
at com.facebook.imagepipeline.producers.DiskCacheReadProducer$1.then(DiskCacheReadProducer.java:93)
at bolts.Task$14.run(Task.java:872)
at bolts.BoltsExecutors$ImmediateExecutor.execute(BoltsExecutors.java:105)
at bolts.Task.completeImmediately(Task.java:863)
at bolts.Task.access$000(Task.java:32)
at bolts.Task$10.then(Task.java:654)
at bolts.Task$10.then(Task.java:651)
at bolts.Task.runContinuations(Task.java:956)
at bolts.Task.trySetResult(Task.java:994)
at bolts.TaskCompletionSource.trySetResult(TaskCompletionSource.java:39)
at bolts.TaskCompletionSource.setResult(TaskCompletionSource.java:62)
at bolts.Task$4.run(Task.java:357)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)

@peng093
Copy link

peng093 commented Mar 30, 2023

Version 3.0.0 crashes directly ,2.6.0 is ok

@meixililu
Copy link

2.6.0 to 3.0.0:
E/AndroidRuntime: FATAL EXCEPTION: FrescoLightWeightBackgroundExecutor-1
Process: com.messi.languagehelper, PID: 18877
java.lang.UnsatisfiedLinkError: dlopen failed: library "libnative-imagetranscoder.so" not found
at java.lang.Runtime.loadLibrary0(Runtime.java:1087)
at java.lang.Runtime.loadLibrary0(Runtime.java:1008)
at java.lang.System.loadLibrary(System.java:1664)
at com.facebook.soloader.nativeloader.SystemDelegate.loadLibrary(SystemDelegate.java:24)
at com.facebook.soloader.nativeloader.NativeLoader.loadLibrary(NativeLoader.java:52)
at com.facebook.soloader.nativeloader.NativeLoader.loadLibrary(NativeLoader.java:30)

@plhjd
Copy link

plhjd commented Apr 1, 2023

implementation 'com.facebook.fresco:fresco:3.0.0'
implementation 'com.facebook.fresco:nativeimagetranscoder:3.0.0'

compileSdkVersion 33
buildToolsVersion "33.0.2"

Android 12 Emulator crash

E/AndroidRuntime: FATAL EXCEPTION: FrescoIoBoundExecutor-1
java.lang.UnsatisfiedLinkError: dlopen failed: library "libnative-imagetranscoder.so" not found
at java.lang.Runtime.loadLibrary0(Runtime.java:1077)
at java.lang.Runtime.loadLibrary0(Runtime.java:998)
at java.lang.System.loadLibrary(System.java:1656)
at com.facebook.soloader.nativeloader.SystemDelegate.loadLibrary(SystemDelegate.java:24)
at com.facebook.soloader.nativeloader.NativeLoader.loadLibrary(NativeLoader.java:52)
at com.facebook.soloader.nativeloader.NativeLoader.loadLibrary(NativeLoader.java:30)
at com.facebook.imagepipeline.nativecode.NativeJpegTranscoderSoLoader.ensure(NativeJpegTranscoderSoLoader.java:33)
at com.facebook.imagepipeline.nativecode.NativeJpegTranscoder.(NativeJpegTranscoder.java:59)
at com.facebook.imagepipeline.nativecode.NativeJpegTranscoderFactory.createImageTranscoder(NativeJpegTranscoderFactory.java:43)
at com.facebook.imagepipeline.transcoder.MultiImageTranscoderFactory.getNativeImageTranscoder(MultiImageTranscoderFactory.kt:59)
at com.facebook.imagepipeline.transcoder.MultiImageTranscoderFactory.createImageTranscoder(MultiImageTranscoderFactory.kt:40)
at com.facebook.imagepipeline.producers.ResizeAndRotateProducer$TransformingConsumer.onNewResultImpl(ResizeAndRotateProducer.java:166)
at com.facebook.imagepipeline.producers.ResizeAndRotateProducer$TransformingConsumer.onNewResultImpl(ResizeAndRotateProducer.java:84)
at com.facebook.imagepipeline.producers.BaseConsumer.onNewResult(BaseConsumer.java:89)
at com.facebook.imagepipeline.producers.AddImageTransformMetaDataProducer$AddImageTransformMetaDataConsumer.onNewResultImpl(AddImageTransformMetaDataProducer.java:49)
at com.facebook.imagepipeline.producers.AddImageTransformMetaDataProducer$AddImageTransformMetaDataConsumer.onNewResultImpl(AddImageTransformMetaDataProducer.java:33)
at com.facebook.imagepipeline.producers.BaseConsumer.onNewResult(BaseConsumer.java:89)
at com.facebook.imagepipeline.producers.MultiplexProducer$Multiplexer.onNextResult(MultiplexProducer.java:510)
at com.facebook.imagepipeline.producers.MultiplexProducer$Multiplexer$ForwardingConsumer.onNewResultImpl(MultiplexProducer.java:569)
at com.facebook.imagepipeline.producers.MultiplexProducer$Multiplexer$ForwardingConsumer.onNewResultImpl(MultiplexProducer.java:562)
at com.facebook.imagepipeline.producers.BaseConsumer.onNewResult(BaseConsumer.java:89)
at com.facebook.imagepipeline.producers.EncodedMemoryCacheProducer$EncodedMemoryCacheConsumer.onNewResultImpl(EncodedMemoryCacheProducer.java:181)
at com.facebook.imagepipeline.producers.EncodedMemoryCacheProducer$EncodedMemoryCacheConsumer.onNewResultImpl(EncodedMemoryCacheProducer.java:123)
at com.facebook.imagepipeline.producers.BaseConsumer.onNewResult(BaseConsumer.java:89)
at com.facebook.imagepipeline.producers.StatefulProducerRunnable.onSuccess(StatefulProducerRunnable.java:50)
at com.facebook.common.executors.StatefulRunnable.run(StatefulRunnable.java:55)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at com.facebook.imagepipeline.core.PriorityThreadFactory.newThread$lambda$0(PriorityThreadFactory.kt:37)
at com.facebook.imagepipeline.core.PriorityThreadFactory.$r8$lambda$IPp7Vm9a1KDy8D4770JTjI9qOG4(Unknown Source:0)

@oprisnik
Copy link
Contributor

Can you please try adding the following Gradle dependency to your build:

com.facebook.fresco:nativeimagetranscoder3:3.0.0

That should fix the crash.

@plhjd
Copy link

plhjd commented Apr 11, 2023

Hi @oprisnik, thanks for the answer, I can't find com.facebook.fresco:nativeimagetranscoder3:3.0.0 in the repositories, I tried to add com.facebook.fresco:nativeimagetranscoder:3.0.0 which doesn't contain the '3' at the end of the name, but that still with "libnative-imagetranscoder.so" not found error message.

@AS0820075980
Copy link

AS0820075980 commented Apr 11, 2023 via email

@AS0820075980
Copy link

AS0820075980 commented Apr 11, 2023 via email

@MALTF
Copy link

MALTF commented Apr 23, 2023

Can you please try adding the following Gradle dependency to your build:

implementation('com.facebook.fresco:nativeimagetranscoder') {
       version {
           strictly '2.6.0'
       }
}

It can be used!! Simply put, this will force the use of dependencies in version 2.6.0

implementation("com.facebook.fresco:nativeimagetranscoder:2.6.0!!")

This is a strongly dependent version constraint, and the official now recommends using it.That should fix the crash.

@initialjie
Copy link

Can you please try adding the following Gradle dependency to your build:

com.facebook.fresco:nativeimagetranscoder:2.6.0

That should fix the crash.

Nope, this is not working, but this works, see #2722 (comment)

@MALTF
Copy link

MALTF commented May 30, 2023

Can you please try adding the following Gradle dependency to your build:

com.facebook.fresco:nativeimagetranscoder:2.6.0

That should fix the crash.

Nope, this is not working, but this works, see #2722 (comment)

see 2714#issuecomment

@darrentaft
Copy link
Author

I'm not sure what's happened to this project - too many seemingly accidental public releases, always with no release notes, and sometimes deleted shortly after.
I've abandoned Fresco and moved to Coil.
There are already other issues open to cover the issues with it, so I'll close this question down.

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

9 participants