microsoft / WSA

Developer-related issues and feature requests for Windows Subsystem for Android
MIT License
1.45k stars 798 forks source link

WebViews are blank #558

Open P5music opened 1 month ago

P5music commented 1 month ago

Steps to reproduce

Create an application with WebViews, compile it in AndroidStudio against WSA and run in the WSA environment. Both debug and release builds are affected. Also sideloaded apks and direct adb installs are affected. Windows11Pro 22H2 build 22621.3447

✔️ Expected Behavior

WebViews have been working for months then suddenly WebViews display blank content.

❌ Actual Behavior

My app has a RecyclerView with WebViews as items. It used to work perfectly, Now When the app starts the content is displayed for the first item, while others are not displayed. Other activities can be opened but WebViews are blank in them too. For example the User Guide activity features a full page WebView that is supposed to display a long HTML document, but it's blank. It's empty. Going back to the main activity with the RecyclerView now there is nothing, and the only WebView that was displaying something is now blank itself. It becomes blank even without opening another activity, it is enough to perform some UI update after start.

Other Software

AndroidStudio Iguana 2023.2.1 (the issue was present with previous Giraffe version too)

Please specify the version of Windows Subsystem for Android

2311.40000.5.0

Slion commented 1 month ago

Possibly related to #548 Try disable hardware acceleration and see what you get.

P5music commented 1 month ago

@Slion Thank you for the response. I have a bunch of options related to hardware acceleration but there is no overall on/off button for that feature. I tried the available options but WebViews are still blank except for some of them when the app starts.

Slion commented 1 month ago

You need to use setLayerType and set it to LAYER_TYPE_SOFTWARE.

P5music commented 1 month ago

@Slion Neither webView.setLayerType(View.LAYER_TYPE_SOFTWARE,null); or android:hardwareAccelerated="false" (on the application element in manifest) worked.