Fresco: Android P Fresco initialize

Created on 16 May 2018  路  16Comments  路  Source: facebook/fresco

Fresco version: 1.8.1

When I try to initialize it I get this error:

W/SoLoader: Cannot get nativeLoad method
            java.lang.NoSuchMethodException: nativeLoad [class java.lang.String, class java.lang.ClassLoader, class java.lang.String]
                at java.lang.Class.getMethod(Class.java:2068)
                at java.lang.Class.getDeclaredMethod(Class.java:2047)
                at com.facebook.soloader.SoLoader.getNativeLoadRuntimeMethod(SoLoader.java:281)
                at com.facebook.soloader.SoLoader.initSoLoader(SoLoader.java:233)
                at com.facebook.soloader.SoLoader.initImpl(SoLoader.java:141)
                at com.facebook.soloader.SoLoader.init(SoLoader.java:120)
                at com.facebook.soloader.SoLoader.init(SoLoader.java:104)
                at com.facebook.drawee.backends.pipeline.Fresco.initialize(Fresco.java:63)
                at com.facebook.drawee.backends.pipeline.Fresco.initialize(Fresco.java:46)
bug

Most helpful comment

We've updated the SoLoader version in https://github.com/facebook/fresco/commit/8e9243e94fc9f8117b09b1fb6c4594feda7411c8, so the nativeLoad error shouldn't occur on Android P anymore.

All 16 comments

Hi @dbeqiraj

Thanks for reporting this issue. Could you provide more details so that we can reproduce it? Which device are you using and which Android P version?

This is the code in my class@onCreate() which extends Application:

ImagePipelineConfig config = ImagePipelineConfig.newBuilder(this)
                .setDownsampleEnabled(true)
                .build();
Fresco.initialize(this, config); // This throws the exception

This happens in the emulator which runs Android API P x86. I have not tested it in a real device.

Same issue on the Google Pixel (real device) with P(beta) Android. Fresco version 1.9.0. Initialization the same as above
java.lang.NoSuchMethodException: nativeLoad [class java.lang.String, class java.lang.ClassLoader, class java.lang.String] at java.lang.Class.getMethod(Class.java:2068) at java.lang.Class.getDeclaredMethod(Class.java:2047) at com.facebook.soloader.SoLoader.getNativeLoadRuntimeMethod(SoLoader.java:281) at com.facebook.soloader.SoLoader.initSoLoader(SoLoader.java:233) at com.facebook.soloader.SoLoader.initImpl(SoLoader.java:141) at com.facebook.soloader.SoLoader.init(SoLoader.java:120) at com.facebook.soloader.SoLoader.init(SoLoader.java:104) at com.facebook.drawee.backends.pipeline.Fresco.initialize(Fresco.java:61) at com.facebook.drawee.backends.pipeline.Fresco.initialize(Fresco.java:44)

I was able to reproduce it and it's an issue with SoLoader call which I'm going to fix, I'll keep you updated on that.

Just to double check, does this error cause any side effects for you @Vatreni and @dbeqiraj? It doesn't seem to cause any crash for me, I can only see the error in logs.

I use Fresco only to play a gif. This error doesn't look to affect that, looks fine.

I didn't notice any side effects, only this error message, I use Fresco for simple image loading

He means on extends Application class init
浠栦滑鐨勬剰鎬濇槸
绗竴 鍒濆鍖栧湪缁ф壙Application鐨勫瓙绫讳腑
绗簩 浣跨敤鐨刢ontext 鐢╝pplication鐨刢ontext

Same hear. I have Google Pixel gen1 with Android P. My project targets sdk28 and i use support libraries from AndroidX. This error crash my app.

I fixed this error in soLoader here, so we should have it in place after the next soLoader release.

The error will be gone only after Android P is officially released, since right now in beta there is still 27 returned for Build.VERSION.SDK_INT, which will be increased in the official release.

@zmroczek You are wrong. We have final API from yesterday and Android 9 beta 2 which returns Build.VERSION.SDK_INT = 28 and targetSdkVersion is unblocked to 28. Please, release new version as soon as possible.

Ok, thanks for updating @dementia2029 in that case the soLoader fix I mentioned should help with that with beta 2. We'll update the version after the next soLoader release (should happen next week at the latest).

We've updated the SoLoader version in https://github.com/facebook/fresco/commit/8e9243e94fc9f8117b09b1fb6c4594feda7411c8, so the nativeLoad error shouldn't occur on Android P anymore.

This problm also have emulator Nexus 5X API28
java.lang.NoSuchMethodException: nativeLoad [class java.lang.String, class java.lang.ClassLoader, class java.lang.String] at java.lang.Class.getMethod(Class.java:2068) at java.lang.Class.getDeclaredMethod(Class.java:2047) at com.facebook.soloader.SoLoader.getNativeLoadRuntimeMethod(SoLoader.java:281) at com.facebook.soloader.SoLoader.initSoLoader(SoLoader.java:233) at com.facebook.soloader.SoLoader.initImpl(SoLoader.java:141) at com.facebook.soloader.SoLoader.init(SoLoader.java:120) at com.facebook.soloader.SoLoader.init(SoLoader.java:104) at com.facebook.drawee.backends.pipeline.Fresco.initialize(Fresco.java:61) at com.facebook.drawee.backends.pipeline.Fresco.initialize(Fresco.java:37) at com.gootax.worker.App.onCreate(App.java:39)

This problm also have emulator Nexus 5X API28
java.lang.NoSuchMethodException: nativeLoad [class java.lang.String, class java.lang.ClassLoader, class java.lang.String] at java.lang.Class.getMethod(Class.java:2068) at java.lang.Class.getDeclaredMethod(Class.java:2047) at com.facebook.soloader.SoLoader.getNativeLoadRuntimeMethod(SoLoader.java:281) at com.facebook.soloader.SoLoader.initSoLoader(SoLoader.java:233) at com.facebook.soloader.SoLoader.initImpl(SoLoader.java:141) at com.facebook.soloader.SoLoader.init(SoLoader.java:120) at com.facebook.soloader.SoLoader.init(SoLoader.java:104) at com.facebook.drawee.backends.pipeline.Fresco.initialize(Fresco.java:61) at com.facebook.drawee.backends.pipeline.Fresco.initialize(Fresco.java:37) at com.gootax.worker.App.onCreate(App.java:39)

use below dependencies in your app gradle file :
implementation 'com.facebook.fresco:fresco:1.11.0' and its worked for me.

@zmroczek Under what circumstances do I need to update the version of this soLoader? We only used Fresco to load dynamic webp, and we haven't found any problems with this issue except for the warning message. So do we have to update the version of soLoader in Android P?

@zmroczek
In fact, we only rely on a submodule, animated-webp (1.9.0), rather than relying directly on the entire Fresco. Because we only use Fresco to load dynamic Webp. So this error stack will affect our current usage scenarios? Do we need to upgrade the dependency on animated-webp or so-loader?

Was this page helpful?
0 / 5 - 0 ratings