我尝试使用此链接实现自定义 HAL、API 和系统服务 https://github.com/nayobix/add-new-hardware-hal-android-5-lollipop (还检查了其他几个)
我按照每条指令和代码制作了 system.img。
我正在使用 Android 5.1.1 源代码构建系统镜像。
但是当我在 Android Studio 中检查 logcat 时,设备没有启动。我发现系统服务没有加载。
08-09 11:32:27.123 160-160/? I/DEBUG: Abort message: 'art/runtime/jni_internal.cc:769] JNI FatalError called: Native registration unable to find class 'com/android/server/ZigbeeService'; aborting...'
08-09 11:32:27.123 160-160/? I/DEBUG: #09 pc 000174bd /system/lib/libandroid_servers.so (JNI_OnLoad+172)
08-09 11:32:27.336 20208-20208/? E/Zygote: Exit zygote because system server (20435) has terminated
同样在编译时,我收到了一些警告。
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
最佳答案
解决了。必须从头开始,重建和编译整个源代码。
github 有点不正确。实际上我必须创建另一个文件夹来放置服务 java 类文件。这就是 android 找不到它的原因(根据调试消息)。
当你盲目跟随别人的工作时就会发生。感谢大家的帮助。
关于android - 在android中创建系统服务,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38851854/