Fix crashes while scrolling the news feed
Hello,
when i read the news and scrolling down, the App Force Close.
Nextcloud 21.02 latest News Reader from F-Droid Store
exception logs:
https://paste.dasnetzundich.de/view/c2632621
@Happyfeet01 This one is tricky to find but pretty harmless. I'll try to fix it in the next release. Does it happen often?
java.lang.Exception: Can't sync opened news
at sync.NewsApiSync.sync(NewsApiSync.kt:86)
at sync.NewsApiSync$sync$1.invokeSuspend(Unknown Source:12)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:104)
at android.os.Handler.handleCallback(Handler.java:900)
at android.os.Handler.dispatchMessage(Handler.java:103)
at android.os.Looper.loop(Looper.java:219)
at android.app.ActivityThread.main(ActivityThread.java:8387)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:513)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1055)
Caused by: kotlinx.coroutines.JobCancellationException: Job was cancelled; job=SupervisorJobImpl{Cancelling}@dbe59d3
Yes, every time when i scroll down
@Happyfeet01 are you using default settings? If not, you can send me the screenshot of settings screen so I will be able to reproduce your issue. You can also try to reinstall the app or simply log out and log in, it should reset everything. Enabling custom settings one-by-one might also help to pin down the issue.
If nothing helps, I think F-Droid allows users to choose the app version. You can install the older version for now.

@Happyfeet01 you can try to turn off "Mark scrolled as read", maybe it will help
@bubelov What is the current state of this issue? I was using the debug build you provided in #16 until recently, which worked just fine (even with mark scrolled entries enabled). After the issue with the app crashing on android 12 was fixed, I updated to the official version of news and I now experience the same issue where the app stops running when scrolling down or opening a feed. Even with mark scrolled as read disabled, the app force closes sometimes when opening a feed item. Might this behavior be related to this issue, or should I open a new one? Also, is there a built-in option to retrieve the logs? Running news version 0.3.1 from Fdroid on Android 12 without google services
@p-fruck did you try to delete the old app and make a clean install? 0.3 might be incompatible with 0.2
@p-fruck also, see https://github.com/bubelov/news/issues/93 if you're using NC. Apparently, SSO library is quite unpredictable, so I had to bring manual NC login as a top-level option. It's not yet available in F-Droid, but it helps some users with sync issues
@bubelov thanks for the quick response. I uninstalled the debug build and did a fresh install of news v0.3.1 with clean storage, but the issue persists. I also downgraded my nextcloud app which I use for SSO to 3.17.1 as you mentioned, but still no success. Unfortunately, SSO is kind of a requirement for me, I'm also not sure if this really is the error here, since as I mentioned it worked fine with your previous debug build. Maybe it is also a bug with the new app theme on android 12? I'm not really into android development, can you tell me a rootless way to retrieve the logs of the app? :D
Also, v0.3.1 using SSO with nextcloud 3.18.0 on android 10 (with google services, in case this matters) has been confirmed to work without such crashes
@p-fruck so you can see the news, but when you try to scroll, it crashes? Can you try switching to standalone mode and adding any feed with it? If it will work, it probably has something to do with NC SSO. If it still crashes, at least we'll know its caused by something else
@p-fruck so you can see the news, but when you try to scroll, it crashes? Can you try switching to standalone mode and adding any feed with it? If it will work, it probably has something to do with NC SSO. If it still crashes, at least we'll know its caused by something else
I using the latest stable build f-droid. No crashes.
@bubelov You're right, in standalone mode I do not experience any issues. When using NC SSO, scrolling the news feed works fine but opening a specific article force closes the app (happens every 3-4 posts)
@p-fruck and it happens only on Android 12? Is it reproducible? Are there articles which always fail? If so, can you provide an example feed and an article so I can try to reproduce it
@bubelov Seems to be an android 12 issue to me, same configuration on android 10 seems to work. To reproduce, simply open the detail-view of an artical a few times in a row and the app will crash. The issue is not specific to a specific article, but happens on each article if I open it multiple times (usually not more than 5x).
Edit: The android 10 device installed nextcloud from google play, I installed nextcloud from F-Droid. Not sure if this makes a difference, both devices use nc SSO
@p-fruck can you try it with direct login? If you have security concerns, you can create a throwaway account just for this test and then delete it. It would show us for sure if the issue is related to SSO of NC integration in general
@bubelov I can reproduce the issue with direct login. Very strange.
@p-fruck so you still having crashes with direct login? What's your Nextcloud Server and Nextcloud News app versions?
@p-fruck one more thing, can you try to login with Miniflux and check some news/feeds and see if the app crashes? It will tell us if the issue is with NC integration or every server-based backend
URL: https://news.bubelov.com User: test Password: newstest
Feel free to change anything in this account
@bubelov Yes I have. I am running Nextcloud v22.2.3 dockerized and have news v16.2.1 installed. When looking at the results of docker-compose logs -f I got the following output for a successful and a failed request:
# This request succeeded
app_1 | <MY_IP> - user 24/Nov/2021:16:09:41 +0000 "PUT /index.php" 200
web_1 | <MY_IP> - user [24/Nov/2021:16:09:41 +0000] "PUT /index.php/apps/news/api/v1-2/items/read/multiple? HTTP/1.1" 200 4 "-" "Mozilla/5.0 (Android) Nextcloud-android/3.17.1" "<MY_IP>"
# This request failed
app_1 | <MY_IP> - user 24/Nov/2021:16:09:46 +0000 "PUT /index.php" 200
web_1 | <MY_IP> - user [24/Nov/2021:16:09:46 +0000] "PUT /index.php/apps/news/api/v1-2/items/read/multiple? HTTP/1.1" 200 4 "-" "Mozilla/5.0 (Android) Nextcloud-android/3.17.1" "<MY_IP>"
Both requests seem to succeed with status code 200, but the second request failed...
I've just tried your miniflux (thanks for this support!) where I made two attempts to view an article. The first attempt succeeded, the second didn't. Still the same issue
Just tested on Android 12 with my NC instance and direct login, no crashes. NC Nextcloud 22.1.1, News Server 16.2.1
OK, so it looks like it happens with all remote servers, that suggests connectivity issue and improper handling on the app side. I will try to add a global exception handler in order to catch the stack trace of this issue and show it inside app
@p-fruck also, if you're a dev or familiar with dev tools, you can launch the app from git code in Android Studio and see the error in the "logcat" tab. It should work pretty much out of the box
@p-fruck my theory is that it fails on a network call, probably on sending the "read" flag
@bubelov I've setup logcat and captured the following error message:
[11-24 17:37:52.978 13956:20418 D/OwnCloudClient #0]
REQUEST PUT /index.php/apps/news/api/v1-2/items/read/multiple
[11-24 17:37:53.008 27582:27582 E/AndroidRuntime]
FATAL EXCEPTION: main
Process: co.appreactor.news, PID: 27582
java.lang.IllegalArgumentException: At least one dimension has to be positive number.
at com.squareup.picasso.Request$Builder.resize(Request.java:324)
at com.squareup.picasso.RequestCreator.resize(RequestCreator.java:235)
at entry.TextViewImageGetter$getDrawable$1$1.invokeSuspend(TextViewImageGetter.kt:22)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:201)
at android.os.Looper.loop(Looper.java:288)
at android.app.ActivityThread.main(ActivityThread.java:7840)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
at com.android.internal.os.ExecInit.main(ExecInit.java:48)
at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:355)
[11-24 17:37:53.013 1548:6682 W/ActivityTaskManager]
Force finishing activity co.appreactor.news/common.AppActivity
The UI somehow seems to report a width < 0 which isn't supported. Do you have any idea how this could happen?
@p-fruck no idea, but it seems like the text view reports zero width under certain conditions. That's unexpected, but I'll add an exception handler as a first line of defense. At least it will stop crashing. After that, I'll have a look on what may be causing that
@p-fruck I added some exception handling and logging, it should stop crashing in preview build
I still have this issue when scrolling, when I disable "Mark scrollend entries as read" the app does work, had this in every build so far. v0.3.4 NC v23.0.2 (but also in every version before) NC News v17.0.1 Android 11 I would provide a crash log if I knew how to do so.
@citizenserious crash log sharing is enabled for preview builds so you can try that. If the app detects a crash, it should initiate crash log sharing. I'm planning to enable this feature for all future builds
https://github.com/bubelov/news/releases/tag/preview
java.lang.NullPointerException at db.app.EntryQueriesImpl$selectByReadOrBookmarked$1.invoke(DatabaseImpl.kt:767) at db.app.EntryQueriesImpl$selectByReadOrBookmarked$1.invoke(DatabaseImpl.kt:765) at com.squareup.sqldelight.Query.executeAsList(Query.kt:135) at com.squareup.sqldelight.runtime.coroutines.FlowQuery$mapToList$1$1.invokeSuspend(FlowExtensions.kt:98) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106) at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)
I got the exact same log when logging in directly.
@citizenserious looks like an issue with database schema or date validation
- Can you try to make a clean install? Just delete the app manually and install the latest F-Droid version from scratch
- If it keeps crashing, try to clean install the latest preview version. I made a few changes to the code, so it should give us more details if it crashes on date validation
@bubelov I did
- a clean install with the latest F-Droid version 0.3.4 it crashes like before.
- install the latest preview version from 2h ago and it was also crashing. Seems to be the same log as before, but maybe I missed something, so:
java.lang.NullPointerException at db.app.EntryQueriesImpl$selectByReadOrBookmarked$1.invoke(DatabaseImpl.kt:767) at db.app.EntryQueriesImpl$selectByReadOrBookmarked$1.invoke(DatabaseImpl.kt:765) at com.squareup.sqldelight.Query.executeAsList(Query.kt:135) at com.squareup.sqldelight.runtime.coroutines.FlowQuery$mapToList$1$1.invokeSuspend(FlowExtensions.kt:98) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106) at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)