stefan-niedermann / nextcloud-deck

📋 Android client for nextcloud deck app
https://play.google.com/store/apps/details?id=it.niedermann.nextcloud.deck.play
GNU General Public License v3.0
490 stars 53 forks source link

`IllegalStateException: Can not perform this action after onSaveInstanceState` #1507

Open eX00r opened 1 year ago

eX00r commented 1 year ago

Hello,

first thank you for your great work with this app! I was using it a long time without any issues. When I bought a new phone and installed NC Deck App on Android I was not able to sync the Decks from my instance. It is possible to sync with a new user account which is only subscribed to few decks but not with my own User Account which is subscribed to several huge decks. The device starts syncing, my profile pick is shown in NC Deck App and it seems to successfully sync until Deck 4 of 15 and then crashed with the following bug report. This happens with PlayStore as well as wit F-Droid Version.

Full Crash:

App Version: 1.23.3
App Version Code: 1023003
App Flavor: play

Files App Version Code: 30250090 (PROD)

---

OS Version: 5.10.101-android12-9-00005-ga829d48e78bd-ab9206161(V14.0.5.0.TLCEUXM)
OS API Level: 33
Device: cupid
Manufacturer: Xiaomi
Model (and Product): 2201123G (cupid_eea)

---

java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
    at androidx.fragment.app.FragmentManager.checkStateLoss(FragmentManager.java:1632)
    at androidx.fragment.app.FragmentManager.enqueueAction(FragmentManager.java:1672)
    at androidx.fragment.app.BackStackRecord.commitInternal(BackStackRecord.java:341)
    at androidx.fragment.app.BackStackRecord.commit(BackStackRecord.java:306)
    at androidx.fragment.app.DialogFragment.show(DialogFragment.java:507)
    at it.niedermann.nextcloud.deck.ui.ImportAccountActivity$1$1$1$1$1.lambda$onError$0$it-niedermann-nextcloud-deck-ui-ImportAccountActivity$1$1$1$1$1(ImportAccountActivity.java:162)
    at it.niedermann.nextcloud.deck.ui.ImportAccountActivity$1$1$1$1$1$$ExternalSyntheticLambda0.run(Unknown Source:6)
    at android.os.Handler.handleCallback(Handler.java:942)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loopOnce(Looper.java:210)
    at android.os.Looper.loop(Looper.java:299)
    at android.app.ActivityThread.main(ActivityThread.java:8116)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:559)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:950)

Versions

Smartphone (please complete the following information):

stefan-niedermann commented 1 year ago

Dear @eX00r,

did you try clearing the storage as described in the FAQ and reimport your account? Ideally with a strong and reliable internet connection like Wi-Fi.

You might also want to try to unshare boards shared with you and then reshare them step by step to reduce the load for the critical first sync? Try tapping on whitespace to avoid the app getting suspended by Android. (I am aware that this is actually an app issue).

If everything goes wrong, I can offer you of course to refund the money you spent at the Play Store.

Kind regards

eX00r commented 1 year ago

Hello @stefan-niedermann ,

thank you for your repsonse.

Cleaning the storage and reimporting did not help.

What did the trick finally was unsharing all boards with my account, then sync the Deck app after a clean installation and then re-sharing all accounts. This actually is not a solution which really could be considered a solution as it means transferrring ownership of my own decks to another account to actually becomming able to unshare them with my original account and the reverse the whole operation.

Just fyi if you did not know already, the app "deck ng" was able to sync all the decks from the beginning while NC Deck on Android was not. Maybe it's worth investigating what is done differntly there.

best regards

FireTruck007 commented 11 months ago

I encounter the same error. It used to sync for weeks, and goes wrong today.

desperateCoder commented 11 months ago

@FireTruck007 can you please attach the error message so we can see if it really is for the same reason?

FireTruck007 commented 11 months ago

@desperateCoder Hi , thanks for response. I checked the error details again. I am sorry for that it is not the same error. It just also cannot sync. The deck works normally in browser. Clear storage and reinstall app doesn't solve.

App Version: 1.23.3
App Version Code: 1023003
Server App Version: 1.11.0-beta.1
App Flavor: fdroid

Files App Version Code: 30250090 (PROD)

---

