question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Fix Fresco 2.1 Java-only version?

See original GitHub issue

I want to use java-only version in my project. We can find some instruction on Version 2.1.0 release note. I hava added Java-Fresco Gradle setup:

implementation('com.facebook.fresco:fresco:2.1.0') {
    exclude group: 'com.facebook.soloader', module: 'soloader'
    exclude group: 'com.facebook.fresco', module: 'soloader'
    exclude group: 'com.facebook.fresco', module: 'nativeimagefilters'
    exclude group: 'com.facebook.fresco', module: 'nativeimagetranscoder'
    exclude group: 'com.facebook.fresco', module: 'memory-type-native'
    exclude group: 'com.facebook.fresco', module: 'imagepipeline-native'
}

And changed freco init code.

        ImagePipelineConfig.Builder builder = createFrescoConfig();
        builder.experiment().setNativeCodeDisabled(true);
        Fresco.initialize(getApplicationContext(), builder.build(),null,false);

But we still got some problem.Fresco still trying load so files. So which is the right way to use java-only version? Can we get some wiki about this? Can we exclude so files when use java-only version?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:18 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
HenryPirotcommented, May 14, 2020

I also tried to use Fresco 2.1.0 or 2.2.0 Java only version but I am getting crashes for devices using API 19.

The error says

java.lang.RuntimeException: Unable to create application com.example.xyz.MyApplication: java.lang.RuntimeException: Wrong Native code setup, reflection failed.

I am initializing fresco using

Fresco.initialize( applicationContext, ImagePipelineConfig.newBuilder(applicationContext) .setMemoryChunkType(MemoryChunkType.BUFFER_MEMORY) .setImageTranscoderType(ImageTranscoderType.JAVA_TRANSCODER) .experiment().setNativeCodeDisabled(true) .build())

Is there any solution?

As we metioned before,fresco will trying to load so file when devices using API 19. You can use ImagePipelineConfig.setPoolFactory to fix this.

Fresco.initialize(applicationContext, ImagePipelineConfig.newBuilder(applicationContext) .setMemoryChunkType(MemoryChunkType.BUFFER_MEMORY) .setImageTranscoderType(ImageTranscoderType.JAVA_TRANSCODER)
.setPoolFactory(new CustomPoolFactory(PoolConfig.newBuilder().build(), MemoryChunkType.BUFFER_MEMORY));
 .experiment().setNativeCodeDisabled(true) .build())
class CustomPoolFactory(config: PoolConfig, @MemoryChunkType val chunkType: Int) : PoolFactory(config) {
//override this method to get a BUFFER_MEMORY pool.
override fun getPooledByteBufferFactory(): PooledByteBufferFactory {
    return getPooledByteBufferFactory(chunkType)
}
}
1reaction
HenryPirotcommented, Feb 11, 2020

Thanks for your help. It works now.

Read more comments on GitHub >

github_iconTop Results From Across the Web

com.facebook.fresco:imagepipeline-base-test: Versions
Fresco 2.1.0 comes with tons of improvements, including a Java-only Fresco version. ... Version 1.8.1 is a bug-fix release following the main 1.8.0...
Read more >
Docs›Getting Started - Fresco
This Guide will walk you through the steps needed to start using Fresco in your ... Starting with Fresco version 2.1.0, you can...
Read more >
Gradle build not working for React Native project after ...
After doing this, I somehow managed to update the Android Gradle Plugin Version to 4.1.3 and Gradle Version to 6.9 under File >...
Read more >
Execution failed for task ':app:checkDebugAarMetadata' - Reddit
[Fatal Error] sqlite-framework-2.1.0.pom:2:1: Content is not allowed in ... project :app > com.facebook.flipper:flipper-fresco-plugin:0.93.0 ...
Read more >
filter performance optimization (#9943) · Issues - wireshark - GitLab
This issue was migrated from bug 9943 in our old bug tracker. Original bug information: Reporter: Sloven Status: CONFIRMED...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found