N上预置APK失败提示找不到so文件

[DESCRIPTION]
预置APK到系统之后打开APK会提示:
01-01 12:00:39.537 5326 5326 E AndroidRuntime: Process: com.skype.raider, PID: 5326
01-01 12:00:39.537 5326 5326 E AndroidRuntime: java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathListlib] couldn’t find “libSkypeAndroid.so”
01-01 12:00:39.537 5326 5326 E AndroidRuntime: at java.lang.Runtime.loadLibrary0(Runtime.java:972)
01-01 12:00:39.537 5326 5326 E AndroidRuntime: at java.lang.System.loadLibrary(System.java:1530)
01-01 12:00:39.537 5326 5326 E AndroidRuntime: at com.skype.android.util.CrashAndAnrHandler.(SourceFile:19)
01-01 12:00:39.537 5326 5326 E AndroidRuntime: at com.skype.android.util.CrashAndAnrHandler.saveHandlers(Native Method)
01-01 12:00:39.537 5326 5326 E AndroidRuntime: at com.skype.android.skylib.SkyLibInitializer.a(SourceFile:115)
01-01 12:00:39.537 5326 5326 E AndroidRuntime: at com.skype.android.SkypeModule.a(SourceFile:126)
01-01 12:00:39.537 5326 5326 E AndroidRuntime: at com.skype.android.SkypeModule_SkyLibFactory.get(SourceFile:37)
01-01 12:00:39.537 5326 5326 E AndroidRuntime: at com.skype.android.SkypeModule_SkyLibFactory.get(SourceFile:11)
01-01 12:00:39.537 5326 5326 E AndroidRuntime: at dagger.internal.d.get(SourceFile:47)
01-01 12:00:39.537 5326 5326 E AndroidRuntime: at com.skype.android.app.BackgroundMode_Factory.get(SourceFile:72)
01-01 12:00:39.537 5326 5326 E AndroidRuntime: at com.skype.android.app.BackgroundMode_Factory.get(SourceFile:16)
01-01 12:00:39.537 5326 5326 E AndroidRuntime: at dagger.internal.d.get(SourceFile:47)
01-01 12:00:39.537 5326 5326 E AndroidRuntime: at com.skype.android.wakeup.DreamKeeper_Factory.get(SourceFile:48)
01-01 12:00:39.537 5326 5326 E AndroidRuntime: at com.skype.android.wakeup.DreamKeeper_Factory.get(SourceFile:12)
01-01 12:00:39.537 5326 5326 E AndroidRuntime: at dagger.internal.d.get(SourceFile:47)
01-01 12:00:39.537 5326 5326 E AndroidRuntime: at com.skype.android.wakeup.ForegroundObserver_Factory.get(SourceFile:34)
01-01 12:00:39.537 5326 5326 E AndroidRuntime: at com.skype.android.wakeup.ForegroundObserver_Factory.get(SourceFile:8)
01-01 12:00:39.537 5326 5326 E AndroidRuntime: at dagger.internal.d.get(SourceFile:47)
01-01 12:00:39.537 5326 5326 E AndroidRuntime: at com.skype.android.SkypeApplication_MembersInjector.injectMembers(SourceFile:160)
01-01 12:00:39.537 5326 5326 E AndroidRuntime: at com.skype.android.SkypeApplication_MembersInjector.injectMembers(SourceFile:24)
01-01 12:00:39.537 5326 5326 E AndroidRuntime: at com.skype.android.DaggerSkypeApplicationComponent.inject(SourceFile:2266)
01-01 12:00:39.537 5326 5326 E AndroidRuntime: at com.skype.android.SkypeApplication.onCreate(SourceFile:152)
01-01 12:00:39.537 5326 5326 E AndroidRuntime: at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1027)
01-01 12:00:39.537 5326 5326 E AndroidRuntime: at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5503)
01-01 12:00:39.537 5326 5326 E AndroidRuntime: at android.app.ActivityThread.-wrap2(ActivityThread.java)
01-01 12:00:39.537 5326 5326 E AndroidRuntime: at android.app.ActivityThread H . h a n d l e M e s s a g e ( A c t i v i t y T h r e a d . j a v a : 1595 ) 01 − 0112 : 00 : 39.53753265326 E A n d r o i d R u n t i m e : a t a n d r o i d . o s . H a n d l e r . d i s p a t c h M e s s a g e ( H a n d l e r . j a v a : 110 ) 01 − 0112 : 00 : 39.53753265326 E A n d r o i d R u n t i m e : a t a n d r o i d . o s . L o o p e r . l o o p ( L o o p e r . j a v a : 203 ) 01 − 0112 : 00 : 39.53753265326 E A n d r o i d R u n t i m e : a t a n d r o i d . a p p . A c t i v i t y T h r e a d . m a i n ( A c t i v i t y T h r e a d . j a v a : 6251 ) 01 − 0112 : 00 : 39.53753265326 E A n d r o i d R u n t i m e : a t j a v a . l a n g . r e f l e c t . M e t h o d . i n v o k e ( N a t i v e M e t h o d ) 01 − 0112 : 00 : 39.53753265326 E A n d r o i d R u n t i m e : a t c o m . a n d r o i d . i n t e r n a l . o s . Z y g o t e I n i t H.handleMessage(ActivityThread.java:1595) 01-01 12:00:39.537 5326 5326 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:110) 01-01 12:00:39.537 5326 5326 E AndroidRuntime: at android.os.Looper.loop(Looper.java:203) 01-01 12:00:39.537 5326 5326 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:6251) 01-01 12:00:39.537 5326 5326 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method) 01-01 12:00:39.537 5326 5326 E AndroidRuntime: at com.android.internal.os.ZygoteInit H.handleMessage(ActivityThread.java:1595)010112:00:39.53753265326EAndroidRuntime:atandroid.os.Handler.dispatchMessage(Handler.java:110)010112:00:39.53753265326EAndroidRuntime:atandroid.os.Looper.loop(Looper.java:203)010112:00:39.53753265326EAndroidRuntime:atandroid.app.ActivityThread.main(ActivityThread.java:6251)010112:00:39.53753265326EAndroidRuntime:atjava.lang.reflect.Method.invoke(NativeMethod)010112:00:39.53753265326EAndroidRuntime:atcom.android.internal.os.ZygoteInitMethodAndArgsCaller.run(ZygoteInit.java:1063)
01-01 12:00:39.537 5326 5326 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:924)
01-01 12:00:39.537 5326 5326 E AndroidRuntime: FATAL EXCEPTION: main

[SOLUTION]
这是因为Google在N上对selinux有更严格的限制,APK的so文件被selinux挡住了:
01-01 12:00:39.520000 5326 5326 W om.skype.raider: type=1400 audit(0.0:64): avc: denied { read } for name=“libSkypeAndroid.so” dev=“mmcblk0p22” ino=770074 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:object_r:system_data_file:s0 tclass=file permissive=0

参考如下的solution:
Add the policy to alps/device/mediatek/common|[platfrom]/sepolicy/basic|bsp|full/xxx.te
#====================== untrusted_app.te ======================
allow untrusted_app system_data_file:file r_file_perms;

你可能感兴趣的:(Android)