Android Question WebView unexpected crash

Akwa

Member
Licensed User
Hello
In my app, i have a simple webview. It works correctly with 99% of website.
But with an online javascript reader for PDF, the webview crash abruptly, immediately or after some minutes.

So abruptly there is no mention of bug, crash, failure or error in the B4A logs.

I think there is an issue with memory in the webview.

Have someone any idea ?
Is it possible to increase the RAM allowed to the webview ?
 

drgottjr

Expert
Licensed User
Longtime User
go here and look at the post #6 from member roycefer. it's old, but still viable.
(add the reflector library and edit your manifest, per the post.) with it, you can increase
your app's heap and monitor memory usage. typically, you would call a sub after you
load some url.

add webviewextras to the app and add chromeclient. errors in the webpage (if trapped)
are directed to the console, but without chromeclient, you can't see the console. once
you add a chromeclient, the console's message should appear in your log.

report back.
 
Upvote 0

Akwa

Member
Licensed User
Thank you Dr Gottjr.
I already trided to log the RAM available, but informations returned are not pertinent (at launch, there is only 1Mb available, after some time on the app, there is 20Mb available, when opening the webview and the PDF reader, there is 19Mb available, etc).
I will try with the webviewextras lib...
 
Upvote 0

drgottjr

Expert
Licensed User
Longtime User
did you try to increase the heap (part of post#6. most people see an improvement)?

webview uses a lot of memory. memory management is
handled by the os. you can increase memory
allocated to your app, but not to the webview. i've
indicated how to increase the heap allocated to your
app.

i don't which online pdf view you're using or how it
works, but it wouldn't surprise me if webview had to
download the pdf plus a large pdf reader plus attempt
to expand the pdf to display it. all in the same space.
it would be much easier on the server if it simply made
the user do all the work in her browser.

have you tried your default browser (eg, chrome) to
view the pdf? what happens?
 
Last edited:
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…