Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
TestToolChainKmpDemo
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
dsq
TestToolChainKmpDemo
Commits
4ae287cc
Commit
4ae287cc
authored
Mar 04, 2026
by
dsq
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
配置鸿蒙目标,未导入原生工程
parent
12d55b6b
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
286 additions
and
38 deletions
+286
-38
build.gradle.kts
build.gradle.kts
+0
-2
build.gradle.kts
composeApp/build.gradle.kts
+0
-9
libs.versions.toml
gradle/libs.versions.toml
+2
-2
gradle-wrapper.properties
gradle/wrapper/gradle-wrapper.properties
+1
-1
runOhosApp-Mac.sh
runscript/runOhosApp-Mac.sh
+8
-8
settings.gradle.kts
settings.gradle.kts
+4
-14
build.gradle.kts
shared/build.gradle.kts
+143
-1
TestLog.android.kt
...roidMain/kotlin/com/dong/nocomposedemo/TestLog.android.kt
+13
-0
TestLog.kt
...d/src/commonMain/kotlin/com/dong/nocomposedemo/TestLog.kt
+14
-0
TestLog.iosArm64.kt
...m64Main/kotlin/com/dong/nocomposedemo/TestLog.iosArm64.kt
+13
-0
Platform.ios.kt
...src/iosMain/kotlin/com/dong/nocomposedemo/Platform.ios.kt
+9
-1
TestLog.iosSimulatorArm64.kt
...otlin/com/dong/nocomposedemo/TestLog.iosSimulatorArm64.kt
+13
-0
Platform.ohosArm64.kt
...4Main/kotlin/com/dong/nocomposedemo/Platform.ohosArm64.kt
+8
-0
TestLog.ohosArm64.kt
...64Main/kotlin/com/dong/nocomposedemo/TestLog.ohosArm64.kt
+58
-0
No files found.
build.gradle.kts
View file @
4ae287cc
...
@@ -3,7 +3,5 @@ plugins {
...
@@ -3,7 +3,5 @@ plugins {
// in each subproject's classloader
// in each subproject's classloader
alias
(
libs
.
plugins
.
androidApplication
)
apply
false
alias
(
libs
.
plugins
.
androidApplication
)
apply
false
alias
(
libs
.
plugins
.
androidLibrary
)
apply
false
alias
(
libs
.
plugins
.
androidLibrary
)
apply
false
alias
(
libs
.
plugins
.
composeMultiplatform
)
apply
false
alias
(
libs
.
plugins
.
composeCompiler
)
apply
false
alias
(
libs
.
plugins
.
kotlinMultiplatform
)
apply
false
alias
(
libs
.
plugins
.
kotlinMultiplatform
)
apply
false
}
}
\ No newline at end of file
composeApp/build.gradle.kts
View file @
4ae287cc
...
@@ -4,8 +4,6 @@ import org.jetbrains.kotlin.gradle.dsl.JvmTarget
...
@@ -4,8 +4,6 @@ import org.jetbrains.kotlin.gradle.dsl.JvmTarget
plugins
{
plugins
{
alias
(
libs
.
plugins
.
kotlinMultiplatform
)
alias
(
libs
.
plugins
.
kotlinMultiplatform
)
alias
(
libs
.
plugins
.
androidApplication
)
alias
(
libs
.
plugins
.
androidApplication
)
alias
(
libs
.
plugins
.
composeMultiplatform
)
alias
(
libs
.
plugins
.
composeCompiler
)
}
}
kotlin
{
kotlin
{
...
@@ -17,16 +15,9 @@ kotlin {
...
@@ -17,16 +15,9 @@ kotlin {
sourceSets
{
sourceSets
{
androidMain
.
dependencies
{
androidMain
.
dependencies
{
implementation
(
libs
.
compose
.
uiToolingPreview
)
implementation
(
libs
.
androidx
.
activity
.
compose
)
implementation
(
libs
.
androidx
.
activity
.
compose
)
}
}
commonMain
.
dependencies
{
commonMain
.
dependencies
{
implementation
(
libs
.
compose
.
runtime
)
implementation
(
libs
.
compose
.
foundation
)
implementation
(
libs
.
compose
.
material3
)
implementation
(
libs
.
compose
.
ui
)
implementation
(
libs
.
compose
.
components
.
resources
)
implementation
(
libs
.
compose
.
uiToolingPreview
)
implementation
(
libs
.
androidx
.
lifecycle
.
viewmodelCompose
)
implementation
(
libs
.
androidx
.
lifecycle
.
viewmodelCompose
)
implementation
(
libs
.
androidx
.
lifecycle
.
runtimeCompose
)
implementation
(
libs
.
androidx
.
lifecycle
.
runtimeCompose
)
implementation
(
projects
.
shared
)
implementation
(
projects
.
shared
)
...
...
gradle/libs.versions.toml
View file @
4ae287cc
[versions]
[versions]
agp
=
"8.
11
.2"
agp
=
"8.
2
.2"
android-compileSdk
=
"36"
android-compileSdk
=
"36"
android-minSdk
=
"24"
android-minSdk
=
"24"
android-targetSdk
=
"36"
android-targetSdk
=
"36"
...
@@ -11,7 +11,7 @@ androidx-lifecycle = "2.9.6"
...
@@ -11,7 +11,7 @@ androidx-lifecycle = "2.9.6"
androidx-testExt
=
"1.3.0"
androidx-testExt
=
"1.3.0"
composeMultiplatform
=
"1.10.0"
composeMultiplatform
=
"1.10.0"
junit
=
"4.13.2"
junit
=
"4.13.2"
kotlin
=
"2.
3.0
"
kotlin
=
"2.
2.21-OH.0.1.0-01
"
material3
=
"1.10.0-alpha05"
material3
=
"1.10.0-alpha05"
[libraries]
[libraries]
...
...
gradle/wrapper/gradle-wrapper.properties
View file @
4ae287cc
distributionBase
=
GRADLE_USER_HOME
distributionBase
=
GRADLE_USER_HOME
distributionPath
=
wrapper/dists
distributionPath
=
wrapper/dists
distributionUrl
=
https
\:
//
services.gradle.org/distributions
/gradle-8.14.3-bin.zip
distributionUrl
=
https
\:
//
mirrors.cloud.tencent.com/gradle
/gradle-8.14.3-bin.zip
networkTimeout
=
10000
networkTimeout
=
10000
validateDistributionUrl
=
true
validateDistributionUrl
=
true
zipStoreBase
=
GRADLE_USER_HOME
zipStoreBase
=
GRADLE_USER_HOME
...
...
runscript/runOhosApp-Mac.sh
View file @
4ae287cc
...
@@ -147,23 +147,23 @@ if [ "$PLATFORM" = "ohosArm64" ]; then
...
@@ -147,23 +147,23 @@ if [ "$PLATFORM" = "ohosArm64" ]; then
if
[
"
$BUILD_MODE
"
=
"release"
]
;
then
if
[
"
$BUILD_MODE
"
=
"release"
]
;
then
if
[
-n
"
$LOCAL_OHOS_PATH
"
]
;
then
if
[
-n
"
$LOCAL_OHOS_PATH
"
]
;
then
echo
"Using external OHOS path:
$LOCAL_OHOS_PATH
"
echo
"Using external OHOS path:
$LOCAL_OHOS_PATH
"
echo
"/gradlew :
composeApp
:publishReleaseBinariesToHarmonyApp"
echo
"/gradlew :
shared
:publishReleaseBinariesToHarmonyApp"
./gradlew :
composeApp
:publishReleaseBinariesToHarmonyApp
-PharmonyAppPath
=
"
$LOCAL_OHOS_PATH
"
--refresh-dependencies
./gradlew :
shared
:publishReleaseBinariesToHarmonyApp
-PharmonyAppPath
=
"
$LOCAL_OHOS_PATH
"
--refresh-dependencies
else
else
echo
"/gradlew :
composeApp
:publishReleaseBinariesToHarmonyApp"
echo
"/gradlew :
shared
:publishReleaseBinariesToHarmonyApp"
./gradlew :
composeApp
:publishReleaseBinariesToHarmonyApp
--refresh-dependencies
./gradlew :
shared
:publishReleaseBinariesToHarmonyApp
--refresh-dependencies
fi
fi
else
else
if
[
-n
"
$LOCAL_OHOS_PATH
"
]
;
then
if
[
-n
"
$LOCAL_OHOS_PATH
"
]
;
then
echo
"Using external OHOS path:
$LOCAL_OHOS_PATH
"
echo
"Using external OHOS path:
$LOCAL_OHOS_PATH
"
./gradlew :
composeApp
:publishDebugBinariesToHarmonyApp
-PharmonyAppPath
=
"
$LOCAL_OHOS_PATH
"
--refresh-dependencies
./gradlew :
shared
:publishDebugBinariesToHarmonyApp
-PharmonyAppPath
=
"
$LOCAL_OHOS_PATH
"
--refresh-dependencies
else
else
echo
"/gradlew :
composeApp
:publishDebugBinariesToHarmonyApp"
echo
"/gradlew :
shared
:publishDebugBinariesToHarmonyApp"
./gradlew :
composeApp
:publishDebugBinariesToHarmonyApp
--refresh-dependencies
./gradlew :
shared
:publishDebugBinariesToHarmonyApp
--refresh-dependencies
fi
fi
fi
fi
elif
[
"
$PLATFORM
"
=
"iosSimulatorArm64"
]
;
then
elif
[
"
$PLATFORM
"
=
"iosSimulatorArm64"
]
;
then
./gradlew :
composeApp
:linkDebugFrameworkIosSimulatorArm64
--refresh-dependencies
./gradlew :
shared
:linkDebugFrameworkIosSimulatorArm64
--refresh-dependencies
else
else
echo
-e
"
\0
33[31mError: Unsupported platform '
$PLATFORM
'
\0
33[0m"
echo
-e
"
\0
33[31mError: Unsupported platform '
$PLATFORM
'
\0
33[0m"
exit
4
exit
4
...
...
settings.gradle.kts
View file @
4ae287cc
...
@@ -3,14 +3,7 @@ enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")
...
@@ -3,14 +3,7 @@ enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")
pluginManagement
{
pluginManagement
{
repositories
{
repositories
{
google
{
maven
(
"https://maven.eazytec-cloud.com/nexus/repository/maven-public/"
)
mavenContent
{
includeGroupAndSubgroups
(
"androidx"
)
includeGroupAndSubgroups
(
"com.android"
)
includeGroupAndSubgroups
(
"com.google"
)
}
}
mavenCentral
()
gradlePluginPortal
()
gradlePluginPortal
()
}
}
}
}
...
@@ -18,15 +11,12 @@ pluginManagement {
...
@@ -18,15 +11,12 @@ pluginManagement {
dependencyResolutionManagement
{
dependencyResolutionManagement
{
repositories
{
repositories
{
google
{
google
{
mavenContent
{
maven
(
"https://maven.eazytec-cloud.com/nexus/repository/maven-public/"
)
includeGroupAndSubgroups
(
"androidx"
)
gradlePluginPortal
()
includeGroupAndSubgroups
(
"com.android"
)
includeGroupAndSubgroups
(
"com.google"
)
}
}
}
mavenCentral
()
mavenCentral
()
}
}
}
}
include
(
":composeApp"
)
//
include(":composeApp")
include
(
":shared"
)
include
(
":shared"
)
\ No newline at end of file
shared/build.gradle.kts
View file @
4ae287cc
...
@@ -21,7 +21,21 @@ kotlin {
...
@@ -21,7 +21,21 @@ kotlin {
isStatic
=
true
isStatic
=
true
}
}
}
}
ohosArm64
{
binaries
{
sharedLib
{
baseName
=
"kn"
// 链接静态库目录和库名,使用 --whole-archive 强制包含静态库所有符号
freeCompilerArgs
+=
listOf
(
"-Xbinary=sanitizer=address"
)
}
staticLib
{
baseName
=
"kn"
}
}
}
sourceSets
{
sourceSets
{
commonMain
.
dependencies
{
commonMain
.
dependencies
{
// put your Multiplatform dependencies here
// put your Multiplatform dependencies here
...
@@ -29,9 +43,22 @@ kotlin {
...
@@ -29,9 +43,22 @@ kotlin {
commonTest
.
dependencies
{
commonTest
.
dependencies
{
implementation
(
libs
.
kotlin
.
test
)
implementation
(
libs
.
kotlin
.
test
)
}
}
val
commonMain
by
getting
val
ohosArm64Main
by
getting
{
dependsOn
(
commonMain
)
dependencies
{
}
}
}
}
}
}
android
{
android
{
namespace
=
"com.dong.nocomposedemo.shared"
namespace
=
"com.dong.nocomposedemo.shared"
compileSdk
=
libs
.
versions
.
android
.
compileSdk
.
get
().
toInt
()
compileSdk
=
libs
.
versions
.
android
.
compileSdk
.
get
().
toInt
()
...
@@ -43,3 +70,118 @@ android {
...
@@ -43,3 +70,118 @@ android {
minSdk
=
libs
.
versions
.
android
.
minSdk
.
get
().
toInt
()
minSdk
=
libs
.
versions
.
android
.
minSdk
.
get
().
toInt
()
}
}
}
}
// commonizer 只认识官方 Konan 目标,不认识 ohos_x64/ohos_arm64,任务可能延迟注册,故在 afterEvaluate 中禁用
// IDE 的 ohosMain 依赖解析会读取 commonizedNativeDistributionLocation.txt,必须在配置阶段就创建,否则 prepareKotlinIdeaImport 报 FileNotFoundException
val
commonizedDir
=
file
(
"build/kotlin"
)
commonizedDir
.
mkdirs
()
File
(
commonizedDir
,
"commonizedNativeDistributionLocation.txt"
).
writeText
(
commonizedDir
.
absolutePath
)
afterEvaluate
{
listOf
(
"commonizeNativeDistribution"
,
"commonizeCInterop"
).
forEach
{
taskName
->
tasks
.
findByName
(
taskName
)
?.
let
{
it
.
enabled
=
false
}
}
}
android
{
namespace
=
"com.eazytec.kmpdemo.shared"
compileSdk
=
libs
.
versions
.
android
.
compileSdk
.
get
().
toInt
()
compileOptions
{
sourceCompatibility
=
JavaVersion
.
VERSION_11
targetCompatibility
=
JavaVersion
.
VERSION_11
}
defaultConfig
{
minSdk
=
libs
.
versions
.
android
.
minSdk
.
get
().
toInt
()
}
}
// 使用 Konan 自带的 OHOS LLVM 工具链(用于交叉编译静态库),根据主机平台自动选择
val
konanDepsDir
:
File
=
file
(
System
.
getProperty
(
"user.home"
)
+
"/.konan/dependencies"
)
val
isWindows
=
System
.
getProperty
(
"os.name"
).
lowercase
().
contains
(
"win"
)
val
execExt
=
if
(
isWindows
)
".exe"
else
""
val
konanOhosLlvmBin
:
File
?
by
lazy
{
val
osArch
=
System
.
getProperty
(
"os.arch"
)
val
osName
=
System
.
getProperty
(
"os.name"
).
lowercase
()
val
toolchain
=
when
{
osName
.
contains
(
"mac"
)
&&
osArch
==
"aarch64"
->
"llvm-19.1.7-aarch64-macos-ohos-2"
osName
.
contains
(
"mac"
)
->
"llvm-19.1.7-x64-macos-ohos-2"
osName
.
contains
(
"linux"
)
->
"llvm-19.1.7-x64-linux-ohos-2"
osName
.
contains
(
"win"
)
->
"llvm-19.1.7-x64-mingw-ohos-2"
else
->
null
}
toolchain
?.
let
{
konanDepsDir
.
resolve
(
"$it/bin"
).
takeIf
{
dir
->
dir
.
isDirectory
}
}
}
val
ohosSysrootArm64
:
File
?
by
lazy
{
listOf
(
"sysroot-ohos-aarch64-6.0.2.640-02"
,
"sysroot-ohos-aarch64-6.0.0.858-02"
)
.
map
{
konanDepsDir
.
resolve
(
it
)
}.
firstOrNull
{
it
.
isDirectory
}
}
val
ohosSysrootX64
:
File
?
by
lazy
{
listOf
(
"sysroot-ohos-x86_64-6.0.0.858-02"
)
.
map
{
konanDepsDir
.
resolve
(
it
)
}.
firstOrNull
{
it
.
isDirectory
}
}
// Harmony App 输出目录(支持命令行 --harmonyAppPath)
val
harmonyAppDir
:
File
=
run
{
val
cliPath
=
project
.
findProperty
(
"harmonyAppPath"
)
as
String
?
if
(
cliPath
.
isNullOrBlank
())
{
// 默认:项目根目录 /harmonyApp
rootProject
.
file
(
"harmonyApp"
)
}
else
{
// 命令行传入的路径
file
(
cliPath
)
}
}
// 字符串首字母大写工具函数
fun
String
.
capitalizeUS
():
String
=
this
.
replaceFirstChar
{
if
(
it
.
isLowerCase
())
it
.
titlecase
()
else
it
.
toString
()
}
// 为不同类型(debug、release)OHOS构建注册Copy任务并发布到Harmony App目录
arrayOf
(
"debug"
,
"release"
).
forEach
{
type
->
tasks
.
register
<
Copy
>(
"publish${type.capitalizeUS()}BinariesToHarmonyApp"
)
{
group
=
"harmony"
// 归类到harmony任务组
dependsOn
(
"link${type.capitalizeUS()}SharedOhosArm64"
)
// 依赖于OHOS shared lib的链接任务
into
(
harmonyAppDir
)
// 输出目标目录
from
(
"build/bin/ohosArm64/${type}Shared/libkn_api.h"
)
{
// 复制头文件
into
(
"entry/src/main/cpp/include/"
)
// 指定目录
}
from
(
project
.
file
(
"build/bin/ohosArm64/${type}Shared/libkn.so"
))
{
// 复制共享库文件
into
(
"/entry/libs/arm64-v8a/"
)
// 指定目标目录
}
}
}
// 发布 ohosX64 产物到 harmonyapp,供模拟器(x86_64)使用
arrayOf
(
"debug"
,
"release"
).
forEach
{
type
->
val
capitalizedType
=
type
.
replaceFirstChar
{
it
.
uppercase
()
}
tasks
.
register
<
Copy
>(
"publish${capitalizedType}BinariesToHarmonyAppX64"
)
{
group
=
"harmony"
description
=
"Publish ohosX64 libkn.so to harmonyapp/entry/libs/x86_64 for emulator"
dependsOn
(
"link${capitalizedType}SharedOhosX64"
)
into
(
rootProject
.
file
(
"harmonyapp"
))
val
binaryPath
=
"build/bin/ohosX64/${type}Shared"
from
(
"$binaryPath/libkn_api.h"
)
{
into
(
"entry/src/main/cpp/include/"
)
}
from
(
"$binaryPath/libkn.so"
)
{
into
(
"entry/libs/x86_64/"
)
}
from
(
"native-libs/ohosX64/libsample.a"
)
{
into
(
"entry/src/main/cpp/libs/"
)
}
doFirst
{
if
(!
file
(
binaryPath
).
exists
())
{
throw
GradleException
(
"未找到产物目录: $binaryPath"
)
}
}
}
}
shared/src/androidMain/kotlin/com/dong/nocomposedemo/TestLog.android.kt
0 → 100644
View file @
4ae287cc
package
com.dong.nocomposedemo
actual
fun
pirntSingleHiLog
()
{
}
actual
fun
pirntAllLevelHiLog
()
{
}
actual
fun
pirntRandomHiLog
()
{
}
actual
fun
FaultOut
()
{
}
\ No newline at end of file
shared/src/commonMain/kotlin/com/dong/nocomposedemo/TestLog.kt
0 → 100644
View file @
4ae287cc
package
com.dong.nocomposedemo
//打印所有层级日志
expect
fun
pirntAllLevelHiLog
();
//单次打印日志
expect
fun
pirntSingleHiLog
();
//触发崩溃
expect
fun
FaultOut
();
//随机打印日志
expect
fun
pirntRandomHiLog
();
\ No newline at end of file
shared/src/iosArm64Main/kotlin/com/dong/nocomposedemo/TestLog.iosArm64.kt
0 → 100644
View file @
4ae287cc
package
com.dong.nocomposedemo
actual
fun
pirntSingleHiLog
()
{
}
actual
fun
pirntAllLevelHiLog
()
{
}
actual
fun
pirntRandomHiLog
()
{
}
actual
fun
FaultOut
()
{
}
\ No newline at end of file
shared/src/iosMain/kotlin/com/dong/nocomposedemo/Platform.ios.kt
View file @
4ae287cc
...
@@ -6,4 +6,12 @@ class IOSPlatform: Platform {
...
@@ -6,4 +6,12 @@ class IOSPlatform: Platform {
override
val
name
:
String
=
UIDevice
.
currentDevice
.
systemName
()
+
" "
+
UIDevice
.
currentDevice
.
systemVersion
override
val
name
:
String
=
UIDevice
.
currentDevice
.
systemName
()
+
" "
+
UIDevice
.
currentDevice
.
systemVersion
}
}
actual
fun
getPlatform
():
Platform
=
IOSPlatform
()
actual
fun
getPlatform
():
Platform
=
IOSPlatform
()
\ No newline at end of file
actual
fun
pirntAllLevelHiLog
()
{
println
(
"[iOS] All Level Hi Log"
)
}
actual
fun
pirntSingleHiLog
()
{
println
(
"[iOS] Single Hi Log"
)
}
\ No newline at end of file
shared/src/iosSimulatorArm64Main/kotlin/com/dong/nocomposedemo/TestLog.iosSimulatorArm64.kt
0 → 100644
View file @
4ae287cc
package
com.dong.nocomposedemo
actual
fun
pirntSingleHiLog
()
{
}
actual
fun
pirntAllLevelHiLog
()
{
}
actual
fun
FaultOut
()
{
}
actual
fun
pirntRandomHiLog
()
{
}
\ No newline at end of file
shared/src/ohosArm64Main/kotlin/com/dong/nocomposedemo/Platform.ohosArm64.kt
0 → 100644
View file @
4ae287cc
package
com.dong.nocomposedemo
class
OhosPlatform
:
Platform
{
override
val
name
:
String
=
"1"
}
actual
fun
getPlatform
():
Platform
{
return
OhosPlatform
()
}
\ No newline at end of file
shared/src/ohosArm64Main/kotlin/com/dong/nocomposedemo/TestLog.ohosArm64.kt
0 → 100644
View file @
4ae287cc
package
com.dong.nocomposedemo
import
platform.PerformanceAnalysisKit.HiLog.OH_LOG_PrintMsg
import
kotlin.experimental.ExperimentalNativeApi
@OptIn
(
kotlinx
.
cinterop
.
ExperimentalForeignApi
::
class
,
kotlin
.
experimental
.
ExperimentalNativeApi
::
class
)
@CName
(
"hiLogPrintMsg"
)
fun
hiLogPrintMsg
(
type
:
UInt
,
level
:
UInt
,
domain
:
UInt
,
tag
:
String
,
message
:
String
):
Int
{
return
try
{
OH_LOG_PrintMsg
(
type
,
level
,
domain
,
tag
,
message
)
}
catch
(
_
:
Throwable
)
{
-
1
}
}
@OptIn
(
ExperimentalNativeApi
::
class
)
@CName
(
"pirntSingleHiLog"
)
actual
fun
pirntSingleHiLog
(){
OH_LOG_PrintMsg
(
0
u
,
3
u
,
4660
u
,
"TestTag"
,
"单次日志打印"
);
}
@OptIn
(
ExperimentalNativeApi
::
class
)
@CName
(
"pirntAllLevelHiLog"
)
actual
fun
pirntAllLevelHiLog
(){
// 输出 DEBUG 级别
// LOG_APP = 0 (应用日志类型)
// LOG_DEBUG = 3 (调试级别)
// domain = 0x1234 (任意自定义值,范围0x0000-0xFFFF)
// tag = "TestTag" (自定义标签)
OH_LOG_PrintMsg
(
0
u
,
3
u
,
4660
u
,
"TestTag"
,
"This is a DEBUG log from PrintMsg"
);
// 输出 INFO 级别
// LOG_INFO = 4 (信息级别)
OH_LOG_PrintMsg
(
0
u
,
4
u
,
4660
u
,
"TestTag"
,
"This is an INFO log from PrintMsg"
);
// 输出 WARN 级别
// LOG_WARN = 5 (警告级别)
OH_LOG_PrintMsg
(
0
u
,
5
u
,
4660
u
,
"TestTag"
,
"This is a WARN log from PrintMsg"
);
// 输出 ERROR 级别
// LOG_ERROR = 6 (错误级别)
OH_LOG_PrintMsg
(
0
u
,
6
u
,
4660
u
,
"TestTag"
,
"This is an ERROR log from PrintMsg"
);
// 输出 FATAL 级别
// LOG_FATAL = 7 (致命级别)
OH_LOG_PrintMsg
(
0
u
,
7
u
,
4660
u
,
"TestTag"
,
"This is a FATAL log from PrintMsg"
);
}
@OptIn
(
ExperimentalNativeApi
::
class
)
@CName
(
"pirntRandomHiLog"
)
actual
fun
pirntRandomHiLog
()
{
}
actual
fun
FaultOut
()
{
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment