TheFinestArtist / FinestWebView-Android

Beautiful and customizable Android Activity that shows web pages within an app.
https://finestwebview.web.app
2.32k stars 531 forks source link

crashlytics reported bug #104

Open hishambakr opened 7 years ago

hishambakr commented 7 years ago

Many crashes on crashlytics:

Fatal Exception: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.tabe3.news/com.thefinestartist.finestwebview.FinestWebViewActivity}: java.lang.NullPointerException: Call Base.initialize(context) within your Application onCreate() method. at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3253) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3349) at android.app.ActivityThread.access$1100(ActivityThread.java:223) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1794) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:148) at android.app.ActivityThread.main(ActivityThread.java:7223) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120) Caused by java.lang.NullPointerException: Call Base.initialize(context) within your Application onCreate() method. at com.thefinestartist.Base.getContext(Base.java:30) at com.thefinestartist.utils.service.ServiceUtil.getSystemService(ServiceUtil.java:76) at com.thefinestartist.utils.service.ServiceUtil.getWindowManager(ServiceUtil.java:251) at com.thefinestartist.utils.service.WindowManagerUtil.getDefaultDisplay(WindowManagerUtil.java:19) at com.thefinestartist.utils.ui.DisplayUtil.getWidth(DisplayUtil.java:26) at com.thefinestartist.finestwebview.FinestWebViewActivity.getMaxWidth(FinestWebViewActivity.java:833) at com.thefinestartist.finestwebview.FinestWebViewActivity.layoutViews(FinestWebViewActivity.java:467) at com.thefinestartist.finestwebview.FinestWebViewActivity.onCreate(FinestWebViewActivity.java:889) at android.app.Activity.performCreate(Activity.java:6877) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1136) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3206) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3349) at android.app.ActivityThread.access$1100(ActivityThread.java:223) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1794) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:148) at android.app.ActivityThread.main(ActivityThread.java:7223) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)

wax911 commented 7 years ago

@hisham2007 I had a similar problem before and funny enough it wasn't related to the library but somewhere in my code, e.g. Fragments where I was try to call getContext I had not recognised that auto import imported the getContext Method within TheFinestWebview thus crashed and gave me the error "Call Base.initialize(context) within your Application onCreate() method" Not sure if this is what you're experiencing too

hishambakr commented 7 years ago

Many thanks. I actually called Base.initialize(context) seems that it fixed the issue