Skip to content

Android Skia: black screen instead of OpenGL ES fallback when Vulkan initialization fails #23940

Open

Description

@ramezgerges

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:

  1. vkCreateInstance → VK_ERROR_INCOMPATIBLE_DRIVER (macOS arm64 host, API-28 arm64 system image, -gpu swiftshader_indirect)
  2. VulkanException: No devices found from vkEnumeratePhysicalDevices (API-33 x86_64 image, -feature -Vulkan)
  3. VulkanException: Unable to create SkiaSharp GRContext from Vulkan device — vkCreateInstance succeeds on the emulator's SwiftShader guest device, but Skia can't create a GRContext on 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/catch wraps only new 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-android

Launch 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-snapshot

Then:

adb install .../publish/uno.platform.samplesapp.skia-Signed.apk
adb shell am start uno.platform.samplesapp.skia/crc6448f3b0362cbf4bc9.MainActivity

The 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

  1. added
    triage/untriaged
    on Aug 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    triage/untriaged

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions