-
Notifications
You must be signed in to change notification settings - Fork 108
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
Error when building android app #1050
Comments
I have the same problem. For some reason if I remove prerender line https://github.com/obsidiansystems/obelisk/blob/master/skeleton/frontend/src/Frontend.hs#L42-L45: prerender_ blank $ liftJSM $ void
$ jsg ("window" :: T.Text)
^. js ("skeleton_lib" :: T.Text)
^. js1 ("log" :: T.Text) ("Hello, World!" :: T.Text) from my project then deployed application seems to work as expected (picture is rendered normally and aplication starts normally every time). I still see the same failing message as you have posted though. |
Thank you so much! I will try that. As a side note, how well-developed is Android and IOS development using Reflex/Obelisk in your experience? I have searched, but haven't found much information about it besides the mention in the readme. I'm slightly concerned by this as I'm thinking of developing applications of medium complexity, things like basic progress tracking apps. It needs features such as storing basic data in local storage. Thanks! |
This is what I am also interested in. My experience with reflex/obelix was toying around last few years and it worked as expected in web. Unfortunatelly I was not successfull with mobile dev until few days ago (and I have never deployed anything on android/ios before so don't know much about developing for this platform). Before that I would try to follow instructions and if it didn't work out from first try I would give up (as I don't know much about mobile dev). Now I actually successfully deployed working scafolding app following their instructions (minus commented out the line above https://github.com/akegalj/obelisk-template/blob/ad01b658efe5d4e968bac1eefc00380c07d6bc86/frontend/src/Frontend.hs#L40 ) and that gives signal to dive deeper.
Yes, I also couldnt find resources about mobile dev with reflex
I think this should be doable but as I am in the process of figurint thigs out I can't say much about is interfacing with js working as expected. I know reflex-dom is using jsaddle as a layer for interfacing with js (and alternitively running code natively in haskell). For example i am trying to implement some game in obelix/reflex so I wanted to listen to If Hopefully this will be usefull to someone |
Thank you so much for the information! I tried it just now and after removing the line relating to |
Note that I just tried prerender_ blank $ el "h1" $ text "this is prerendered" and it works as expected on android. As previously tried: prerender_ blank $ liftJSM $ void
$ jsg ("window" :: T.Text)
^. js ("skeleton_lib" :: T.Text)
^. js1 ("log" :: T.Text) ("Hello, World!" :: T.Text) this didn't work on android. So it seems something is wront with |
I managed to get it working on android as well with: dpb <- getPostBuild >>= delay 0.1
prerender_ blank $ performEvent_ $ ffor dpb $ \_ -> liftJSM $ void
$ jsg ("window" :: T.Text)
^. js ("skeleton_lib" :: T.Text)
^. js1 ("log" :: T.Text) ("Hello, World!" :: T.Text) I accidentally found similar answer somewhere on the web so tried it and it works on androd as well now. If signal is not delayed a bit it won't trigger (for unknown reason) - but now this works on both web and android EDIT: I saw a hint to the answer here https://www.reddit.com/r/reflexfrp/comments/x928ci/comment/inocsqm/?embed_host_url=https%3A%2F%2Fpublish.reddit.com%2Fembed%3Futm_source%3Dembedv2&embed_host_url=https%3A%2F%2Fpublish.reddit.com%2Fembed EDIT2: This is an example of a working app for web and for android https://github.com/akegalj/obelisk-template/tree/a5836362873b223d555f1ed60e776b5380cef0fe @walseb . Everything works on my side and I think obelix should be good for your use case.You can easily interface with js side (as shown in this example) and everythin seems to be working (including prerenderer) |
That's excellent! Thank you so much for finding the solution! |
As an update on the original issue, I noticed that I get the following message now before I get the
The app is going along nicely after the fix @akegalj suggested, although I'm surprised by how strange the WebView renderer is. The CSS styling is applied entirely differently from Chromium, Firefox, or a WebKit browser like Surf, even though my CSS passes the W3C validation test. I also had some issues with inline JavaScript. Has anyone had similar experiences? |
I see the same error on my side as well. I thought it was missing About webview... I am still playing around with logic in reflex and some light interfacing with js, so didn't add much css to notice that but here are some relevant discussions:
Anyway, I don't have any experience with webview so this is a guess but it seems it behaves a bit differently than desktop browser/chrome. From these old answers it also seems webview can be configured in a different way (which I guess is done somewhere) to behave differently (maybe one way is to load produced apk to android studio and find relevant stuff there). One answer said that webview is a different browser and should expect different layout/style but that seems strange in 2023 and I hope is outdated. |
Thank you for the links!
I spent a few hours fixing the many issues I had with WebView the other day through trial and error.
It seems like it doesn't support inline SVGs, can't display iFrames of local pages by setting the source as a reflex route URL (via askRouteToUrl. When I try it, it works fine in the browser but on android it just says that the resource is not available), and seem to have some built in CSS, unless it's my JavaScript apps that has some custom code for running on android somehow.
Perhaps it would be possible to display an iFrame of a local page on android if inserted the HTML manually, that would mean I need a function that could turn generated DOM into a string (DomBuilder t m => m () -> m (Text)), but I haven't found a function like that.
Other than that I'm happy with Reflex, especially the typed routing that Obelisk provides. But I hope I don't run into similar problems when I finally compile to IOS.
Ante Kegalj ***@***.***> writes:
… I see the same error on my side as well. I thought it was missing `zlib` somewhere so I have tried to pull that dependency in with `nix-shell -p zlib ...` but that didn't help. I didn't invest much time into figuring that one out as it seems it works even when that error is reported. It might be the case that this should be labeled as warning.
About webview... I am still playing around with logic in reflex and some light interfacing with js, so didn't add much css to notice that but here are some relevant discussions:
* https://stackoverflow.com/questions/41952513/html-gets-rendered-differently-in-webview-and-desktop-browser
* https://stackoverflow.com/questions/51776587/android-webview-rendering-looks-different-to-chrome
* https://stackoverflow.com/questions/3595013/android-webview-completely-disrespecting-ui-layout?rq=3
* https://stackoverflow.com/questions/8273198/webview-does-not-render-css-like-the-browser-does?rq=3
* https://stackoverflow.com/questions/13683484/android-webview-looking-poor-quality-than-system-browser?rq=3
Anyway, I don't have any experience with webview so this is a guess but it seems it behaves a bit differently than desktop browser/chrome. From these old answers it also seems webview can be configured in a different way (which I guess is done somewhere) to behave differently (maybe one way is to load produced apk to android studio and find relevant stuff there). One answer said that webview is a different browser and should expect different layout/style but that seems strange in 2023 and I hope is outdated.
--
Reply to this email directly or view it on GitHub:
#1050 (comment)
You are receiving this because you were mentioned.
Message ID: ***@***.***>
|
SVGs ought to work. Are they working in the browser but not in the webview? Are you setting the namespace properly? It might be worth using a helper library like reflex-dom-svg.
You may be looking for |
Thank you for replying!
I see, I just entered the SVG manually into the HTML, I will try that package in the future.
Thank you! That might work, I will try it in the future. |
Hello!
When I try to build the example app using the steps detailed in the README, I get the following error:
Unable to watch the file system for changes net.rubygrapefruit.platform.NativeException: Could not query file systems: could not open mount file (errno 2: No such file or directory)
The .apk is still produced, but some functionality appears to not be working after installing it. For instance the image doesn't render, and after restarting the app nothing appears to render.
Here's the relevant parts of the log:
The text was updated successfully, but these errors were encountered: