Skip to content

NullPointerException when choosing account #2959

Closed as duplicate
Closed as duplicate

Description

@jvanmalder

This issue respects the following points:

Describe the bug

  1. Open the Notes app (after clearing storage and cache in the Android settings)
  2. Tap "Choose account"
  3. Select the account and tap "OK"
  4. Tap "Allow"
  5. A pop-up shows "Oh no - What now?" with a stacktrace

Expected behavior

After choosing an account and allowing access, I should see the main screen and should be able to list and create notes.

Notes Android version

4.5.2

Notes server version

4.12.4

Nextcloud Android version

3.34.1

Nextcloud version

32.0.0

Device

Fairphone 5 5G

Android Version

15

App Store

  • Google Play Store
  • F-Droid
  • Huawei App Gallery

Stacktrace

App Version: 4.5.2
App Version Code: 40050290
App Flavor: fdroid

Files App Version Code: 30340190 (PROD)

---

OS Version: 5.4.274-qgki-g67a8c76d3b27(VT2F)
OS API Level: 35
Device: FP5
Manufacturer: Fairphone
Model (and Product): FP5 (FP5)

---

java.lang.NullPointerException: Attempt to invoke virtual method 'int com.google.gson.JsonPrimitive.getAsInt()' on a null object reference
	at it.niedermann.owncloud.notes.persistence.sync.CapabilitiesDeserializer.deserialize(CapabilitiesDeserializer.java:85)
	at it.niedermann.owncloud.notes.persistence.sync.CapabilitiesDeserializer.deserialize(CapabilitiesDeserializer.java:32)
	at com.google.gson.internal.bind.TreeTypeAdapter.read(TreeTypeAdapter.java:95)
	at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$2.readIntoField(ReflectiveTypeAdapterFactory.java:271)
	at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$FieldReflectionAdapter.readField(ReflectiveTypeAdapterFactory.java:559)
	at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:517)
	at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$2.readIntoField(ReflectiveTypeAdapterFactory.java:271)
	at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$FieldReflectionAdapter.readField(ReflectiveTypeAdapterFactory.java:559)
	at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:517)
	at com.google.gson.Gson.fromJson(Gson.java:1358)
	at com.google.gson.Gson.fromJson(Gson.java:1259)
	at com.google.gson.Gson.fromJson(Gson.java:1227)
	at com.nextcloud.android.sso.api.NextcloudAPI.convertStreamToTargetEntity(NextcloudAPI.java:136)
	at com.nextcloud.android.sso.api.NextcloudAPI.lambda$performRequestObservableV2$0(NextcloudAPI.java:98)
	at com.nextcloud.android.sso.api.NextcloudAPI.$r8$lambda$af7W9mq2B0ZrhVJwZd-ibFp8T3Y(Unknown Source:0)
	at com.nextcloud.android.sso.api.NextcloudAPI$$ExternalSyntheticLambda1.subscribe(D8$$SyntheticClass:0)
	at io.reactivex.internal.operators.observable.ObservableFromPublisher.subscribeActual(ObservableFromPublisher.java:31)
	at io.reactivex.Observable.subscribe(Observable.java:12284)
	at io.reactivex.internal.operators.observable.ObservableSingleMaybe.subscribeActual(ObservableSingleMaybe.java:31)
	at io.reactivex.Maybe.subscribe(Maybe.java:4290)
	at io.reactivex.Maybe.blockingGet(Maybe.java:2320)
	at io.reactivex.Observable.blockingSingle(Observable.java:5381)
	at it.niedermann.owncloud.notes.persistence.CapabilitiesClient.getCapabilities(CapabilitiesClient.java:38)
	at it.niedermann.owncloud.notes.importaccount.ImportAccountActivity.lambda$onActivityResult$5(ImportAccountActivity.java:103)
	at it.niedermann.owncloud.notes.importaccount.ImportAccountActivity.$r8$lambda$wIJzzcgrzM9d6k7exwdLMn3GvgQ(Unknown Source:0)
	at it.niedermann.owncloud.notes.importaccount.ImportAccountActivity$$ExternalSyntheticLambda4.run(D8$$SyntheticClass:0)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:520)
	at java.util.concurrent.FutureTask.run(FutureTask.java:317)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1154)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:652)
	at java.lang.Thread.run(Thread.java:1563)

