Repository navigation
Description
Current behavior 🐛
On the feature/breakingchanges branch, FeatureConfiguration.Rendering.UseVulkanOnSkiaAndroid defaults to true. When Vulkan initialization fails at runtime, the app shows a permanent black screen instead of falling back to OpenGL ES: the activity is focused, the process is alive, but nothing ever renders.
adb logcat shows the render thread dying, e.g.:
I DOTNET : Uno.UI.Runtime.Skia.Vulkan.VulkanException: vkCreateInstance returned VK_ERROR_INCOMPATIBLE_DRIVER
I DOTNET : at Uno.UI.Runtime.Skia.Vulkan.Interop.VulkanInstance.Create(...)
I DOTNET : at Uno.UI.Runtime.Skia.Vulkan.VulkanContext.Initialize(...)
I DOTNET : at Uno.UI.Runtime.Skia.Android.UnoSKVulkanView.InitializeVulkan(ISurfaceHolder holder)
I DOTNET : at Uno.UI.Runtime.Skia.Android.UnoSKVulkanView.RenderLoop(Object state)
Three distinct failure flavors were reproduced, all ending in the same black screen:
vkCreateInstance→VK_ERROR_INCOMPATIBLE_DRIVER(macOS arm64 host, API-28 arm64 system image,-gpu swiftshader_indirect)VulkanException: No devices foundfromvkEnumeratePhysicalDevices(API-33 x86_64 image,-feature -Vulkan)VulkanException: Unable to create SkiaSharp GRContext from Vulkan device—vkCreateInstancesucceeds on the emulator's SwiftShader guest device, but Skia can't create aGRContexton it (stock API-33 x86_64 image +-gpu swiftshader_indirect, no special flags)
Root cause: the fallback in ApplicationActivity.CreateRenderView() is dead code for these failures.
- The gate is
PackageManager.HasSystemFeature(FEATURE_VULKAN_HARDWARE_LEVEL), but emulator images declare the Vulkan feature flags as static configuration even when the driver cannot actually render, so the check passes. - The
try/catchwraps onlynew UnoSKVulkanView(...), whose constructor does no Vulkan work. Actual initialization happens later, on the render thread (SurfaceCreated→RenderLoop→InitializeVulkan), where the exception is caught, logged, and the thread exits — no view swap, no fallback.
Expected behavior 🎯
When Vulkan can't be initialized, the app falls back to the OpenGL ES render view (as the UseVulkanOnSkiaAndroid doc comment already promises) and renders normally.
How to reproduce it (as minimally and precisely as possible) 🔬
Using SamplesApp from this repo, on feature/breakingchanges (observed at 0ebec1e):
dotnet publish src/SamplesApp/SamplesApp.Skia.netcoremobile/SamplesApp.Skia.netcoremobile.csproj \
-r android-x64 -f net10.0-android -p:UnoTargetFrameworkOverride=net10.0-androidLaunch an Android emulator with a software renderer — a stock API-33 default;x86_64 image is enough:
emulator -avd <avd-name> -gpu swiftshader_indirect -no-snapshotThen:
adb install .../publish/uno.platform.samplesapp.skia-Signed.apk
adb shell am start uno.platform.samplesapp.skia/crc6448f3b0362cbf4bc9.MainActivityThe app briefly shows the splash, then blinks to a black screen and stays black. adb logcat contains the VulkanException above. (adb shell cmd gpu vkjson is a convenient way to inspect what guest Vulkan actually reports on a given emulator config.)
Also reproducible with -feature -Vulkan (flavor 2) and on macOS arm64 hosts with API-28 arm64 images (flavor 1). An API-28 google_apis;x86_64 image is not affected because that image declares no Vulkan feature flags, so the existing HasSystemFeature gate correctly falls back — highlighting that the gate only works when the image is honest.
Workaround 🛠️
Set Uno.UI.FeatureConfiguration.Rendering.UseVulkanOnSkiaAndroid = false; early in app initialization to force the OpenGL ES path.
Renderer 🎨
- Skia
- Native
Affected platforms 📱💻🖥️
Android
Uno.Sdk version (and other relevant versions) 📦
Not applicable (repo development) — feature/breakingchanges branch, observed at commit 0ebec1e.
IDE version 🧑💻
Not applicable (CLI publish + adb install).
Anything else we need to know? 💬
- Related but distinct from Uno 7: Crash on Android with Vulkan #23923 (a JNI/GC race in the same view's
InitializeVulkan); this issue is about the missing fallback when Vulkan initialization fails. - Since flavor 3 reproduces on a stock, unmodified emulator config, any Android emulator run with SwiftShader rendering (common on CI and on machines without GPU passthrough) currently gets a black screen by default on this branch.
Activity