HarmonyOS 鸿蒙Next 多Module开始出现地址无法引用
HarmonyOS 鸿蒙Next 多Module开始出现地址无法引用
我将项目划分为多个module(Share Library),然后其中将一个打印日志类放置BaseLib中,其他Module去引用此类,出现如下异常,已在引用处的module进行依赖添加
Error message:cannot find record ‘com.hohem.h_hohemjoy/HohemBaseLib/ets/utils/LoggerJoy’, please check the request path.’/data/storage/el1/bundle/HohemBaseLib/ets/modules.abc’.
外部引用处的调用用例:import { LoggerJoy } from ‘hohembase/src/main/ets/utils/LoggerJoy’;
LoggerJoy类如下
import hilog from '@ohos.hilog';
export class LoggerJoy {
private static domain: number = 0xFF00;
private static prefix: string = '[HohemJoy Logger]';
private static format: string = '%{public}s';
static debug(...args: string[]): void {
hilog.debug(LoggerJoy.domain, LoggerJoy.prefix, LoggerJoy.format, args);
}
static info(...args: string[]): void {
hilog.info(LoggerJoy.domain, LoggerJoy.prefix, LoggerJoy.format, args);
}
static warn(...args: string[]): void {
hilog.warn(LoggerJoy.domain, LoggerJoy.prefix, LoggerJoy.format, args);
}
static error(...args: string[]): void {
hilog.error(LoggerJoy.domain, LoggerJoy.prefix, LoggerJoy.format, args);
}
}
更多关于HarmonyOS 鸿蒙Next 多Module开始出现地址无法引用的实战系列教程也可以访问 https://www.itying.com/category-93-b0.html