advplyr / audiobookshelf-app

Mobile application for Audiobookshelf
https://audiobookshelf.org
GNU General Public License v3.0
1.25k stars 169 forks source link

App crashing with downloaded books in shared storage folder (only for books with cover images) #1143

Open Raptor05 opened 7 months ago

Raptor05 commented 7 months ago

Steps to reproduce

  1. Connect phone to Android Auto
  2. Choose a (downloaded) Audiobook
  3. App starts playing
  4. After few seconds, it's stuttering, stopping and crashing
  5. Try again when app is back
  6. After few seconds, it's stuttering, stopping and crashing
  7. Endless loop

Expected behaviour

Actual behaviour

Environment data

Audiobookshelf Version: 0.9.73-beta

Server hosted on docker on Synology NAS

Android Issue

Android version: 13

Device model: Samsung Galaxy S20 FE (SM-G780G/DS)

Stock or customized system: Stock (Samsung One UI 5.1)

Android Auto Version: 11.4.640814-release

joshaconnor commented 7 months ago

Seconded. Same issue, crashes app every time. Additionally, it often crashes my entire android auto app, and forces a reconnect, sometimes even crashing the launcher on my phone, forcing my phone to reload all app icons and widgets.

Device: Pixel 7 Android: 14 Stock: Yes Audiobookshelf versions with errors: 0.9.71-beta - current (at least, i wasn't paying attention before .71)

Could be a duplicate of this issue, for which a patch was released but did not solve the problem for me: https://github.com/advplyr/audiobookshelf-app/issues/1040

Raptor05 commented 7 months ago

Seconded. Same issue, crashes app every time. Additionally, it often crashes my entire android auto app, and forces a reconnect, sometimes even crashing the launcher on my phone, forcing my phone to reload all app icons and widgets.

Yes, sometimes the whole android auto app is crashing, too. Most of the time its reloading on its own, but sometimes I have to plug out and in the cable to force a reload. Thats a little bit annoying while driving.

advplyr commented 7 months ago

I think this has to do with the app trying to connect to the server in the background but your server is not accessible.

Can you test this by opening the app before connecting to AA in your car and pressing "Disconnect" in the side drawer. If you are not connected to your server you will need to first connect to a server in the app then press disconnect.

That puts the app in "offline mode" and then android auto should not attempt to connect to a server and you won't see a crash if my theory is correct.

joshaconnor commented 7 months ago

Tested a few things along those lines.

Disconnect from server before starting car: works. Disconnect then close app before starting car: works. Leave connected but pre-start app on phone before starting car: works.

I did then try using the app without disconnecting and with the app closed before starting and it works. So the problem may be gone now? I did notice a new version of Android Auto got released, so maybe that had something to do with it. I did also notice that my app does show nothing for a moment (less than 2 seconds) when starting up, before the connecting symbol shows up followed by the server connecting and all the books showing up, so it could be a delay thing with attempting to connect.

Raptor05 commented 7 months ago

I tried it yesterday, too. Without disconnection, it crashed again. Then I disconnected it from server before starting android auto. This time it works. I didn't tried it again afterwards with connected app, I will do it the coming days.

joshaconnor commented 7 months ago

Scratch my previous comment.

So, when I tried a couple weeks ago, a particular book was the one I was trying to listen at the time, which I had saved to external local storage, and have since moved on to other books. The new books I tried yesterday were ones that I wasn't reading before and may or may not have had problems, idk. Additionally, when downloading these new books to test your theory, I used internal local storage for both new books. After redownloading the old book to external storage and trying the disconnect method, it still did not work correctly. In fact, I had the app open on my phone and it was connected to the server when I attempted to start the book on my car screen, which crashed both. So it may have something to do with external storage. I'll continue testing permutations of possible problems to find what triggers the issue.

advplyr commented 7 months ago

Thanks for testing. One reason why I think this may have to do with the server connection is now the most prominent issue that crash analytics shows is:

image

This is most likely android auto related and if the app is in offline mode like I described above then it would skip over that function the crash log is saying is timing out.

Offline mode is not very built out at the moment so it specifically needs the "disconnect" button to get pressed before launching android auto. Preferably "disconnect" is pressed then the app is closed then it is launched only through android auto to make sure it is starting in offline mode. That should tell us for sure if this issue is the same one showing up in the crash analytics.

Some of the descriptions shared above to seem similar to permission issues I've seen in the past. The "stuttering" explained in the OP is what used to happen when there was a permission issue showing downloaded images in notifications. The 3rd most common crash showing up in the analytics looks similar and has to do with downloaded images but I don't know if it is android auto related. The only way I can think to test that one is to find a book that failed, then delete it from the mobile app, remove the cover image on the server, redownload the book on the mobile app without the cover, and try again.

joshaconnor commented 6 months ago

Alright, sorry for the long wait. I deleted the server file for the image, deleted everything from the app, then redownloaded the known problem book and it worked. I listened for 3 minutes, and it usually fails within 45 seconds, so I think that is the problem. I can do further testing if needed.

advplyr commented 6 months ago

@joshaconnor Thanks that helps. When you download the book are you storing that in internal storage (the default) or are you storing that in a folder on the device?

joshaconnor commented 6 months ago

A device folder, so external to the apps storage. I had problems with that so I kept doing it for consistency, but I can retest via internal if you need.

advplyr commented 6 months ago

Yeah that would be great if you can test with internal. Most of the permission issues have to do with device folder permissions that is why internal storage was added.

joshaconnor commented 6 months ago

Tested on internal storage as well, and without the image it works. An odd note, however, is that despite deleting the image from both server and local storage before redownloading, the android auto screen that shows the list of books still has the image as a thumbnail. It doesn't show in the book screen, just the list screen.

advplyr commented 6 months ago

@joshaconnor Are you also using a Samsung Galaxy? The same issue was reported in #1173 and I'm trying to find a pattern.

joshaconnor commented 6 months ago

Pixel 7, Stock Android (14 I think.)


Josh Connor (they/them) joshaconnor.com

On Fri, Apr 19, 2024, 16:08 advplyr @.***> wrote:

@joshaconnor https://github.com/joshaconnor Are you also using a Samsung Galaxy? The same issue was reported in #1173 https://github.com/advplyr/audiobookshelf-app/issues/1173 and I'm trying to find a pattern.

— Reply to this email directly, view it on GitHub https://github.com/advplyr/audiobookshelf-app/issues/1143#issuecomment-2067216428, or unsubscribe https://github.com/notifications/unsubscribe-auth/AF3LQGEIZZZ5TMRASFUFBDDY6F2TFAVCNFSM6AAAAABE7IMHW2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANRXGIYTMNBSHA . You are receiving this because you were mentioned.Message ID: @.***>

advplyr commented 6 months ago

Hmm I wonder if permission was lost on the folder you selected in the app to download audiobooks to. I have seen people mention that they had to remove the folder, re-add it and download the audiobooks again.

joshaconnor commented 6 months ago

No, other books work fine from both internal and external storage. It seems to just be the image issue, and it's only some books with some images.


Josh Connor (they/them) joshaconnor.com

On Fri, Apr 19, 2024, 16:35 advplyr @.***> wrote:

Hmm I wonder if permission was lost on the folder you selected in the app to download audiobooks to. I have seen people mention that they had to remove the folder, re-add it and download the audiobooks again.

— Reply to this email directly, view it on GitHub https://github.com/advplyr/audiobookshelf-app/issues/1143#issuecomment-2067250169, or unsubscribe https://github.com/notifications/unsubscribe-auth/AF3LQGGHZNWX47AV2BRK4X3Y6F5XLAVCNFSM6AAAAABE7IMHW2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANRXGI2TAMJWHE . You are receiving this because you were mentioned.Message ID: @.***>

Raptor05 commented 6 months ago

Am I right, that a temporary solution would be to not use the external storage but the default storage of audiobookshelf?

joshaconnor commented 6 months ago

Yeah, that is a solution that does work.

advplyr commented 5 months ago

This is not specific to android auto so I updated the title. I'm not able to reproduce this on Pixel 6 on Android 13. This has been an issue with some devices for a while but I haven't been able to track down any pattern to it.

Raptor05 commented 5 months ago

Update: I've removed the external storage folder and re-downloaded all audiobooks into an internal storage folder. But unfortunately, it's still crashing. Is it enough to use an internal folder or do I have to use this "intenal app storage" thing?

advplyr commented 5 months ago

I don't know for sure since I can't reproduce it but the internal app storage was added specifically for permission issues so that should work

DoctorDalek1963 commented 3 months ago

I'm using the internal app storage for all my downloads and I'm still getting this issue, but only when there's a cover there. If I use adb shell to go and delete the cover (because the app will let me delete any of the audio files, but never the cover for some reason), then it works perfectly.

Obviously I'd love for this to be fixed completely, but the option to delete the downloaded cover from within the app or the option to not download the cover at all would be a good quick fix.

I'm using a Google Pixel 4a with LineageOS 21 (Android 14) for the record.