I am trying to display the flutter web application using Webview from the native Android. However the page is show the blank page.
Here is the code:
class MainActivity : AppCompatActivity() {
private lateinit var webView: WebView
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.webview_test)
webView = findViewById(R.id.webview)
webView.settings.setJavaScriptEnabled(true)
webView.loadUrl("http://localhost:5011/#/login")
}
The web application works fine in the emulator browser.
There are errors from the Webview browser in the Android app:
022-10-19 09:53:02.040 21184-21184/com.example.kotlinwebview I/chromium: [INFO:CONSOLE(82)] "Loading app from service worker.", source: http://localhost:5011/ (82) 2022-10-19 09:53:24.678 21184-21184/com.example.kotlinwebview I/chromium: [INFO:CONSOLE(52119)] "registerExtension() from dart:developer is only supported in build/run/test environments where the developer event method hooks have been set.", source: http://localhost:5011/dart_sdk.js (52119) 2022-10-19 09:53:25.370 21184-21184/com.example.kotlinwebview I/chromium: [INFO:CONSOLE(52101)] "postEvent() from dart:developer is only supported in build/run/test environments where the developer event method hooks have been set.", source: http://localhost:5011/dart_sdk.js (52101) 2022-10-19 09:53:25.453 21184-21184/com.example.kotlinwebview I/chromium: [INFO:CONSOLE(5067)] "Uncaught (in promise) Error", source: http://localhost:5011/dart_sdk.js (5067) 2022-10-19 09:53:25.453 21184-21184/com.example.kotlinwebview I/chromium: [INFO:CONSOLE(5067)] "Uncaught (in promise) Error", source: http://localhost:5011/dart_sdk.js (5067
Is there any configuration that needs to be set for running the Flutter web application in the Android native Webview?