关于调试指纹时候遇到的其他问题
1.SELinux
android 8.0 SELinux 发生了比较大的变化,目前SELinux 编译出来,会生成在两个目录:
1.system/etc/sepolicy
2.vendor/etc/sepolicy
编译SELinux 不能像以前那样只编译bootimage.目前编译bootimage 是生成不了Selinux 文件的,
暂时只能想到全部编译的方法。
检验SeLinux 是否编译到的办法:
1.android 8.0之前,可以看下这out/project/obj/sepolicy_interdaiates/policy.conf这个文件里面有没有
自己书写的selinux 规则
2.android 8.0之后,看下system/etc/sepolicy或者vendor/etc/sepolicy 有没有自己书写的selinux 规则
2.从源码中关闭SELinux安全策略
代码位置:/system/core/init/init.cpp
修改selinux_is_enforcing() 函数为下面
static bool selinux_is_enforcing(void){
return false; //force set selinux permissive.
if (ALLOW_PERMISSIVE_SELINUX) {
return selinux_status_from_cmdline() == SELINUX_ENFORCING;
}
return true;
}
3.app加载jni编译出来的.so报错问题
如果你app是在系统编译,然后你install安装的,很容易出现此问题
1.报错大概具体如下:
java.lang.UnsatisfiedLinkError: dlopen failed: library "xx.so"
("/system/lib/xx.so") needed or dlopened by
"/system/lib/libnativeloader.so" is not accessible for the namespace
"classloader-namespace"at java.lang.Runtime.loadLibrary0(Runtime.java:977)
at java.lang.System.loadLibrary(System.java:1602)
原因:android 7.0,发生一些行为变更,app不能调用系统的私有.so 文件。只能调用系统的公有.so
解决方案:
把自己jni生成的.so 放在/system/etc/public.libraries.txt 或者/vendor/etc/public.libraries.txt中去。
然后把public.libraries.txt push 进去