OS Version: 5.15.74-android13-8-00049-g8945ccdb2203-ab9500309(V14.0.16.0.TMACNXM)
OS API Level: 33
Device: ishtar
Manufacturer: Xiaomi
Model (and Product): 2304FPN6DC (ishtar)

---

com.nextcloud.android.sso.exceptions.UnknownErrorException: Software caused connection abort
    at com.nextcloud.android.sso.api.AidlNetworkRequest.performNetworkRequestV2(AidlNetworkRequest.java:197)
    at com.nextcloud.android.sso.api.NextcloudAPI.performNetworkRequestV2(NextcloudAPI.java:180)
    at com.nextcloud.android.sso.api.NextcloudAPI.lambda$performRequestObservableV2$0$com-nextcloud-android-sso-api-NextcloudAPI(NextcloudAPI.java:122)
    at com.nextcloud.android.sso.api.NextcloudAPI$$ExternalSyntheticLambda0.subscribe(Unknown Source:6)
    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.ObservableMap.subscribeActual(ObservableMap.java:32)
    at io.reactivex.Observable.subscribe(Observable.java:12284)
    at io.reactivex.internal.operators.observable.ObservableSubscribeOn$SubscribeTask.run(ObservableSubscribeOn.java:96)
    at io.reactivex.internal.schedulers.ScheduledDirectTask.call(ScheduledDirectTask.java:38)
    at io.reactivex.internal.schedulers.ScheduledDirectTask.call(ScheduledDirectTask.java:26)
    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)
desperateCoder commented 11 months ago

Never saw this one yet to be honest. Can you clear the app data in Android App settings and try again? It will also fail most likely, but I'd expect a different error message. Feel free to share it here as well.

I suspect your current error is caused by some inconsistent data from your very first attempt.

FireTruck007 commented 11 months ago

@desperateCoder Hi, thanks for pointing the direction .I just install the deck app in another android device and it just works! Since the error device still cannot be solved by clear app storage/ reinstall, is there any system folder i should delete to totally initiate a new clean installation?

desperateCoder commented 11 months ago

None that I'd be aware of unfortunately. But in general, clearing the app storage should work pretty fine. Did you get the same error message as you posted above after clearing the storage?

I just install the deck app in another android device and it just works!

Thats one of the major problems with Android for us: fragmentation hell. Also with Nextcloud. There are plenty constellations out there and we can't test each and every of them :disappointed:

FireTruck007 commented 11 months ago

@desperateCoder Yes, clear app storage and reinstall still appear the same error. It seems some previous state still remain somewhere.

No worries. I really like this amazing app function and appreciate your team great efforts. Testing every fragmentation is a waste. I totally understand solving common issues would be best for improvement.

stefan-niedermann commented 11 months ago

@FireTruck007 please also update your deck server app tot he latest stable version (you are running an outdated beta version) and update your Nextcloud Android App (not Deck Android), it is outdated as well.

desperateCoder commented 11 months ago

What really is suspicious here, is the message Software caused connection abort - This one usually comes up in ssh connection scenarios.

What you could try: also reset the actual Nextcloud (files!) app, then make sure it is up-to-date, then reconnect in the main Nextcloud app. After that you can reset Deck as well and try again.

We're not calling the server in our app, but we let the main Nextcloud app do the requests for us. The error above is thrown by the Nextcloud app, so its worth a try.

And as typing, @stefan-niedermann seemed to come to the same conclusion :laughing:

FireTruck007 commented 11 months ago

@stefan-niedermann @desperateCoder Thanks so much for your help ! It works! I reinstall the stable version 1.11 and works perfectly! I used to worry about if i delete the deck installation folder all my data will be gone. But it doesn't , all my deck data is still there. It is so nice they are stored along with the nextcloud!

rallisf1 commented 11 months ago

I am experiencing a similar issue. I am using latest versions of everything, but use oauth2 to authenticate on my nextcloud instance. Error logs:

App Version: 1.23.4
App Version Code: 1023004
Server App Version: 1.11.0
App Flavor: fdroid

Files App Version Code: 30260090 (PROD)

---

OS Version: 4.19.157-perf-gf8cdf943b2b3(V14.0.9.0.TKHEUXM)
OS API Level: 33
Device: alioth
Manufacturer: Xiaomi
Model (and Product): M2012K11AG (alioth_eea)

---

