AdamGuidarini / MediTrak

A free and open source medication tracking app for Android 10+
GNU General Public License v2.0
50 stars 7 forks source link

App crashes on start up, previous fix did not solve. #126

Open brokenbadger opened 1 month ago

brokenbadger commented 1 month ago

Since last update, app crashes on boot screen (logo). Cannot use.

brokenbadger commented 1 month ago

Installed fix, but same issue persists. I have not imported or exported data before as was previously asked?

AdamGuidarini commented 1 month ago

I might need you to pull the logcat for this since I'm struggling to reproduce it. It's a bit of an lengthy process unfortunately.

You'll need to use the Android debug bridge (adb) which you can get either as part of Android Studio or in a zip file with only the command line tools (toward the bottom of the page). Although if you're using a Linux distribution you can install them from your package manager:

Android CLI tools and Android Studio: https://developer.android.com/studio

Debian/Ubuntu based distros: sudo apt-get install android-sdk-platform-tools

For Fedora/SUSE-based distros: sudo dnf install android-tools

Here's a pretty good guide I came across for how to use just the adb command line tool:

https://www.xda-developers.com/install-adb-windows-macos-linux/

Once installed and with you device connected, you can pull the logs with this command: adb logcat --buffer=crash

Alternatively, You can also try using an Android app like this: https://f-droid.org/en/packages/com.f0x1d.logfox/ This was the easiest way I found to get logs without using Android Studio or having adb throw all the logs at you for the entire system

You will need to give the app permission to read logs through the adb though with this command adb shell pm grant com.f0x1d.logfox android.permission.READ_LOGS

This app also has a filter option where you can enter projects.medicationtracker to get only the logs from this app

You can also use Android Studio, but that's a bigger download: https://developer.android.com/studio/debug/logcat

Sorry this is kind of an involved process, but since I'm struggling to get it to crash this data would go a long way helping me find the cause of the crashing.

Resetting or reinstalling the app would probably work as well if you need the app to launch again as soon as possible, but it's not ideal as the app data will be deleted and the this bug will still be out there

K4LCIFER commented 1 month ago

I just installed 0.13.1 and I'm still experiencing the crash. If I have a moment tomorrow, I'll try to export the logs.

AdamGuidarini commented 1 month ago

Thank you! Sorry again for the inconvenience. Let me know if there's anything I can do to help!

brokenbadger commented 1 month ago

I just installed 0.13.1 and I'm still experiencing the crash. If I have a moment tomorrow, I'll try to export the logs.

If you're unable to do it, I'll give it a go one evening?

avipars commented 1 month ago

Same issue here with app crashing

abePdIta commented 1 month ago

Hi, I have the same problem. I was able to get a logcat. Here it is: logcat.txt I hope it helps and that you can recover the DB.

AdamGuidarini commented 1 month ago

Unfortunately it looks like the database has become corrupted and it doesn't seem like there's much I can to restore it via an update. I can however take a few measures to ensure the app is less likely to corrupt the database and able to handle it becoming corrupted more gracefully.

Here's my current plan:

To get the app working again, the only solution is likely to clear the app's storage unfortunately. Here's a guide for how to do that https://www.androidcentral.com/how-and-when-clear-app-cache-or-data-android. It's far from ideal, but when searching for it a solution I can add via an update, I couldn't find a way to restore a broken database, other than by creating a copy of it periodically and using that to restore the database if it becomes corrupt.

I'll switch from the feature I've been working on over to this as the top priority for the app and I'll tag my commits and pull requests to this issue to keep progress visible. Sorry about the inconvenience, I'll do my best to get this out soon and I'll post updates here

K4LCIFER commented 1 month ago

Wait so all existing data in the app is corrupted? That's rather unfortunate. Do you know what caused it? It would likely be something that was changed in the previous update.

abePdIta commented 1 month ago

I agree with K4lcifer :fire: : it's a little weird that most of us are experiencing the same issue (database corruption) at the same time. Maybe is there a root cause that can be avoided or fixed without too much of effort. That been said, I wish to thank the developer and maintainer of this project. I understand that, right now, you are feeling the pressure of your app failing to work properly and loosing data… but, please, don't. You're doing this for free, in your free time, asking nothing in return. It's okay to be concerned, but don't let concern get the best of you. I know of many FOSS developers who have gone into burn-out because of this.

And, to anyone else, please, be patient. :wink:

