错误
java.lang.NoSuchMethodError:没有虚拟方法 getBaseContext()Landroid / content / Context;在班上 Lcom / facebook / litho / ComponentContext;或其超一流 (“ com.facebook.litho.ComponentContext”的声明出现在 /data/app/com.midhilaj.myapplication-1/split_lib_dependencies_apk.apk)
我的代码
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
final ComponentContext context = new ComponentContext(this);
Component component2 =GlideImage.create(context)
.imageUrl("https://d2b41ce3jhhjt0.cloudfront.net/uploads/social/posts/medium/c57365ec934af9814503ae2de8d252e9.jpg")
// .aspectRatio(aspectRatio)
.centerCrop(true)
.build();
setContentView(LithoView.create(context, component2));
Rejecting re-init on previously-failed class java.lang.Class<com.github.charbgr.litho.picasso.PicassoImage$PicassoImageImpl>: java.lang.LinkageError: Method java.lang.String com.github.charbgr.litho.picasso.PicassoImage$PicassoImageImpl.getSimpleName() overrides final method in class Lcom/facebook/litho/Component; (declaration of 'com.github.charbgr.litho.picasso.PicassoImage$PicassoImageImpl' appears in /data/app/com.midhilaj.myapplication-Aet8ZQAr7vjva0PZdq2jhg==/split_lib_dependencies_apk.apk)
2019-02-06 17:04:05.996 12850-12850/com.midhilaj.myapplication I/zygote64: at com.github.charbgr.litho.picasso.PicassoImage$Builder com.github.charbgr.litho.picasso.PicassoImage.create(com.facebook.litho.ComponentContext) (PicassoImage.java:170)
2019-02-06 17:04:05.996 12850-12850/com.midhilaj.myapplication I/zygote64: at void com.midhilaj.myapplication.MainActivity.onCreate(android.os.Bundle) (MainActivity.java:45)
2019-02-06 17:04:05.996 12850-12850/com.midhilaj.myapplication I/zygote64: at void android.app.Activity.performCreate(android.os.Bundle) (Activity.java:6984)
2019-02-06 17:04:05.996 12850-12850/com.midhilaj.myapplication I/zygote64: at void android.app.Instrumentation.callActivityOnCreate(android.app.Activity, android.os.Bundle) (Instrumentation.java:1235)
2019-02-06 17:04:05.996 12850-12850/com.midhilaj.myapplication I/zygote64: at android.app.Activity android.app.ActivityThread.performLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent) (ActivityThread.java:2857)
2019-02-06 17:04:05.996 12850-12850/com.midhilaj.myapplication I/zygote64: at void android.app.ActivityThread.handleLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent, java.lang.String) (ActivityThread.java:2986)
2019-02-06 17:04:05.996 12850-12850/com.midhilaj.myapplication I/zygote64: at void android.app.ActivityThread.-wrap11(android.app.ActivityThread, android.app.ActivityThread$ActivityClientRecord, android.content.Intent, java.lang.String) (ActivityThread.java:-1)
2019-02-06 17:04:05.996 12850-12850/com.midhilaj.myapplication I/zygote64: at void android.app.ActivityThread$H.handleMessage(android.os.Message) (ActivityThread.java:1671)
2019-02-06 17:04:05.996 12850-12850/com.midhilaj.myapplication I/zygote64: at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:108)
2019-02-06 17:04:05.996 12850-12850/com.midhilaj.myapplication I/zygote64: at void android.os.Looper.loop() (Looper.java:206)
2019-02-06 17:04:05.996 12850-12850/com.midhilaj.myapplication I/zygote64: at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:6784)
2019-02-06 17:04:05.996 12850-12850/com.midhilaj.myapplication I/zygote64: at java.lang.Object java.lang.reflect.Method.invoke(java.lang.Object, java.lang.Object[]) (Method.java:-2)
2019-02-06 17:04:05.997 12850-12850/com.midhilaj.myapplication I/zygote64: at void com.android.internal.os.Zygote$MethodAndArgsCaller.run() (Zygote.java:240)
2019-02-06 17:04:05.997 12850-12850/com.midhilaj.myapplication I/zygote64: at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:852)
2019-02-06 17:04:05.997 12850-12850/com.midhilaj.myapplication D/AndroidRuntime: Shutting down VM
2019-02-06 17:04:06.000 12850-12850/com.midhilaj.myapplication E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.midhilaj.myapplication, PID: 12850
java.lang.LinkageError: Method java.lang.String com.github.charbgr.litho.picasso.PicassoImage$PicassoImageImpl.getSimpleName() overrides final method in class Lcom/facebook/litho/Component; (declaration of 'com.github.charbgr.litho.picasso.PicassoImage$PicassoImageImpl' appears in /data/app/com.midhilaj.myapplication-Aet8ZQAr7vjva0PZdq2jhg==/split_lib_dependencies_apk.apk)
at com.github.charbgr.litho.picasso.PicassoImage.create(PicassoImage.java:170)
at com.midhilaj.myapplication.MainActivity.onCreate(MainActivity.java:45)
at android.app.Activity.performCreate(Activity.java:6984)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1235)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2857)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2986)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1671)
at android.os.Handler.dispatchMessage(Handler.java:108)
at android.os.Looper.loop(Looper.java:206)
at android.app.ActivityThread.main(ActivityThread.java:6784)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:852)
现在我正在尝试毕加索
java.lang.LinkageError:方法java.lang.String com.github.charbgr.litho.picasso.PicassoImage $ PicassoImageImpl.getSimpleName() 覆盖类Lcom / facebook / litho / Component中的final方法; (声明 'com.github.charbgr.litho.picasso.PicassoImage $ PicassoImageImpl' 出现在 /data/app/com.midhilaj.myapplication-zt-xfqQ6-UlHEkWlTDfqyg==/split_lib_dependencies_apk.apk) 在com.github.charbgr.litho.picasso.PicassoImage.create(PicassoImage.java:170) 在com.midhilaj.myapplication.MainActivity.onCreate(MainActivity.java:44) 在android.app.Activity.performCreate(Activity.java:6984) 在android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1235) 在android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2857) 在android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2986) 在android.app.ActivityThread.-wrap11(未知来源:0) 在android.app.ActivityThread $ H.handleMessage(ActivityThread.java:1671) 在android.os.Handler.dispatchMessage(Handler.java:108) 在android.os.Looper.loop(Looper.java:206) 在android.app.ActivityThread.main(ActivityThread.java:6784) 在java.lang.reflect.Method.invoke(本机方法) 在com.android.internal.os.Zygote $ MethodAndArgsCaller.run(Zygote.java:240) 在com.android.internal.os.ZygoteInit.main(ZygoteInit.java:852)
答案 0 :(得分:0)
com.github.charbgr.litho.picasso.PicassoImage
和GlideImage
都不是Litho框架的一部分。您可能应该尝试更新提供这些类的库。或者,如果尚未对其进行更新以使其与新版本的Litho一起使用,请撤回使用那些库仍与之兼容的旧版本的框架。虽然,对我来说,后者似乎是个坏主意