Activity

  1. jvanmalder commented on Dec 16, 2025

    @jvanmalder
    Author

    I saw in #855 a request to curl the capabilities API and since CapabilitiesDeserializer is mentioned in the stacktrace, I tried it:

    curl 'http://redacted.com/ocs/v2.php/cloud/capabilities?format=json' -H 'OCS-APIRequest: true'

    {
        "ocs": {
            "meta": {
                "status": "ok",
                "statuscode": 200,
                "message": "OK"
            },
            "data": {
                "version": {
                    "major": 32,
                    "minor": 0,
                    "micro": 0,
                    "string": "32.0.0",
                    "edition": "",
                    "extendedSupport": false
                },
                "capabilities": {
                    "core": {
                        "pollinterval": 60,
                        "webdav-root": "remote.php/webdav",
                        "reference-api": true,
                        "reference-regex": "(\\s|\\n|^)(https?:\\/\\/)([-A-Z0-9+_.]+(?::[0-9]+)?(?:\\/[-A-Z0-9+&@#%?=~_|!:,.;()]*)*)(\\s|\\n|$)",
                        "mod-rewrite-working": true,
                        "user": {
                            "language": "en",
                            "locale": "",
                            "timezone": "Europe/Brussels"
                        }
                    },
                    "bruteforce": {
                        "delay": 0,
                        "allow-listed": false
                    },
                    "files": {
                        "$comment": "\"blacklisted_files\" is deprecated as of Nextcloud 30, use \"forbidden_filenames\" instead",
                        "blacklisted_files": [
                            ".htaccess"
                        ],
                        "forbidden_filenames": [
                            ".htaccess"
                        ],
                        "forbidden_filename_basenames": [],
                        "forbidden_filename_characters": [
                            "\\",
                            "/"
                        ],
                        "forbidden_filename_extensions": [
                            ".filepart",
                            ".part"
                        ],
                        "bigfilechunking": true,
                        "chunked_upload": {
                            "max_size": 104857600,
                            "max_parallel_count": 5
                        },
                        "file_conversions": [],
                        "windows_compatible_filenames": false,
                        "directEditing": {
                            "url": "http://redacted.com/ocs/v2.php/apps/files/api/v1/directEditing",
                            "etag": "5b2f367cfe076ab42b79601036409c2e",
                            "supportsFileId": true
                        },
                        "comments": true,
                        "undelete": true,
                        "delete_from_trash": true,
                        "versioning": true,
                        "version_labeling": true,
                        "version_deletion": true
                    },
                    "activity": {
                        "apiv2": [
                            "filters",
                            "filters-api",
                            "previews",
                            "rich-strings"
                        ]
                    },
                    "app_api": {
                        "loglevel": 2,
                        "version": "32.0.0"
                    },
                    "circles": {
                        "version": "32.0.0",
                        "status": {
                            "globalScale": false
                        },
                        "settings": {
                            "frontendEnabled": true,
                            "allowedCircles": 262143,
                            "allowedUserTypes": 31,
                            "membersLimit": -1
                        },
                        "circle": {
                            "constants": {
                                "flags": {
                                    "1": "Single",
                                    "2": "Personal",
                                    "4": "System",
                                    "8": "Visible",
                                    "16": "Open",
                                    "32": "Invite",
                                    "64": "Join request",
                                    "128": "Friends",
                                    "256": "Password protected",
                                    "512": "No Owner",
                                    "1024": "Hidden",
                                    "2048": "Backend",
                                    "4096": "Local",
                                    "8192": "Root",
                                    "16384": "Team invite",
                                    "32768": "Federated",
                                    "65536": "Mount point"
                                },
                                "source": {
                                    "core": {
                                        "1": "Nextcloud Account",
                                        "2": "Nextcloud Group",
                                        "4": "Email address",
                                        "8": "Contact",
                                        "16": "Circle",
                                        "10000": "Nextcloud App"
                                    },
                                    "extra": {
                                        "10001": "Circles App",
                                        "10002": "Admin Command Line"
                                    }
                                }
                            },
                            "config": {
                                "coreFlags": [
                                    1,
                                    2,
                                    4
                                ],
                                "systemFlags": [
                                    512,
                                    1024,
                                    2048
                                ]
                            }
                        },
                        "member": {
                            "constants": {
                                "level": {
                                    "1": "Member",
                                    "4": "Moderator",
                                    "8": "Admin",
                                    "9": "Owner"
                                }
                            },
                            "type": {
                                "0": "single",
                                "1": "user",
                                "2": "group",
                                "4": "mail",
                                "8": "contact",
                                "16": "circle",
                                "10000": "app"
                            }
                        },
                        "teamResourceProviders": [
                            "files"
                        ]
                    },
                    "ocm": {
                        "enabled": true,
                        "apiVersion": "1.0-proposal1",
                        "version": "1.1.0",
                        "endPoint": "http://redacted.com/ocm",
                        "publicKey": null,
                        "resourceTypes": [
                            {
                                "name": "file",
                                "shareTypes": [
                                    "user",
                                    "group"
                                ],
                                "protocols": {
                                    "webdav": "/public.php/webdav/"
                                }
                            }
                        ],
                        "capabilities": [
                            "/invite-accepted",
                            "/notifications",
                            "/shares"
                        ]
                    },
                    "dav": {
                        "chunking": "1.0",
                        "public_shares_chunking": true,
                        "bulkupload": "1.0",
                        "absence-supported": true,
                        "absence-replacement": true
                    },
                    "downloadlimit": {
                        "enabled": true,
                        "default-limit": -1
                    },
                    "files_sharing": {
                        "api_enabled": false,
                        "public": {
                            "enabled": false
                        },
                        "user": {
                            "send_mail": false
                        },
                        "resharing": false,
                        "federation": {
                            "outgoing": false,
                            "incoming": false,
                            "expire_date": {
                                "enabled": true
                            },
                            "expire_date_supported": {
                                "enabled": true
                            }
                        },
                        "sharee": {
                            "query_lookup_default": false,
                            "always_show_unique": true
                        },
                        "sharebymail": {
                            "enabled": false,
                            "send_password_by_mail": false,
                            "upload_files_drop": {
                                "enabled": true
                            },
                            "password": {
                                "enabled": true,
                                "enforced": false
                            },
                            "expire_date": {
                                "enabled": true,
                                "enforced": false
                            }
                        }
                    },
                    "notes": {
                        "api_version": [
                            "0.2",
                            "1.3",
                            "1.4"
                        ],
                        "version": "4.12.4",
                        "notes_path": "Notes"
                    },
                    "notifications": {
                        "ocs-endpoints": [
                            "list",
                            "get",
                            "delete",
                            "delete-all",
                            "icons",
                            "rich-strings",
                            "action-web",
                            "user-status",
                            "exists",
                            "test-push"
                        ],
                        "push": [
                            "devices",
                            "object-data",
                            "delete"
                        ],
                        "admin-notifications": [
                            "ocs",
                            "cli"
                        ]
                    },
                    "password_policy": {
                        "api": {
                            "generate": "http://redacted.com/ocs/v2.php/apps/password_policy/api/v1/generate",
                            "validate": "http://redacted.com/ocs/v2.php/apps/password_policy/api/v1/validate"
                        },
                        "policies": {
                            "account": {
                                "minLength": 10,
                                "enforceHaveIBeenPwned": true,
                                "enforceNonCommonPassword": true,
                                "enforceNumericCharacters": false,
                                "enforceSpecialCharacters": false,
                                "enforceUpperLowerCase": false
                            }
                        },
                        "minLength": 10,
                        "enforceNonCommonPassword": true,
                        "enforceNumericCharacters": false,
                        "enforceSpecialCharacters": false,
                        "enforceUpperLowerCase": false
                    },
                    "provisioning_api": {
                        "version": "1.22.0",
                        "AccountPropertyScopesVersion": 2,
                        "AccountPropertyScopesFederatedEnabled": true,
                        "AccountPropertyScopesPublishedEnabled": false
                    },
                    "recommendations": {
                        "enabled": true
                    },
                    "systemtags": {
                        "enabled": true
                    },
                    "theming": {
                        "name": "Nextcloud",
                        "productName": "Nextcloud",
                        "url": "https://nextcloud.com",
                        "slogan": "a safe home for all your data",
                        "color": "#00679e",
                        "color-text": "#ffffff",
                        "color-element": "#00679e",
                        "color-element-bright": "#00679e",
                        "color-element-dark": "#00679e",
                        "logo": "http://redacted.com/core/img/logo/logo.svg?v=0",
                        "background": "http://redacted.com/apps/theming/img/background/jo-myoung-hee-fluid.webp",
                        "background-text": "#ffffff",
                        "background-plain": false,
                        "background-default": true,
                        "logoheader": "http://redacted.com/core/img/logo/logo.svg?v=0",
                        "favicon": "http://redacted.com/core/img/logo/logo.svg?v=0"
                    },
                    "user_status": {
                        "enabled": true,
                        "restore": true,
                        "supports_emoji": true,
                        "supports_busy": true
                    },
                    "weather_status": {
                        "enabled": true
                    }
                }
            }
        }
    }
    

    I redacted the server hostname and port with "http://redacted.com". Hopefully this is helpful.

  2. jvanmalder commented on Dec 16, 2025

    @jvanmalder
    Author

    I fixed it by enabling the Share API (toggle "Allow apps to use the Share API" on at http://your-nextcloud.com/settings/admin/sharing).
    Found the solution in #2815 so I'll close this as a duplicate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions