Android9.0 java.lang.UnsatisfiedLinkError:No implementation found
程序员文章站
2022-07-08 12:31:28
Android9.0 java.lang.UnsatisfiedLinkError:No implementation found收集报错信息第一次刷机可用,后面安装不可用?解决安装不能用收集报错信息第一次刷机可用,后面安装不可用?解决安装不能用1.在android9.0使用so库是报错,查看错误信息。09-28 03:30:16.654 5196 5196 E app.mediaplaye: No implementation found for void com.droidlogic.a...
Android9.0 java.lang.UnsatisfiedLinkError:No implementation found
1.收集错误信息
在android9.0使用so库是报错,查看错误信息。
09-28 03:30:16.654 5196 5196 E app.mediaplaye: No implementation found for void com.droidlogic.app.SurfaceOverlay.nativeSetSurface(android.view.Surface) (tried Java_com_droidlogic_app_SurfaceOverlay_nativeSetSurface and Java_com_droidlogic_app_SurfaceOverlay_nativeSetSurface__Landroid_view_Surface_2)
09-28 03:30:16.654 5196 5196 D AndroidRuntime: Shutting down VM
09-28 03:30:16.657 3625 4151 D ActivityManager: Raise procstate to external provider: ProcessRecord{1ee2561 4610:com.wistar.provider/u0a23}
--------- beginning of crash
09-28 03:30:16.661 5196 5196 E AndroidRuntime: FATAL EXCEPTION: main
09-28 03:30:16.661 5196 5196 E AndroidRuntime: Process: com.wistar.app.mediaplayer, PID: 5196
09-28 03:30:16.661 5196 5196 E AndroidRuntime: java.lang.UnsatisfiedLinkError: No implementation found for void com.droidlogic.app.SurfaceOverlay.nativeSetSurface(android.view.Surface) (tried Java_com_droidlogic_app_SurfaceOverlay_nativeSetSurface and Java_com_droidlogic_app_SurfaceOverlay_nativeSetSurface__Landroid_view_Surface_2)
09-28 03:30:16.661 5196 5196 E AndroidRuntime: at com.droidlogic.app.SurfaceOverlay.nativeSetSurface(Native Method)
09-28 03:30:16.661 5196 5196 E AndroidRuntime: at com.droidlogic.app.SurfaceOverlay.setDisplay(SurfaceOverlay.java:37)
09-28 03:30:16.661 5196 5196 E AndroidRuntime: at com.droidlogic.app.ImagePlayerManager.setDisplay(ImagePlayerManager.java:481)
09-28 03:30:16.661 5196 5196 E AndroidRuntime: at com.wistar.app.mediaplayer.MediaplayerActivity$3.surfaceCreated(MediaplayerActivity.java:121)
09-28 03:30:16.661 5196 5196 E AndroidRuntime: at android.view.SurfaceView.updateSurface(SurfaceView.java:671)
09-28 03:30:16.661 5196 5196 E AndroidRuntime: at android.view.SurfaceView$2.onPreDraw(SurfaceView.java:143)
09-28 03:30:16.661 5196 5196 E AndroidRuntime: at android.view.ViewTreeObserver.dispatchOnPreDraw(ViewTreeObserver.java:977)
09-28 03:30:16.661 5196 5196 E AndroidRuntime: at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2477)
09-28 03:30:16.661 5196 5196 E AndroidRuntime: at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1464)
09-28 03:30:16.661 5196 5196 E AndroidRuntime: at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:7196)
09-28 03:30:16.661 5196 5196 E AndroidRuntime: at android.view.Choreographer$CallbackRecord.run(Choreographer.java:949)
09-28 03:30:16.661 5196 5196 E AndroidRuntime: at android.view.Choreographer.doCallbacks(Choreographer.java:761)
09-28 03:30:16.661 5196 5196 E AndroidRuntime: at android.view.Choreographer.doFrame(Choreographer.java:696)
09-28 03:30:16.661 5196 5196 E AndroidRuntime: at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:935)
09-28 03:30:16.661 5196 5196 E AndroidRuntime: at android.os.Handler.handleCallback(Handler.java:873)
09-28 03:30:16.661 5196 5196 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:99)
09-28 03:30:16.661 5196 5196 E AndroidRuntime: at android.os.Looper.loop(Looper.java:193)
09-28 03:30:16.661 5196 5196 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:6669)
09-28 03:30:16.661 5196 5196 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)
09-28 03:30:16.661 5196 5196 E AndroidRuntime: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
09-28 03:30:16.661 5196 5196 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
本地存在so库但是无法访问,请求模块被编译到product下,修改编译mk文件将文件编译到system模块下注释如下:
#LOCAL_PRODUCT_MODULE := true
默认会编译到system模块下
2.刷机时可用 更新后不可用
刷机成功后能正常访问so库,但是更新当前应用后无法访问。从源码可以知道
/frameworks/base/ core/java/android/app/LoadedApk.java
final boolean isBundledApp = mApplicationInfo.isSystemApp()
&& !mApplicationInfo.isUpdatedSystemApp();
String libraryPermittedPath = mDataDir;
if (isBundledApp) {
// This is necessary to grant bundled apps access to
// libraries located in subdirectories of /system/lib
libraryPermittedPath += File.pathSeparator +
System.getProperty("java.library.path");
}
看上面的注释就知道啦,如果是系统apk并且没有升级过的话,so库的搜索路径就会增加一个system/lib。因为install -r来安装apk就相当于升级,所以刷机时apk可以用,install升级后不能用。
3.解决更新不可用
为了解决安装可用问题在system\etc\public.libraries.txt中添加so库文件名例如:
# See https://android.googlesource.com/platform/ndk/+/master/docs/PlatformApis.md
libandroid.so
libaaudio.so
libc.so
libcamera2ndk.so
libdl.so
libEGL.so
libGLESv1_CM.so
libGLESv2.so
libGLESv3.so
libicui18n.so
libicuuc.so
libjnigraphics.so
liblog.so
libmediandk.so
libm.so
libnativewindow.so
libneuralnetworks.so
libOpenMAXAL.so
libOpenSLES.so
libRS.so
libstdc++.so
libsync.so
libvulkan.so
libwebviewchromium_plat_support.so
libz.so
libsurfaceoverlay_jni.so
libwistar_surfaceoverlay_jni.so
重启后生效,就可以解决快速调试问题。
本文地址:https://blog.csdn.net/chen1103978255/article/details/108846049