-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
App crashes upon opening a Typst project folder #149
Comments
Ok I think I know the culprit, it's the scoped storage management. I'm not entirely sure, but what I'm sure is that now I can systematically reproduce the exception, and also the app working fine, by doing the following:
This is typical of an issue with fetching the permissions to access and modify files with scoped storage. I may be able to help but your codebase is hard for me to understand because of the Rust calls and background process. I suggest to use the SimpleStorage library to avoid such tricky errors, that's what I did to improve some other projects in the past such as Super Productivity. |
…age permission issues (fixed via anggrayudi's SimpleStorage lib) (fixes soupslurpr#149) Signed-off-by: Stephen L. <[email protected]>
Bingo, this was the issue! I'm making a PR right now. |
Odd, I can't reproduce this issue with the steps you provided. Could you inform me of the device you're using and OS? |
Android 10, the SAF show these issues only from Android 10 (SDK version 29) and up because Google made it much more difficult to use it and much less permissive. Normally you should be able to reproduce it in the Android Studio emulator using Android 10 or above. |
@lrq3000 I'm using the emulator using the "Pixel 7 API 34" device and it's still not working, I made a screen recording and posted to the YouTube video linked below just in case I'm doing something wrong. |
Thank you for posting the video, so my instructions seem to be wrong. I'm not sure under which conditions the app can lose the permissions to a folder it created, but it happened randomly to me just by waiting less than 24h. Instead, try the following:
This should normally crash. |
I just tested on Android 14 API 34 (Pixel 8) in an emulator, if you try to access a folder you did not create with the app, you either get asked again to select a folder, or you get a crash, like on Android 10. To do that, I created a folder (typsttest) using the native Files app, then created a markdown file using BeauTyXT or another text editor outside of the folder I created, then copied it into the folder (so that it doesn't have a lock on it), then rename it to be main.typ , then try to open the folder typsttest. (In a previous message, I stated that an error message was displayed, but that's not the case, the message was just shown on any non user folders in the folder picker dialog, which is irrelevant for this issue). |
Update: my PR does not fix the crash on Android 14. Something must have changed in the SAF... bummer. I'm going to try to fix that. |
Update2: in fact it's not an issue with my PR but with my emulator/compilation: since I reused the libraries you provided instead of compiling my own, it seems I can only target ARM_64, not x86_64 (which is what the emulator uses). I tried running ARM_64 but it is extremely slow and does not boot up because of the lack of Intel HAXM. The alternative is to use Genymotion which works fine with ARM_64 images, but it currently is incompatible with the latest version of Android Studio... TL;DR: I can only run my APK on ARM64, so I can't test in emulators. You will have to test my PR please, or wait a month when I'll have a bit more time to try to compile everything. I believe my PR works fine. |
@lrq3000 It seems UPX breaks the x86_64 library (in emulators only?), I think I'll have to stop using it since it isn't very reliable. Try skipping compressing the library with UPX. I pushed a commit to remove the usage of UPX in useful_commands.txt. |
Oh i didn't even know it was possible to compress Android libraries with UPX! I will do that once i will recompile the libs.
On my real device, I cannot reproduce the error. It's the same as in the emulator (deadobject) but I can't reproduce it whereas I could before. Maybe it's because my OS remembers the permissions I gave.
Note that the error I opened this issue here for started before I started coding anything, I in fact fired up Android Studio to try to debug why the app was suddenly not working anymore.
I highly doubt I will be the only one to run into the issue. I'll keep the original app for now to see if it happees again.
22 mai 2024 20:29:18 soupslurpr ***@***.***>:
…
@lrq3000[https://github.com/lrq3000] It seems UPX breaks the x86_64 library, I think I'll have to stop using it since it isn't very reliable. Try skipping compressing the library with UPX.
—
Reply to this email directly, view it on GitHub[#149 (comment)], or unsubscribe[https://github.com/notifications/unsubscribe-auth/AAIRFXT7TN2KMVLR3DLMCKTZDTPX5AVCNFSM6AAAAABH6YH62GVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMRVGQ4DINJVGI].
You are receiving this because you were mentioned.
[Image de pistage][https://github.com/notifications/beacon/AAIRFXTEZYDHVM73DXQKI3DZDTPX5A5CNFSM6AAAAABH6YH62GWGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTT6WBJAQ.gif]
|
Could you tell me the specific device or specific OS (like Samsung One UI 5.0 or Google Pixel 8 Android 14 etc) |
It's a Huawei P40 Pro Plus with Android 10. But I think this is not specific to my phone, as I think I cannot reproduce anymore because now the app has write permissions that the OS remembers. I will test with another phone later on which I never installed BeauTyXT but I am too busy currently, I'll follow up in about two weeks (from the 17th June onward). If I cannot reproduce the issue then, I will modify my PR to extract the other features I implemented (eg, background preview refresh in another thread, etc). |
The background preview refresh doesn't work like you might think, it still blocks other functions in the Rust library. It only makes it asynchronous in Kotlin but it gets blocked when calling another Rust function anyways. So when trying to type text it still blocks it. It has no effect. The proper way to implement it would be to make it async on the Rust side. Which I'm not sure can be done with an isolatedProcess service. I haven't tried. However, I don't think it's needed at all if refreshing only the page(s) you actually see in the preview render is something viable to implement. |
Did you try my build? Because for me it works fine, the preview is indeed refreshed in a non blocking way. I have a a 4 pages document with 2 includes and it is extremely slow, i think this can be considered a small document. |
I tried the latest build posted on your fork, typing out the characters is still blocked on the preview refreshing. |
That is very strange. Are you still using the same emulator setup you cited above? I will try to recompile according to your updated instructions and see if there is maybe a difference due to Android OS versions. |
I'm using a real device, the Pixel 7 on GrapheneOS (Android 14) |
Ok thank you, i will try to make an emulator although sometimes there are differences with real devices, but at leart it will be more reproducible (as I am also using a real device since I could not run in the emulator before ) I'll keep you updated from the 17th june onward. |
Just to let you know that I will only be able to restart working on this in mid/end of July onward, as I have an urgent project to finish for my work before. I remain committed to help in developing BeauTyXT as it will be my main tool to write my PhD thesis (I am already using it for this purpose!). So I will continue adding features/improving stuff along the way during the whole upcoming academic year. |
Thank you, but in the current implementation of those PRs, they will probably not be accepted. I can provide specific details once you ask about some certain features and what they need to achieve to be accepted, okay? |
After working beautifully well for a couple of hours, the app started crashing every time I tried to open a Typst project folder.
I know a bit about Android development so I tried to debug with logcat but so far the only thing I can find is that this issue seems to be caused by a
DeadObjectException
caused by the rustService being called when it is not properly loaded. But this happens right away. I tried to modify the code to ensure it gets loaded, but this does not change anything (maybe I'm doing it wrong, I don't know anything about Rust).Here is the full trace:
Thank you for making this awesome tool, I hope it can work on my device.
The text was updated successfully, but these errors were encountered: