OpenHarmony笔记
FAQ:1、hdc push so一直提示只读?hdc shell进去后输入 mount -o rw,remount / 然后退出再传试试
FAQ:
1、hdc push so一直提示只读?
hdc shell进去后输入 mount -o rw,remount / 然后退出再传试试
2、hap包push到手机不生效?
file send 不会替换原来已经存在的hap包,手动先删掉设备中的hap包试试 -- 20210908
3、DevEco里面config.json修改后不生效?
config.json里面改了以后,直接构建的hap没有更新,先clean一下再构建试试
4、修改so步骤举例
1)编译:
./build.sh --product-name Hi3516DV300 --build-target notification
2)cp out/ohos-arm-release/notification/ans_standard//libnotification.z.so ~/hgfs/
3)CMD窗口:
hdc shell "mount -o rw,remount /"
hdc file send D:\renchunyang\vmwareShare\libnotification.z.so /system/lib/module/libnotification.z.so
hdc shell "reboot"
5、重新安装应用举例:
hdc shell "bm uninstall -n ohos.samples.jshelloworld"
hdc shell "mount -o rw,remount /"
hdc file send D:\renchunyang\workspace\devEco\JsHelloWorld\entry\build\outputs\hap\debug\entry-debug-standard-signed.hap /derek.hap
hdc shell "chmod 666 /derek.hap"
hdc shell "bm install -p /derek.hap"
#########################
应用2:
hdc shell "bm uninstall -n com.example.myapplication"
hdc shell "mount -o rw,remount /"
hdc file send D:\renchunyang\workspace\devEco\MyApplication2\entry\build\outputs\hap\debug\entry-debug-standard-ark-signed.hap /application2.hap
hdc shell "chmod 666 /application2.hap"
hdc shell "bm install -p /application2.hap"
#########################
7、关键字
grep ": public SystemAbility" -nr *
timer_service_client.h
time_service_test.cpp
8、其他
******************************RK3518 begin****************************************
./build.sh --product-name rk3568 --ccache
./build.sh --product-name rk3568 --ccache
./build.sh --product-name rk3568 --build-target libans
./build.sh --product-name rk3568 --build-target reminderagent
./build.sh --product-name rk3568 --build-target ans_innerkits
hdc file send \\wsl$\Ubuntu-20.04\home\derek\master\out\rk3568\notification\ans_standard\libans_core.z.so /system/lib/libans_core.z.so
hdc file send \\wsl$\Ubuntu-20.04\home\derek\master\out\rk3568\notification\ans_standard\libans.z.so /system/lib/libans.z.so
hdc file send \\wsl$\Ubuntu-20.04\home\derek\master\out\rk3568\notification\ans_standard\libreminderagent.z.so /system/lib/module/libreminderagent.z.so
hdc file send \\wsl$\Ubuntu-20.04\home\derek\master\out\rk3568\notification\ans_standard\libans_innerkits.z.so /system/lib/libans_innerkits.z.so
hdc file recv /system/lib/libans_core.z.so D:\renchunyang\software\rk3568\images\
hdc file recv /system/lib/libans_innerkits.z.so D:\renchunyang\software\rk3568\images\
hdc file recv /system/lib/libans.z.so D:\renchunyang\software\rk3568\images\
2022-04-11:(全局资源调度)
hdc shell "mount -o rw,remount /"
hdc file send \\wsl$\Ubuntu-20.04\home\derek\master_test\master_tmp\out\rk3568\resourceschedule\dev_scheduler\libdevsched_native.z.so /system/lib/libdevsched_native.z.so
hdc file send \\wsl$\Ubuntu-20.04\home\derek\master_test\master_tmp\out\rk3568\resourceschedule\dev_scheduler\libdevsched_core.z.so /system/lib/libdevsched_core.z.so
hdc file send \\wsl$\Ubuntu-20.04\home\derek\master_test\master_tmp\out\rk3568\resourceschedule\dev_scheduler\libdevschedservice.z.so /system/lib/libdevschedservice.z.so
hdc shell "reboot"
******************************RK3518 end****************************************
1、(notification_helper.cpp)
./build.sh --product-name Hi3516DV300 --build-target ans_core
hdc file send \\wsl$\Ubuntu-20.04\home\derek\master\out\hi3516dv300\notification\ans_standard\libans_core.z.so /system/lib/libans_core.z.so
2、(notification_helper.cpp依赖ans_core)
./build.sh --product-name Hi3516DV300 --build-target ans_innerkits
hdc file send \\wsl$\Ubuntu-20.04\home\derek\master\out\hi3516dv300\notification\ans_standard\libans_innerkits.z.so /system/lib/libans_innerkits.z.so
3、(advanced_notification_service.cpp 依赖ans_innerkits,ans_core)
./build.sh --product-name Hi3516DV300 --build-target libans
hdc file send \\wsl$\Ubuntu-20.04\home\derek\master\out\hi3516dv300\notification\ans_standard\libans.z.so /system/lib/libans.z.so
4、(reminderAgent)
./build.sh --product-name Hi3516DV300 --build-target reminderagent
hdc file send \\wsl$\Ubuntu-20.04\home\derek\master\out\hi3516dv300\notification\ans_standard\libreminderagent.z.so /system/lib/module/libreminderagent.z.so
5、TDD用例
./build.sh --product-name Hi3516DV300 --build-target ans_reminder_unit_test
copy \\wsl$\Ubuntu-20.04\home\derek\master\out\hi3516dv300\tests\unittest\ans_reminder\unittest\ans_reminder_unit_test D:\renchunyang\document\tddTest\Test\testcase\unittest\ans_reminder\unittest\ans_reminder_unit_test
cd D:\renchunyang\document\tddTest\Test\developertest
start.bat
run -t UT -s ans_reminder_unit_test
copy \\wsl$\Ubuntu-20.04\home\derek\master\out\rk3568\tests\unittest\ans_standard\moduletest\ReminderAgentJsTest.hap D:\renchunyang\document\tddTest\Test\testcase\unittest\ans_standard\moduletest\ReminderAgentJsTest.hap
6、(want_agent_helper.cpp)
./build.sh --product-name Hi3516DV300 --build-target wantagent_innerkits
cp out/ohos-arm-release/notification/ans_standard//libwantagent_innerkits.z.so ~/hgfs/
hdc file send D:\renchunyang\vmwareShare\libwantagent_innerkits.z.so /system/lib/libwantagent_innerkits.z.so
7、(pending_want_record.cpp)
./build.sh --product-name Hi3516DV300 --build-target abilityms
cp out/ohos-arm-release/aafwk/aafwk_standard/libabilityms.z.so ~/hgfs/
hdc file send D:\renchunyang\vmwareShare\libabilityms.z.so /system/lib/libabilityms.z.so
=============================================================================================================================================================
备份:
hdc file recv /system/lib/libans_core.z.so d:\\renchunyang\document\images\1201\
hdc file recv /system/lib/libans_innerkits.z.so d:\\renchunyang\document\images\1201\
hdc file recv /system/lib/libans.z.so d:\\renchunyang\document\images\1201\
=============================================================================================================================================================
全部替换:
hdc file send D:\renchunyang\vmwareShare\libans_core.z.so /system/lib/libans_core.z.so
hdc file send D:\renchunyang\vmwareShare\libans_innerkits.z.so /system/lib/libans_innerkits.z.so
hdc file send D:\renchunyang\vmwareShare\libans.z.so /system/lib/libans.z.so
hdc file send D:\renchunyang\vmwareShare\libnotification.z.so /system/lib/module/libnotification.z.so
=============================================================================================================================================================
还原:
hdc shell "rm /system/lib/libans_innerkits.z.so"
hdc shell "rm /system/lib/libans_core.z.so"
hdc shell "rm /system/lib/libans.z.so"
hdc shell "rm /system/lib/module/libnotification.z.so"
hdc file send D:\renchunyang\software\hdc\hdc\libans_innerkits.z.so /system/lib/libans_innerkits.z.so
hdc file send D:\renchunyang\software\hdc\hdc\libans_core.z.so /system/lib/libans_core.z.so
hdc file send D:\renchunyang\software\hdc\hdc\libans.z.so /system/lib/libans.z.so
hdc file send D:\renchunyang\software\hdc\hdc\libnotification.z.so /system/lib/module/libnotification.z.so
=============================================================================================================================================================
hdc shell "mount -o rw,remount /"
hdc shell "reboot"
sudo apt-get install genext2fs
sudo apt-get install liblz4-tool
sudo apt-get install libssl-dev
sudo apt-get install unix2dos
截屏:hdc shell snapshot_display
rk亮屏:power-shell wakeup
打开日志落盘:hilog -w start (重启)
打开多线程检测:param set persist.ark.properties 0x3c (重启设备后,需要重新设置)
derek@DESKTOP-4S51GLG:~/tmp$ addr2line -Cfie libreminderagent.z.so
0000000000047bbe
查看so依赖:readelf -a ./out/release/xx.so |grep NEEDED
===================近期使用============================
hdc shell "mount -o rw,remount /"
hdc file send \\wsl$\Ubuntu-20.04\home\derek\master\master\out\rk3568\notification\ans_standard\libans_core.z.so /system/lib/libans_core.z.so
hdc file send \\wsl$\Ubuntu-20.04\home\derek\master\master\out\rk3568\notification\ans_standard\libans.z.so /system/lib/libans.z.so
hdc file send \\wsl$\Ubuntu-20.04\home\derek\master\master\out\rk3568\notification\ans_standard\libreminderagent.z.so /system/lib/module/libreminderagent.z.so
hdc file send \\wsl$\Ubuntu-20.04\home\derek\master\master\out\rk3568\notification\ans_standard\libans_innerkits.z.so /system/lib/libans_innerkits.z.so
hdc shell "reboot"
hdc file recv /data/user/0/reminder
hdc file send \\wsl$\Ubuntu-20.04\home\derek\master\master\out\rk3568\notification\ans_standard\libwantagent_innerkits.z.so /system/lib/libwantagent_innerkits.z.so
hdc file send \\wsl$\Ubuntu-20.04\home\derek\master\master\out\rk3568\aafwk\ability_runtime\libabilityms.z.so /system/lib/libabilityms.z.so
hdc shell "aa start -b ohos.samples.jshelloworld -a ohos.samples.jshelloworld.MainAbility"
hdc file recv /data/user/0/reminder/reminder.db .
hdc file recv /data/user/0/reminder/reminder.db-shm .
hdc file recv /data/user/0/reminder/reminder.db-wal .
hdc file recv /data/log/hilog/hilog.0.gz .
hdc file recv /data/log/hilog/hilog.1.gz .
hdc file recv /data/log/hilog/hilog.2.gz .
hdc file recv /data/log/hilog/hilog.3.gz .
hdc file recv /data/log/hilog/hilog.4.gz .
hdc file recv /data/log/hilog/hilog.5.gz .
hdc file recv /data/log/hilog/hilog.6.gz .
hdc file recv /data/log/hilog/hilog.7.gz .
hdc file recv /data/log/hilog/hilog.8.gz .
hdc file recv /data/log/hilog/hilog.9.gz .
hdc shell "mount -o rw,remount /"
hdc file send D:\temp\xinyu\entry-debug-standard-ark-signed.hap /xinyu.hap
hdc shell "chmod 666 /xinyu.hap"
hdc shell "bm install -p /xinyu.hap"
hdc shell "aa start -b ohos.samples.jshelloworld -a ohos.samples.jshelloworld.MainAbility"
- 日志打印不全时,通过创建文件来调试:
#include <iostream>
#include <fstream>
#include <streambuf>
void ReminderDataManager::CreateFile(const std::string &path, const std::string &content) const
{
ANSR_LOGD("Path=%{public}s", path.c_str());
std::ofstream stream(path.c_str());
if (!stream.is_open()) {
ANSR_LOGE("Can not create file");
return;
}
stream << content.c_str() << std::endl;
stream.close();
return;
}
#include <fstream>
#include <iostream>
std::string result
= std::to_string(data->resType) + ", " + std::to_string(data->value) + "," + data->payload.toStyledString();
WriteToFile(result);
void DevSchedPlugin::WriteToFile(std::string &result) const
{
std::ofstream fout;
std::string realPath = "/data/service/el1/public/dev_sched_test";
fout.open(realPath, std::ios::app);
fout<<result.c_str()<<std::endl;
fout.close();
}
hdc shell "hilog -b X" // 关闭所有子系统的日志
// 打开指定TAG的日志,多次输入不同的值可以指定多个
hdc shell "hilog -b D -D 0xD001700"
hdc shell "hilog -b D -T RSS"
如果想重启也生效,需要修改/etc/param/hilog.para文件:
hilog.loggable.global=X --> 改为X
hilog.loggable.domain.d001700=D --> 指定需要打开的域
hilog.loggable.tag.RSS=D --> 指定需要打开的tag
更多推荐
所有评论(0)