Bug Report
Capacitor Version
Latest Dependencies:
@capacitor/cli: 3.0.0
@capacitor/core: 3.0.0
@capacitor/android: 3.0.0
@capacitor/electron: 3.0.0
@capacitor/ios: 3.0.0
Installed Dependencies:
@capacitor/cli 2.4.7
@capacitor/android 2.4.7
@capacitor/core 2.4.7
@capacitor/ios 2.4.7
@capacitor/electron not installed
Platform(s)
Current Behavior
When I call Capacitor.Plugins.WebView.getServerBasePath() on Android I get 'public'. But if I call Capacitor.Plugins.WebView.setServerBasePath({ path: 'public' }); I get this error:
2021-05-21 11:22:20.443 4196-4268/com.capacitorexample.app E/Capacitor: Unable to open index.html
java.io.FileNotFoundException: public/index.html (No such file or directory)
at java.io.FileInputStream.open0(Native Method)
at java.io.FileInputStream.open(FileInputStream.java:231)
at java.io.FileInputStream.<init>(FileInputStream.java:165)
at com.getcapacitor.AndroidProtocolHandler.openFile(AndroidProtocolHandler.java:73)
at com.getcapacitor.WebViewLocalServer.handleLocalRequest(WebViewLocalServer.java:246)
at com.getcapacitor.WebViewLocalServer.shouldInterceptRequest(WebViewLocalServer.java:177)
at com.getcapacitor.BridgeWebViewClient.shouldInterceptRequest(BridgeWebViewClient.java:18)
at Xs.a(chromium-Monochrome.aab-stable-443021023:15)
at org.chromium.android_webview.AwContentsBackgroundThreadClient.shouldInterceptRequestFromNative(chromium-Monochrome.aab-stable-443021023:2)
And Webpage not available page on a device.
So basically:
Capacitor.Plugins.WebView.getServerBasePath().then(data => {
Capacitor.Plugins.WebView.setServerBasePath({ path: data.path });
});
Will cause the error.
Expected Behavior
WebView Plugin should be able to set base path back to public (www) directory
Code Reproduction
Reproducible with simple app like https://github.com/DmitrySkripkin/capacitor_example or most likely with any Capacitor app. You can start remote debugging and call WebView plugin's method.
Additional Context
iOS works as expected. If there is any workaround to get back to public folder on Android it would be great help.
Bug Report
Capacitor Version
Platform(s)
Current Behavior
When I call
Capacitor.Plugins.WebView.getServerBasePath()on Android I get 'public'. But if I callCapacitor.Plugins.WebView.setServerBasePath({ path: 'public' });I get this error:And Webpage not available page on a device.
So basically:
Will cause the error.
Expected Behavior
WebView Plugin should be able to set base path back to public (www) directory
Code Reproduction
Reproducible with simple app like https://github.com/DmitrySkripkin/capacitor_example or most likely with any Capacitor app. You can start remote debugging and call WebView plugin's method.
Additional Context
iOS works as expected. If there is any workaround to get back to public folder on Android it would be great help.