AdamGuidarini commented 1 month ago

I'm sure there's something I could patch to prevent it, but I haven't managed to find it yet sadly. Someone I know personally had a similar crash on launch issue, but cleared the app data before I could get to the device and check out the logs (I didn't think to look into the methods I mentioned earlier). Could have been the same issue, or something unrelated. I'm somewhat suspecting that there could be 2 or processes writing to the database a the same time, corrupting the data. But I haven't been able to verify this yet.

I don't think I'll have a whole lot of time to work on it this weekend because of a family event, but early next week I should have time to investigate further and implement methods to handle corruption and mitigate the damage if the other methods don't resolve the issue.

brokenbadger commented 1 week ago

Just tried an uninstall, clean with SD Maid and then fresh install of the latest...... Same issue. There's something in the past couple of APK's that doesn't play nicely with my phone config?

brokenbadger commented 1 week ago

v0.13.1 is the latest I can clean install and get working. Previously just updating to the latest via obtainium would just fail.

abePdIta commented 1 week ago

Same for me. Last working version is 0.13.1 from F-Droid

21 nov. 2024 22:10:47 brokenbadger @.***>:

v0.13.1 is the latest I can clean install and get working. Previously just updating to the latest via obtainium would just fail.

— Reply to this email directly, view it on GitHub[https://github.com/AdamGuidarini/MediTrak/issues/126#issuecomment-2492341509], or unsubscribe[https://github.com/notifications/unsubscribe-auth/AAZZZLIZJXIPGRAAKIXXOS32BZD5NAVCNFSM6AAAAABQURIS66VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIOJSGM2DCNJQHE]. You are receiving this because you are subscribed to this thread. [Image de pistage][https://github.com/notifications/beacon/AAZZZLJCYKKMTO7S6LRTNG32BZD5NA5CNFSM6AAAAABQURIS66WGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTUURYOQK.gif]

AdamGuidarini commented 1 week ago

It could be something phone specific, but I can't say for sure unfortunately. Are you using a standard version of Android (with Google services) or something like GrapheneOS, Lineage OS, Calyx OS, etc...? I believe most of these release an ISO for use in a virtual machine I could try testing with.

I use my own Google Pixel 6 (Android 15) and the Android images Google provides through Android studio for testing so a different Android image could behave differently. But it's hard to say whether or not that's related to the problem.

I checked the comparison between 0.13.1 and 0.13.3, but there don't seem to be any changes that would cause issues like that. At least that I can see. Both use the same minimum (29 - Android 10), compile (34 - Android 14), and target (34 - Android 14) SDK versions for example and have the same permissions.

I did try install 0.13.1, 0.13.2, and 0.13.3 in an emulator, but they didn't display any issues, I'll try testing some more in the coming days, but I'll be traveling to visit family this week so I might not have much time until December 1.

abePdIta commented 1 week ago

Stock Android with Google services for me. More details in private, if you wish.

brokenbadger commented 1 week ago

I'll second @abePdIta. Stock Android with Google services.

The plot thickens.......

AdamGuidarini commented 1 week ago

Stock Android with Google services for me. More details in private, if you wish.

I'll take any details you can give honestly, adam.g.software@gmail.com is the email I set up for stuff like this. Might not lead to the needed answer, but it could rule out some hardware related issues and allow me to configure an emulator my similar to your specific device.

Any logs could also be helpful if anyone has time to get them, since if this is a clean install of the app, I feel like the database is malformed error is less likely to be the cause.

avipars commented 4 days ago

Stock Android with Google services for me. More details in private, if you wish.

I'll take any details you can give honestly, adam.g.software@gmail.com is the email I set up for stuff like this. Might not lead to the needed answer, but it could rule out some hardware related issues and allow me to configure an emulator my similar to your specific device.

Any logs could also be helpful if anyone has time to get them, since if this is a clean install of the app, I feel like the database is malformed error is less likely to be the cause.

For me, the issue only occurred after I updated the app to version 0.13.2, I looked briefly at the commit history and there were changes made recently that involved some SQL queries. If I had to guess, it could be a migration issue or something related to the app and not the users.

AdamGuidarini commented 4 days ago

It's definitely possible the issue is in there, but I'm confused why clean installs of the app work fine in the emulator when I've tested. Updates have also gone smoothly there as well as on my own device. That's the main reason why I've been wondering if it's an issue with some specific devices.