Library “libmaliinstr.so” not found

2020-02-10 15:11发布

问题:

I have an Android app written in Scala. When I launch it the following error message appears in the log window:

08-31 13:11:10.781    5398-5398/my.app.app123 E/linker﹕ load_library(linker.cpp:759): library "libmaliinstr.so" not found
08-31 13:11:10.784    5398-5398/my.app.app123 E/﹕ appName=my.app.app123, acAppName=com.android.cts.openglperf
08-31 13:11:10.784    5398-5398/my.app.app123 E/﹕ 0
08-31 13:11:10.784    5398-5398/my.app.app123 E/﹕ appName=my.app.app123, acAppName=com.android.browser
08-31 13:11:10.784    5398-5398/my.app.app123 E/﹕ 0

What does it mean and how to solve it?

回答1:

Scala is irrelevant.

I had also meet this problem before. It's a hardware problem with CPU. Found in some of Chinese phones. Huawei and xiaomi are known brands which devices may have this problem.

Load this library error occurs when application can't find a correct platform *.so.

From name libmaliinstr, I assume it related to Mali instrument Wiki. Mali is a low-level hardware driver, supporting enhanced OpenGL/GLES especially for browser rendering.

I reproduce it on CPU MT6582 (Hongmi 1S), which means this device missing a system lib libmaliinstr.so. So app can't use openglperf as usual.

Current solution:

Skip this device and ignore the error. (we may not have permission to modify a system library)

Addition:

You can disable hardware accelerate in these devices for sure.



回答2:

This code helped me to clear the problem

List<ResolveInfo> resInfoList = this.getPackageManager().queryIntentActivities(yourIntent, PackageManager.MATCH_DEFAULT_ONLY);
for (ResolveInfo resolveInfo : resInfoList) {
    String packageName = resolveInfo.activityInfo.packageName;
    this.grantUriPermission(packageName, yourURI, Intent.FLAG_GRANT_WRITE_URI_PERMISSION | Intent.FLAG_GRANT_READ_URI_PERMISSION);
}

As told by sakiM, its a hardware problem with CPU in some phones. Adding to his list of phone brands, Micromax too has this problem. Thank you sakiM for pointing out the Irrelevant Scala Problem.

Note: If you are using fragment, you can replace this to getActivity() in the above given code.