Desconhecido ReferenceError ao carregar o arquivo de ativos no Android 4.4
Eu estou usando o seguinte código de aplicativo MathJax.http://cs.jsu.edu/wordpress/?p=498#comment-217
Na função seguinte eu estou tentando carregar o arquivo do diretório de ativos.
public static boolean makeMathView_new(WebView webview) {
webview.getSettings().setRenderPriority(RenderPriority.HIGH);
webview.getSettings().setJavaScriptEnabled(true);
webview.loadDataWithBaseURL("http://bar", "<script type='text/x-mathjax-config'>"
+"MathJax.Hub.Config({ messageStyle: 'none', showMathMenu: false, jax: ['input/TeX','output/HTML-CSS'], "
+"extensions: ['tex2jax.js'],"
+ "'HTML-CSS': { scale: 100 },"
+"TeX: { extensions: ['AMSmath.js','AMSsymbols.js','noErrors.js','noUndefined.js'] } });</script>"
+"<script type='text/javascript' src='file:///android_asset/MathJax/MathJax.js'></script>"
+ "<span id='math'></span>","text/html","utf-8", "");
return true;
}
Quando executado no emulador do Android 4.4, estou recebendo erros a seguir.
V/WebViewChromium(1342): Binding Chromium to the background looper Looper{b1da1340}
I/chromium(1342): [INFO:library_loader_hooks.cc(112)] Chromium logging enabled: level = 0, default verbosity = 0
I/BrowserProcessMain(1342): Initializing chromium process, renderers=0
W/chromium(1342): [WARNING:proxy_service.cc(888)] PAC support disabled because there is no system implementation
E/chromium(1342): [ERROR:gl_surface_egl.cc(153)] No suitable EGL configs found.
E/chromium(1342): [ERROR:gl_surface_egl.cc(620)] GLSurfaceEGL::InitializeOneOff failed.
E/chromium(1342): [ERROR:gl_surface_egl.cc(153)] No suitable EGL configs found.
E/chromium(1342): [ERROR:gl_surface_egl.cc(620)] GLSurfaceEGL::InitializeOneOff failed.
E/chromium(1342): [ERROR:gpu_info_collector.cc(86)] gfx::GLSurface::InitializeOneOff() failed
I/chromium(1101): [INFO:CONSOLE(1)] "Uncaught ReferenceError: MathJax is not defined", source: http://bar/ (1)
Atualização: Depois de incorporar a sugestão do ksasq, aqui está o meu novo código, mas ainda não está funcionando.
webview.loadDataWithBaseURL("http://bar", "<script type='text/x-mathjax-config'>"
+ "function setupMathJax() {"
+ "MathJax.Hub.Config({ messageStyle: 'none', showMathMenu: false, jax: ['input/TeX','output/HTML-CSS'], "
+"extensions: ['tex2jax.js'],'HTML-CSS': { scale: 100 },"
+"TeX: { extensions: ['AMSmath.js','AMSsymbols.js','noErrors.js','noUndefined.js'] } });"
+ "}"
+ "</script>"
+ "<script type='text/javascript' src='file:///android_asset/MathJax/MathJax.js'></script>"
+ "<body onload='setupMathJax()'>"
+ "<span id='math'></span>"
+ "</body>"
,"text/html","utf-8", "");