"IllegalStateException Must be called from main thread"


  • I cannot load the app at all…instead of the main screen, I’m met by the above error. Here is the error log:

    --- BEGIN DEBUG INFO ---
    
    EXCEPTION
    java.lang.IllegalStateException: Must be called from main thread
    	at android.app.Activity.recreate(Activity.java:5687)
    	at androidx.appcompat.app.AppCompatDelegateImpl.applyDayNight(AppCompatDelegateImpl.java:26)
    	at androidx.appcompat.app.AppCompatDelegateImpl.applyDayNight(AppCompatDelegateImpl.java:1)
    	at androidx.appcompat.app.AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.java:7)
    	at at.bitfire.davdroid.ui.UiUtils.setTheme(UiUtils.kt:3)
    	at at.bitfire.davdroid.App$onCreate$1.invoke(App.kt:2)
    	at at.bitfire.davdroid.App$onCreate$1.invoke(App.kt:1)
    	at kotlin.concurrent.ThreadsKt$thread$thread$1.run(Thread.kt:1)
    
    SOFTWARE INFORMATION
    
    ┌────────────────────────────────────┬────────────┬────────────┬─────────────────────────────────────┬───────┐
    │ Package                            │ Version    │ Code       │ Installer                           │ Notes │
    ├────────────────────────────────────┼────────────┼────────────┼─────────────────────────────────────┼───────┤
    │ at.bitfire.davdroid                │ 3.3.11-ose │ 303110004  │ com.google.android.packageinstaller │       │
    │ com.android.providers.contacts     │ 10.1.25    │ 1012503000 │ —                                   │       │
    │ com.android.providers.calendar     │ 10.0.00.13 │ 1000000013 │ —                                   │       │
    │ com.samsung.android.contacts       │ 10.2.30.10 │ 1023000010 │ —                                   │       │
    │ com.simplemobiletools.contacts.pro │ 6.15.0     │ 83         │ com.google.android.packageinstaller │       │
    │ com.samsung.android.calendar       │ 10.5.06.1  │ 1050600001 │ —                                   │       │
    │ com.simplemobiletools.calendar.pro │ 6.14.1     │ 202        │ com.google.android.packageinstaller │       │
    └────────────────────────────────────┴────────────┴────────────┴─────────────────────────────────────┴───────┘
    
    
    SYSTEM INFORMATION
    
    Android version: 9 (PPR1.180610.011.G950USQU8DUD3)
    Device: samsung SM-G950U (dreamqltesq)
    Locale(s): [en_US]
    
    
    CONNECTVITY
    
     ☒ wlan0
       - [ Transports: WIFI Capabilities: NOT_METERED INTERNET NOT_RESTRICTED TRUSTED NOT_VPN VALIDATED NOT_ROAMING FOREGROUND NOT_CONGESTED NOT_SUSPENDED Unwanted:  LinkUpBandwidth>=1048576Kbps LinkDnBandwidth>=1048576Kbps SignalStrength: -47]
       - DNS: 192.168.1.1
     ☐ rmnet_data1
       - [ Transports: CELLULAR Capabilities: IMS NOT_METERED TRUSTED NOT_VPN VALIDATED NOT_ROAMING FOREGROUND NOT_CONGESTED NOT_SUSPENDED Unwanted:  LinkUpBandwidth>=51200Kbps LinkDnBandwidth>=102400Kbps Specifier: <1>]
       - DNS: 
     ☐ ?
       - [ Transports: WIFI Capabilities: WIFI_P2P NOT_RESTRICTED TRUSTED NOT_VPN FOREGROUND NOT_SUSPENDED Unwanted:  LinkUpBandwidth>=1048576Kbps LinkDnBandwidth>=1048576Kbps]
       - DNS: 
    
    Data saver: disabled
    
    
    CONFIGURATION
    
    App standby bucket: 10
    Power saving disabled: no
    System-wide synchronization: automatically
    
    Notifications:
     - sync isBlocked=false
      * syncProblems: importance=3
      * syncIoErrors: importance=1
      * syncWarnings: importance=2
     - status: importance=2
     - general: importance=3
     - debug: importance=4
    
    Permissions:
     - ACCESS_NETWORK_STATE: granted
     - ACCESS_WIFI_STATE: granted
     - FOREGROUND_SERVICE: granted
     - INTERNET: granted
     - READ_SYNC_SETTINGS: granted
     - READ_SYNC_STATS: granted
     - WRITE_SYNC_SETTINGS: granted
     - RECEIVE_BOOT_COMPLETED: granted
     - REQUEST_IGNORE_BATTERY_OPTIMIZATIONS: granted
     - READ_CONTACTS: granted
     - WRITE_CONTACTS: granted
     - READ_CALENDAR: granted
     - WRITE_CALENDAR: granted
     - ACCESS_COARSE_LOCATION: denied
     - ACCESS_FINE_LOCATION: denied
     - ACCESS_BACKGROUND_LOCATION: denied
     - org.dmfs.permission.READ_TASKS: denied
     - org.dmfs.permission.WRITE_TASKS: denied
     - org.tasks.permission.READ_TASKS: denied
     - org.tasks.permission.WRITE_TASKS: denied
    
    
    ACCOUNTS
    
     - Account: ryan@ryspace.xyz
    
    ┌──────────────────────────────────┬──────────┬───────────┬──────────┬───────────────────────────────────┐
    │ Authority                        │ Syncable │ Auto-sync │ Interval │ Entries                           │
    ├──────────────────────────────────┼──────────┼───────────┼──────────┼───────────────────────────────────┤
    │ at.bitfire.davdroid.addressbooks │ 1        │ true      │ —        │ —                                 │
    │ com.android.calendar             │ 1        │ true      │ 240 min  │ 6 event(s)                        │
    │ org.dmfs.tasks                   │ 0        │ false     │ 1440 min │ —                                 │
    │ org.tasks.opentasks              │ 0        │ false     │ 1440 min │ —                                 │
    │ com.android.contacts             │ 0        │ false     │ —        │ 0 wrongly assigned raw contact(s) │
    └──────────────────────────────────┴──────────┴───────────┴──────────┴───────────────────────────────────┘
    
      WiFi only: false
      Contact group method: GROUP_VCARDS
      Time range (past days): 90
      Default alarm (min before): null
      Manage calendar colors: true
      Use event colors: false
    
      * Address book: Contacts (ryan@ryspace.xyz zA)
        
        ┌──────────────────────┬──────────┬───────────┬──────────┬───────────────────┐
        │ Authority            │ Syncable │ Auto-sync │ Interval │ Entries           │
        ├──────────────────────┼──────────┼───────────┼──────────┼───────────────────┤
        │ com.android.contacts │ 1        │ true      │ —        │ 15 raw contact(s) │
        └──────────────────────┴──────────┴───────────┴──────────┴───────────────────┘
        
        URL: https://nextcloud.ryspace.xyz/remote.php/dav/addressbooks/users/ryan/contacts/
        Read-only: 0
    
    
    DATABASE DUMP
    
    android_metadata
    
    ┌────────┐
    │ locale │
    ├────────┤
    │ en_US  │
    └────────┘
    
    service
    
    ┌────┬──────────────────┬─────────┬─────────────────────────────────────────────────────────────────────┐
    │ id │ accountName      │ type    │ principal                                                           │
    ├────┼──────────────────┼─────────┼─────────────────────────────────────────────────────────────────────┤
    │ 1  │ ryan@ryspace.xyz │ carddav │ https://nextcloud.ryspace.xyz/remote.php/dav/principals/users/ryan/ │
    │ 2  │ ryan@ryspace.xyz │ caldav  │ https://nextcloud.ryspace.xyz/remote.php/dav/principals/users/ryan/ │
    └────┴──────────────────┴─────────┴─────────────────────────────────────────────────────────────────────┘
    
    sqlite_sequence
    
    ┌────────────┬─────┐
    │ name       │ seq │
    ├────────────┼─────┤
    │ service    │ 2   │
    │ homeset    │ 2   │
    │ collection │ 4   │
    └────────────┴─────┘
    
    homeset
    
    ┌────┬───────────┬──────────┬───────────────────────────────────────────────────────────────────────┬──────────┬─────────────┐
    │ id │ serviceId │ personal │ url                                                                   │ privBind │ displayName │
    ├────┼───────────┼──────────┼───────────────────────────────────────────────────────────────────────┼──────────┼─────────────┤
    │ 1  │ 1         │ 1        │ https://nextcloud.ryspace.xyz/remote.php/dav/addressbooks/users/ryan/ │ 1        │ —           │
    │ 2  │ 2         │ 1        │ https://nextcloud.ryspace.xyz/remote.php/dav/calendars/ryan/          │ 1        │ —           │
    └────┴───────────┴──────────┴───────────────────────────────────────────────────────────────────────┴──────────┴─────────────┘
    
    collection
    
    ┌────┬───────────┬───────────┬──────────────┬────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┬──────────────────┬────────────┬───────────────┬────────────────────┬─────────────┬─────────────────────────────────────────────────────────────────────┬──────────┬──────────┬────────────────┬───────────────┬──────────────────┬────────┬──────┐
    │ id │ serviceId │ homeSetId │ type         │ url                                                                                                                │ privWriteContent │ privUnbind │ forceReadOnly │ displayName        │ description │ owner                                                               │ color    │ timezone │ supportsVEVENT │ supportsVTODO │ supportsVJOURNAL │ source │ sync │
    ├────┼───────────┼───────────┼──────────────┼────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼──────────────────┼────────────┼───────────────┼────────────────────┼─────────────┼─────────────────────────────────────────────────────────────────────┼──────────┼──────────┼────────────────┼───────────────┼──────────────────┼────────┼──────┤
    │ 1  │ 1         │ 1         │ ADDRESS_BOOK │ https://nextcloud.ryspace.xyz/remote.php/dav/addressbooks/users/ryan/contacts/                                     │ 1                │ 1          │ 0             │ Contacts           │ —           │ https://nextcloud.ryspace.xyz/remote.php/dav/principals/users/ryan/ │ —        │ —        │ —              │ —             │ —                │ —      │ 1    │
    │ 2  │ 1         │ 1         │ ADDRESS_BOOK │ https://nextcloud.ryspace.xyz/remote.php/dav/addressbooks/users/ryan/z-app-generated--contactsinteraction--recent/ │ 0                │ 0          │ 0             │ Recently contacted │ —           │ https://nextcloud.ryspace.xyz/remote.php/dav/principals/users/ryan/ │ —        │ —        │ —              │ —             │ —                │ —      │ 0    │
    │ 3  │ 2         │ 2         │ CALENDAR     │ https://nextcloud.ryspace.xyz/remote.php/dav/calendars/ryan/personal/                                              │ 1                │ 1          │ 0             │ Personal           │ —           │ https://nextcloud.ryspace.xyz/remote.php/dav/principals/users/ryan/ │ —        │ —        │ 1              │ 1             │ 0                │ —      │ 1    │
    │ 4  │ 2         │ 2         │ CALENDAR     │ https://nextcloud.ryspace.xyz/remote.php/dav/calendars/ryan/contact_birthdays/                                     │ 0                │ 0          │ 0             │ Contact birthdays  │ —           │ https://nextcloud.ryspace.xyz/remote.php/dav/principals/users/ryan/ │ -1451943 │ —        │ 1              │ 0             │ 0                │ —      │ 1    │
    └────┴───────────┴───────────┴──────────────┴────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┴──────────────────┴────────────┴───────────────┴────────────────────┴─────────────┴─────────────────────────────────────────────────────────────────────┴──────────┴──────────┴────────────────┴───────────────┴──────────────────┴────────┴──────┘
    
    room_master_table
    
    ┌────┬──────────────────────────────────┐
    │ id │ identity_hash                    │
    ├────┼──────────────────────────────────┤
    │ 42 │ b8699ef3cc4c62e8851df4360fb69e00 │
    └────┴──────────────────────────────────┘
    
    
    APP SETTINGS
    
    1. SharedPreferencesProvider canWrite=true
    
    ┌────────────────────────────┬───────────────┐
    │ Setting                    │ Value         │
    ├────────────────────────────┼───────────────┤
    │ distrust_system_certs      │ false         │
    │ foreground_service         │ false         │
    │ hint_OpenTasksNotInstalled │ false         │
    │ override_proxy             │ false         │
    │ override_proxy_host        │ localhost     │
    │ override_proxy_port        │ 8118          │
    │ preferred_theme            │ 2             │
    │ time_nextDonationPopup     │ 1634358462783 │
    └────────────────────────────┴───────────────┘
    
    2. DefaultsProvider canWrite=false
    
    ┌───────────────────────┬───────────┐
    │ Setting               │ Value     │
    ├───────────────────────┼───────────┤
    │ default_sync_interval │ 14400     │
    │ distrust_system_certs │ false     │
    │ override_proxy        │ false     │
    │ override_proxy_host   │ localhost │
    │ override_proxy_port   │ 8118      │
    └───────────────────────┴───────────┘
    
    --- END DEBUG INFO ---
    

    If there’s any information you need that’s not contained there, let me know. I do know that my nextcloud instance is up and running without issues.

  • developer

    @slidinghorn I think this is a problem of the AndroidX library. I guess it only happens when you change light/dark mode to a value that is not the system value?

    This should be worked around in 3.3.12 (at the cost of a higher starting time 😞 ).

    You can also reset the theme to the system default value as a workaround.


  • You can also reset the theme to the system default value as a workaround.

    I can’t even get to the settings to do this.

    Edit: Changing my phone to night mode allowed me to load properly…thanks for that hint