android.database.sqlite.SQLiteConstraintException: FOREIGN KEY constraint failed (code 787 SQLITE_CONSTRAINT_FOREIGNKEY)
    at android.database.sqlite.SQLiteConnection.nativeExecuteForLastInsertedRowId(Native Method)
    at android.database.sqlite.SQLiteConnection.executeForLastInsertedRowId(SQLiteConnection.java:961)
    at android.database.sqlite.SQLiteSession.executeForLastInsertedRowId(SQLiteSession.java:790)
    at android.database.sqlite.SQLiteStatement.executeInsert(SQLiteStatement.java:89)
    at androidx.sqlite.db.framework.FrameworkSQLiteStatement.executeInsert(FrameworkSQLiteStatement.kt:42)
    at androidx.room.EntityInsertionAdapter.insertAndReturnId(EntityInsertionAdapter.kt:102)
    at it.niedermann.nextcloud.deck.database.dao.UserDao_Impl.insert(UserDao_Impl.java:177)
    at it.niedermann.nextcloud.deck.database.dao.UserDao_Impl.insert(UserDao_Impl.java:29)
    at it.niedermann.nextcloud.deck.database.DataBaseAdapter.createUser(DataBaseAdapter.java:393)
    at it.niedermann.nextcloud.deck.remote.helpers.providers.AccessControlDataProvider.prepareUser(AccessControlDataProvider.java:127)
    at it.niedermann.nextcloud.deck.remote.helpers.providers.AccessControlDataProvider.createInDB(AccessControlDataProvider.java:101)
    at it.niedermann.nextcloud.deck.remote.helpers.providers.AccessControlDataProvider.createInDB(AccessControlDataProvider.java:21)
    at it.niedermann.nextcloud.deck.remote.helpers.SyncHelper$1.onResponse(SyncHelper.java:62)
    at it.niedermann.nextcloud.deck.remote.helpers.SyncHelper$1.onResponse(SyncHelper.java:47)
    at it.niedermann.nextcloud.deck.remote.helpers.providers.AccessControlDataProvider.getAllFromServer(AccessControlDataProvider.java:58)
    at it.niedermann.nextcloud.deck.remote.helpers.SyncHelper.doSyncFor(SyncHelper.java:47)
    at it.niedermann.nextcloud.deck.remote.helpers.providers.BoardDataProvider.goDeeper(BoardDataProvider.java:172)
    at it.niedermann.nextcloud.deck.remote.helpers.providers.BoardDataProvider.goDeeper(BoardDataProvider.java:30)
    at it.niedermann.nextcloud.deck.remote.helpers.SyncHelper$1.onResponse(SyncHelper.java:77)
    at it.niedermann.nextcloud.deck.remote.helpers.SyncHelper$1.onResponse(SyncHelper.java:47)
    at it.niedermann.nextcloud.deck.remote.helpers.providers.BoardDataProvider$1.onResponse(BoardDataProvider.java:57)
    at it.niedermann.nextcloud.deck.remote.helpers.providers.BoardDataProvider$1.onResponse(BoardDataProvider.java:47)
    at it.niedermann.nextcloud.deck.remote.api.RequestHelper$ResponseConsumer.accept(RequestHelper.java:52)
    at io.reactivex.internal.observers.LambdaObserver.onNext(LambdaObserver.java:63)
    at io.reactivex.internal.operators.observable.ObservableSubscribeOn$SubscribeOnObserver.onNext(ObservableSubscribeOn.java:58)
    at io.reactivex.internal.operators.observable.ObservableFromPublisher$PublisherSubscriber.onNext(ObservableFromPublisher.java:56)
    at com.nextcloud.android.sso.api.NextcloudAPI.lambda$performRequestObservableV2$0$com-nextcloud-android-sso-api-NextcloudAPI(NextcloudAPI.java:123)
    at com.nextcloud.android.sso.api.NextcloudAPI$$ExternalSyntheticLambda0.subscribe(Unknown Source:6)
    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.ObservableSubscribeOn$SubscribeTask.run(ObservableSubscribeOn.java:96)
    at io.reactivex.internal.schedulers.ScheduledDirectTask.call(ScheduledDirectTask.java:38)
    at io.reactivex.internal.schedulers.ScheduledDirectTask.call(ScheduledDirectTask.java:26)
    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)
App Version: 1.23.4
App Version Code: 1023004
Server App Version: 1.11.0
App Flavor: fdroid

