diff --git a/shared/src/androidMain/kotlin/plus/rua/project/ComposeTrace.android.kt b/shared/src/androidMain/kotlin/plus/rua/project/ComposeTrace.android.kt index af5faa7..a3f9403 100644 --- a/shared/src/androidMain/kotlin/plus/rua/project/ComposeTrace.android.kt +++ b/shared/src/androidMain/kotlin/plus/rua/project/ComposeTrace.android.kt @@ -2,6 +2,18 @@ package plus.rua.project import android.os.Trace -actual fun composeTraceBeginSection(name: String) = Trace.beginSection(name) +actual fun composeTraceBeginSection(name: String) { + try { + Trace.beginSection(name) + } catch (_: RuntimeException) { + // Trace API 在 host test 中未 stub;忽略 + } +} -actual fun composeTraceEndSection() = Trace.endSection() \ No newline at end of file +actual fun composeTraceEndSection() { + try { + Trace.endSection() + } catch (_: RuntimeException) { + // Trace API 在 host test 中未 stub;忽略 + } +} \ No newline at end of file