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

Android P Fresco initialize #2115

Closed
dbeqiraj opened this issue May 16, 2018 · 16 comments
Closed

Android P Fresco initialize #2115

dbeqiraj opened this issue May 16, 2018 · 16 comments
Labels

Comments

@dbeqiraj
Copy link

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)
@zmroczek
Copy link
Contributor

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?

@zmroczek zmroczek added the needs-details This issue or PR is currently not actionable as it misses details (e.g. for reproducing the problem) label May 21, 2018
@dbeqiraj
Copy link
Author

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.

@Vatreni
Copy link

Vatreni commented May 21, 2018

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)

@zmroczek
Copy link
Contributor

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.

@dbeqiraj
Copy link
Author

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

@Vatreni
Copy link

Vatreni commented May 21, 2018

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

@oprisnik oprisnik added bug and removed needs-details This issue or PR is currently not actionable as it misses details (e.g. for reproducing the problem) labels May 22, 2018
facebook-github-bot pushed a commit to facebook/SoLoader that referenced this issue May 23, 2018
Summary: The nativeLoad method doesn't have the third argument in Android P, so it's causing an error in calling it from SoLoader (github issue for fresco: facebook/fresco#2115) - this diff fixes it.

Reviewed By: erikandre

Differential Revision: D8098159

fbshipit-source-id: df430028cff5941465a0f91800db55d498765a6c
@Iamrookie
Copy link

Iamrookie commented Jun 5, 2018

He means on extends Application class init
他们的意思是
第一 初始化在继承Application的子类中
第二 使用的context 用application的context

@dementia2029
Copy link

dementia2029 commented Jun 8, 2018

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.

@zmroczek
Copy link
Contributor

zmroczek commented Jun 8, 2018

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.

@dementia2029
Copy link

dementia2029 commented Jun 8, 2018

@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.

@zmroczek
Copy link
Contributor

zmroczek commented Jun 8, 2018

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).

@zmroczek
Copy link
Contributor

We've updated the SoLoader version in 8e9243e, so the nativeLoad error shouldn't occur on Android P anymore.

@AlexSuvorov2k
Copy link

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)

@anilthummar
Copy link

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.

@liusgh
Copy link

liusgh commented Jan 24, 2019

@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?

@liusgh
Copy link

liusgh commented Jan 28, 2019

@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?

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

No branches or pull requests

9 participants