Files App Version Code: 30260090 (PROD)

---

OS Version: 4.19.157-perf-gf8cdf943b2b3(V14.0.9.0.TKHEUXM)
OS API Level: 33
Device: alioth
Manufacturer: Xiaomi
Model (and Product): M2012K11AG (alioth_eea)

---

com.nextcloud.android.sso.exceptions.NextcloudHttpRequestFailedException: HTTP request failed with HTTP status-code: 500
    at com.nextcloud.android.sso.api.AidlNetworkRequest.performNetworkRequestV2(AidlNetworkRequest.java:197)
    at com.nextcloud.android.sso.api.NextcloudAPI.performNetworkRequestV2(NextcloudAPI.java:180)
    at com.nextcloud.android.sso.api.NextcloudAPI.lambda$performRequestObservableV2$0$com-nextcloud-android-sso-api-NextcloudAPI(NextcloudAPI.java:122)
    at com.nextcloud.android.sso.api.NextcloudAPI$$ExternalSyntheticLambda0.subscribe(Unknown Source:6)
    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.ObservableMap.subscribeActual(ObservableMap.java:32)
    at io.reactivex.Observable.subscribe(Observable.java:12284)
    at io.reactivex.internal.operators.observable.ObservableSubscribeOn$SubscribeTask.run(ObservableSubscribeOn.java:96)
    at io.reactivex.internal.schedulers.ScheduledDirectTask.call(ScheduledDirectTask.java:38)
    at io.reactivex.internal.schedulers.ScheduledDirectTask.call(ScheduledDirectTask.java:26)
    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)
Caused by: java.lang.IllegalStateException: <!DOCTYPE html>
<html class="ng-csp" data-placeholder-focus="false" lang="en" data-locale="el" translate="no" >
    <head
 data-requesttoken="">
        <meta charset="utf-8">
        <title>
            Spinworks Tasks     </title>
        <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0">
                <meta name="apple-itunes-app" content="app-id=1125420102">
                <meta name="theme-color" content="#8DC63F">
        <link rel="icon" href="/index.php/apps/theming/favicon?v=b1d57811">
        <link rel="apple-touch-icon" href="/index.php/apps/theming/icon?v=b1d57811">
        <link rel="mask-icon" sizes="any" href="/core/img/favicon-mask.svg" color="#8DC63F">
        <link rel="manifest" href="/index.php/apps/theming/manifest?v=b1d57811">
        <link rel="stylesheet" href="/core/css/server.css?v=34e05fa2-10">
<link rel="stylesheet" href="/apps/sociallogin/css/styles.css?v=44755786-10">
<link rel="stylesheet" href="/apps/unroundedcorners/css/unround.css?v=872ccd9c-10">
<link rel="stylesheet" href="/core/css/styles.css?v=34e05fa2-10">
<link rel="stylesheet" href="/core/css/header.css?v=34e05fa2-10">
<link rel="stylesheet" href="/apps/theming/css/default.css?v=34e90de1-10">
<link rel="stylesheet" href="/core/css/guest.css?v=34e05fa2-10">
        <script nonce="clJDYkEwanV4S3dWa29qN21oMVBpbGhxZ1FRdGhjcTFJcGJweVBHeTNRVT06bm1QY1pSdmNzK3RHeHVhSi9TMFord0l3NGs5UDVJN1FWZEdzbmJMMnAzMD0=" defer src="/dist/core-common.js?v=34e05fa2-10"></script>
