Etar-Group / Etar-Calendar

Android open source calendar
https://f-droid.org/packages/ws.xsoh.etar/
GNU General Public License v3.0
2.05k stars 393 forks source link

NullPointerException on Android 9 #845

Closed freshprince closed 3 years ago

freshprince commented 3 years ago

When launching Etar i get the following stack trace:

01-27 19:04:56.993 17039 17039 D AndroidRuntime: Shutting down VM
01-27 19:04:56.993 17039 17039 E AndroidRuntime: FATAL EXCEPTION: main
01-27 19:04:56.993 17039 17039 E AndroidRuntime: Process: ws.xsoh.etar, PID: 17039
01-27 19:04:56.993 17039 17039 E AndroidRuntime: java.lang.RuntimeException: Unable to start activity ComponentInfo{ws.xsoh.etar/com.android.calendar.AllInOneActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.TextView.setVisibility(int)' on a null object reference
01-27 19:04:56.993 17039 17039 E AndroidRuntime:    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2944)
01-27 19:04:56.993 17039 17039 E AndroidRuntime:    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3079)
01-27 19:04:56.993 17039 17039 E AndroidRuntime:    at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
01-27 19:04:56.993 17039 17039 E AndroidRuntime:    at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
01-27 19:04:56.993 17039 17039 E AndroidRuntime:    at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
01-27 19:04:56.993 17039 17039 E AndroidRuntime:    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1836)
01-27 19:04:56.993 17039 17039 E AndroidRuntime:    at android.os.Handler.dispatchMessage(Handler.java:106)
01-27 19:04:56.993 17039 17039 E AndroidRuntime:    at android.os.Looper.loop(Looper.java:193)
01-27 19:04:56.993 17039 17039 E AndroidRuntime:    at android.app.ActivityThread.main(ActivityThread.java:6703)
01-27 19:04:56.993 17039 17039 E AndroidRuntime:    at java.lang.reflect.Method.invoke(Native Method)
01-27 19:04:56.993 17039 17039 E AndroidRuntime:    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
01-27 19:04:56.993 17039 17039 E AndroidRuntime:    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:911)
01-27 19:04:56.993 17039 17039 E AndroidRuntime: Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.TextView.setVisibility(int)' on a null object reference
01-27 19:04:56.993 17039 17039 E AndroidRuntime:    at com.android.calendar.AllInOneActivity.setMainPane(AllInOneActivity.java:1085)
01-27 19:04:56.993 17039 17039 E AndroidRuntime:    at com.android.calendar.AllInOneActivity.initFragments(AllInOneActivity.java:762)
01-27 19:04:56.993 17039 17039 E AndroidRuntime:    at com.android.calendar.AllInOneActivity.onCreate(AllInOneActivity.java:375)
01-27 19:04:56.993 17039 17039 E AndroidRuntime:    at android.app.Activity.performCreate(Activity.java:7136)
01-27 19:04:56.993 17039 17039 E AndroidRuntime:    at android.app.Activity.performCreate(Activity.java:7127)
01-27 19:04:56.993 17039 17039 E AndroidRuntime:    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1271)
01-27 19:04:56.993 17039 17039 E AndroidRuntime:    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2924)
01-27 19:04:56.993 17039 17039 E AndroidRuntime:    ... 11 more
01-27 19:04:56.995   840  1789 W ActivityManager:   Force finishing activity ws.xsoh.etar/com.android.calendar.AllInOneActivity

Widget is working fine.

I have version 1.0.25 installed from F-Droid.

Gitsaibot commented 3 years ago

On which device does this happen? If it happens to be a tablet then the aspect ratio and resolution would be interesting.

freshprince commented 3 years ago

This happens on a Planet Cosmo Communicator:

Logical Displays: size=1
  Display 0:
    mDisplayId=0
    mLayerStack=0
    mHasContent=true
    mRequestedMode=0
    mRequestedColorMode=0
    mDisplayOffset=(0, 0)
    mPrimaryDisplayDevice=Built-in Screen
    mBaseDisplayInfo=DisplayInfo{"Built-in Screen", uniqueId "local:0", app 2160 x 1080, real 2160 x 1080, largest app 2160 x 1080, smallest app 2160 x 1080, mode 1, defaultMode 1, modes [{id=1, width=2160, height=1080, fps=64.25}], colorMode 0, supportedColorModes [0], hdrCapabilities android.view.Display$HdrCapabilities@40f16308, rotation 0, density 480 (403.411 x 403.411) dpi, layerStack 0, appVsyncOff 8300000, presDeadline 8264202, type BUILT_IN, state ON, FLAG_SECURE, FLAG_SUPPORTS_PROTECTED_BUFFERS, removeMode 0}
    mOverrideDisplayInfo=DisplayInfo{"Built-in Screen", uniqueId "local:0", app 2072 x 1080, real 2160 x 1080, largest app 2072 x 2028, smallest app 1080 x 1036, mode 1, defaultMode 1, modes [{id=1, width=2160, height=1080, fps=64.25}], colorMode 0, supportedColorModes [0], hdrCapabilities android.view.Display$HdrCapabilities@40f16308, rotation 0, density 292 (403.411 x 403.411) dpi, layerStack 0, appVsyncOff 8300000, presDeadline 8264202, type BUILT_IN, state ON, FLAG_SECURE, FLAG_SUPPORTS_PROTECTED_BUFFERS, removeMode 0}

If I set pixel density to the physical value of 480 dpi the crash does not happen.

I didn't realize this is because of resolution/dpi. My workaround now is to have pixel density set to 360 dpi.

Gitsaibot commented 3 years ago

It would be nice if you could try this debug version to see if the crash persists. Etar-Calendar-debug.zip

freshprince commented 3 years ago

Sure. This version does no longer crash when I have set my density to 292.