nextcloud / notes-android

✎ Android client for Nextcloud Notes app.
https://play.google.com/store/apps/details?id=it.niedermann.owncloud.notes
GNU General Public License v3.0
932 stars 135 forks source link

NoCurrentAccountSelectedException after switching account #1566

Closed petitminion closed 1 month ago

petitminion commented 2 years ago

I tried to switch account, now I'm stuck with this error.

Is there a way to recover my notes that didn't sync ?

Thxxxx

App Version: 3.5.00
App Version Code: 3005000
App Flavor: fdroid

Files App Version Code: 30200390

---

OS Version: 4.14.186-perf-gc17a8df7b768(V12.5.5.0.RKSEUXM)
OS API Level: 30
Device: camellian
Manufacturer: Xiaomi
Model (and Product): M2103K19G (camellian_eea)

---

com.nextcloud.android.sso.exceptions.NoCurrentAccountSelectedException: Todavía no hay ninguna cuenta seleccionada
    at com.nextcloud.android.sso.helper.SingleAccountHelper.getCurrentAccountName(SingleAccountHelper.java:47)
    at com.nextcloud.android.sso.helper.SingleAccountHelper.getCurrentSingleSignOnAccount(SingleAccountHelper.java:54)
    at it.niedermann.owncloud.notes.main.MainActivity.lambda$onCreate$7$it-niedermann-owncloud-notes-main-MainActivity(MainActivity.java:171)
    at it.niedermann.owncloud.notes.main.MainActivity$$ExternalSyntheticLambda24.run(Unknown Source:2)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:462)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
    at java.lang.Thread.run(Thread.java:923)
stefan-niedermann commented 2 years ago

How did you manage to get into this state in the first place? Did you remove the account from your Nextcloud Android app (not Notes Android)? Did you put your Nextcloud instance into maintenance mode, change your authentication details or anything else?

Since this error is not a full crash, I assume you are still able to access your notes via the app while ignoring the error? In this case simply export your not yet synchronized notes (the once with the circular arrow icon next to them).

petitminion commented 2 years ago

The only thing I recall is that I left the notes app while it was switching account. Maybe MIUI killed the background process and that caused the error

Now I have no accèss to any of the notes. I only have a black screen. I will try to access the txt files with adb. But if you have another solution could be great

stefan-niedermann commented 2 years ago

The only thing I recall is that I left the notes app while it was switching account

What do you mean by "Switching account"? Did you have two accoubts imported in your Notes Android app? Did you remove your old account and import a new account? Did you perform any steps in the Nextcloud Android app rather than the Notes Android app? Did you change the Nextckoud instance URL anywhere?

Maybe MIUI killed the background process and that caused the error

Killing the process of the Notes Android app can not cause this error.

I only have a black screen.

Please post a screenshot, I never saw a black screen of this (or any other) Android app oO?

I will try to access the txt files with adb.

Notes Android stores the notes in a SQLite database, not in files for performance reasons.

petitminion commented 2 years ago

I have two account in the nextcloud app. I wanted to switch account on the notes app. I clicked on the account icon, I saw my other account, I cliked on it. The two account

Screenshot_2022-08-16-01-35-34-792_it niedermann owncloud notes

Notes Android stores the notes in a SQLite database, not in files for performance reasons.

can this be accessed easily ? are from different instances.

petitminion commented 2 years ago

I managed to get my notes back :

adb backup it.niedermann.owncloud.notes
dd if=backup.ab bs=1 skip=24 > compressed-data
printf "\x1f\x8b\x08\x00\x00\x00\x00\x00" \
    | cat - compressed-data | gunzip -c > decompressed-data.tar
tar xf decompressed-data.tar

read the db with sqlitebrowser

petitminion commented 2 years ago

maybe the error came from the fact that the second account didn't have an intance with notes app installed

stefan-niedermann commented 2 years ago

Absolutely possible! And how did you manage to have this account in the Notes app but not in the Nextcloud app?

Faexa commented 1 year ago

Hello,

same as #1612

I answered there for me. Coping my answer from there

Trace

App Version: 3.7.1
App Version Code: 3007001
App Flavor: fdroid

Files App Version Code: 30240090

---

OS Version: 5.10.107-android13-4-ab23406000(23406000)
OS API Level: 33
Device: oriole
Manufacturer: Google
Model (and Product): Pixel 6 (oriole)

---

com.nextcloud.android.sso.exceptions.NoCurrentAccountSelectedException: Aucun compte sélectionné pour le moment
    at com.nextcloud.android.sso.helper.SingleAccountHelper.getCurrentAccountName(SingleAccountHelper.java:47)
    at com.nextcloud.android.sso.helper.SingleAccountHelper.getCurrentSingleSignOnAccount(SingleAccountHelper.java:54)
    at it.niedermann.owncloud.notes.main.MainActivity.lambda$onCreate$7$it-niedermann-owncloud-notes-main-MainActivity(MainActivity.java:174)
    at it.niedermann.owncloud.notes.main.MainActivity$$ExternalSyntheticLambda30.run(Unknown Source:2)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:463)
    at java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1137)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:637)
    at java.lang.Thread.run(Thread.java:1012)

What I've done :

I had a nextcloud account temporarly set without any syncing, just to have the notes with you application (I planned to get a full nextcloud instance lately). The account was nextcloud.alex.xxx.xxx

I finally got my instance running (at nextcloud.xxx.xxx). I deleted the old account nextcloud.alex.xxx.xxx in android main nextcloud app

And notes android app does not want to know anything... Error message, cannot select an account, left menu is blank (as previous pictures).

Tried adding back the account in nextcloud app, no luck, still "no account is configured"

I had a widget with the notes listed, which always show the titles (even after reboot, so the data is still here), but clicking on a note goes back to the main problem (app does not open / says "no account is configured")

New android makes it totally impossible to access data (I'm not rooted). I can not adb run-as because the app is not debuggable, and abd backup gives my a 47bits file (which apparently is because of non backable app from manifest ?)

If you have an idea to correct this problem or to extract the note database (so I could wipe the note app data and start fresh).

Thank you very much for your good work !

joshtrichards commented 1 month ago

Closing due to no follow-up to https://github.com/nextcloud/notes-android/issues/1566#issuecomment-1216421126 after two years