<script nonce="clJDYkEwanV4S3dWa29qN21oMVBpbGhxZ1FRdGhjcTFJcGJweVBHeTNRVT06bm1QY1pSdmNzK3RHeHVhSi9TMFord0l3NGs5UDVJN1FWZEdzbmJMMnAzMD0=" defer src="/dist/core-main.js?v=34e05fa2-10"></script>
<script nonce="clJDYkEwanV4S3dWa29qN21oMVBpbGhxZ1FRdGhjcTFJcGJweVBHeTNRVT06bm1QY1pSdmNzK3RHeHVhSi9TMFord0l3NGs5UDVJN1FWZEdzbmJMMnAzMD0=" defer src="/dist/core-files_fileinfo.js?v=34e05fa2-10"></script>
<script nonce="clJDYkEwanV4S3dWa29qN21oMVBpbGhxZ1FRdGhjcTFJcGJweVBHeTNRVT06bm1QY1pSdmNzK3RHeHVhSi9TMFord0l3NGs5UDVJN1FWZEdzbmJMMnAzMD0=" defer src="/dist/core-files_client.js?v=34e05fa2-10"></script>
<script nonce="clJDYkEwanV4S3dWa29qN21oMVBpbGhxZ1FRdGhjcTFJcGJweVBHeTNRVT06bm1QY1pSdmNzK3RHeHVhSi9TMFord0l3NGs5UDVJN1FWZEdzbmJMMnAzMD0=" defer src="/index.php/js/core/merged-template-prepend.js?v=34e05fa2-10"></script>
<script nonce="clJDYkEwanV4S3dWa29qN21oMVBpbGhxZ1FRdGhjcTFJcGJweVBHeTNRVT06bm1QY1pSdmNzK3RHeHVhSi9TMFord0l3NGs5UDVJN1FWZEdzbmJMMnAzMD0=" defer src="/dist/files_sharing-main.js?v=34e05fa2-10"></script>
            </head>
    <body id="body-login">
        <noscript>
    <div id="nojavascript">
        <div>
            This application requires JavaScript for correct operation. Please <a href="https://www.enable-javascript.com/" target="_blank" rel="noreferrer noopener">enable JavaScript</a> and reload the page.        </div>
    </div>
</noscript>
                    <input type="hidden" id="initial-state-core-versionHash" value="IjM0ZTA1ZmEyIg==">
                    <input type="hidden" id="initial-state-comments-maxAutoCompleteResults" value="MTA=">
                <div class="wrapper">
            <div class="v-align">
                                    <header role="banner">
                        <div id="header">
                            <div class="logo"></div>
                        </div>
                    </header>
                                <main>
                    <h1 class="hidden-visually">
                        Spinworks Tasks                 </h1>
                    <div class="guest-box wide">
    <h2>Internal Server Error</h2>
    <p>The server was unable to complete your request.</p>
    <p>If this happens again, please send the technical details below to the server administrator.</p>
    <p>More details can be found in the server log.</p>

    <h3>Technical details</h3>
    <ul>
        <li>Remote Address: 2a02:587:4b5f:4300:a1d6:3275:6cf1:ea0</li>
        <li>Request ID: nColiECDu4O5lR7oVILj</li>
            </ul>

    </div>
                </main>
            </div>
        </div>
        <footer role="contentinfo" class="guest-box">
            <p class="info">
                <a href="https://tasks.spinworks.gr" target="_blank" rel="noreferrer noopener" class="entity-name">Spinworks Tasks</a>          </p>
        </footer>
    </body>
</html>

    at com.nextcloud.android.sso.InputStreamBinder.processRequestV2(InputStreamBinder.java:454)
    at com.nextcloud.android.sso.InputStreamBinder.performNextcloudRequestAndBodyStreamV2(InputStreamBinder.java:127)
    at com.nextcloud.android.sso.InputStreamBinder.performNextcloudRequestV2(InputStreamBinder.java:110)
    at com.nextcloud.android.sso.aidl.IInputStreamService$Stub.onTransact(IInputStreamService.java:110)
    at android.os.Binder.execTransactInternal(Binder.java:1285)
    at android.os.Binder.execTransact(Binder.java:1249)

And on the server logs:

Level App Message
Error index OCA\Deck\BadRequestException: userId must be provided and must be not empty
Error deck Exception: OC\Group\Manager::getUserIdGroupIds(): Argument # 1 ($uid) must be of type string, null given, called in /.../lib/private/Group/Manager.php on line 315 in file '/.../lib/private/Group/Manager.php' line 332
stefan-niedermann commented 11 months ago

@rallisf1 your problem(s) are not related to the original issue (and they are not related to each other).

One ossue was a HTTP 500 which is a server issue. Your server threw an exception, of course Deck Android can't work with this kind of answer.

Your first error message is a duplicate of https://github.com/stefan-niedermann/nextcloud-deck/issues/1447. You can try working around it by clearing the storage of your Deck Android App as described in our FAQ

varac commented 6 months ago

I am getting the same error, with Deck android 1.24.1 (storage and cache removed) and NC server 28.0.3 (unfortunatly, I don't own the server so I have no idea about the NC desk server app version).