MATLAB Answers

Android Studio + MATLAB: Failed to find the required library libmwmclmcrrt.so.9.7 on java.library.path

27 views (last 30 days)
Qian Xu
Qian Xu on 23 Apr 2020
Answered: Sutanu Maiti on 22 May 2020
I am developing an Android app and try to use some MATLAB libraries. I have built a .jar file called myAdd.jar from my MATLAB code and have copied it and javabuilder.jar to Project->MyApplication->app->libs. Now the class called matlabAdd, which is originally defined in myAdd.jar, already can be used in my Android main function. However, there is still a problem:
When I run my Android code, I got this error which bothers me a few days:
Process: com.example.myapplication, PID: 11568
java.lang.UnsatisfiedLinkError: Failed to find the required library libmwmclmcrrt.so.9.7 on java.library.path.
This library is typically installed along with MATLAB or the MATLAB Runtime. Its absence may indicate an issue with that installation or
the current path configuration, or a mismatch with the architecture of the Java interpreter on the path.
MATLAB Runtime version this component is attempting to use: 9.7.
Java interpreter architecture: glnxa64.
at com.mathworks.toolbox.javabuilder.internal.MCRConfiguration$ProxyLibraryDir.get(MCRConfiguration.java:185)
at com.mathworks.toolbox.javabuilder.internal.MCRConfiguration$ProxyLibraryDir.<clinit>(MCRConfiguration.java:195)
at com.mathworks.toolbox.javabuilder.internal.MCRConfiguration.getProxyLibraryDir(MCRConfiguration.java:200)
at com.mathworks.toolbox.javabuilder.internal.MCRConfiguration$MCRRoot.get(MCRConfiguration.java:64)
at com.mathworks.toolbox.javabuilder.internal.MCRConfiguration$MCRRoot.<clinit>(MCRConfiguration.java:76)
at com.mathworks.toolbox.javabuilder.internal.MCRConfiguration.getMCRRoot(MCRConfiguration.java:81)
at com.mathworks.toolbox.javabuilder.internal.MCRConfiguration$ModuleDir.<clinit>(MCRConfiguration.java:53)
at com.mathworks.toolbox.javabuilder.internal.MCRConfiguration.getModuleDir(MCRConfiguration.java:58)
at com.mathworks.toolbox.javabuilder.internal.MWMCR.<clinit>(MWMCR.java:1718)
at com.mathworks.toolbox.javabuilder.internal.MWMCR.newInstance(MWMCR.java:545)
at myAdd.MyAddMCRFactory.newInstance(MyAddMCRFactory.java:44)
at myAdd.MyAddMCRFactory.newInstance(MyAddMCRFactory.java:55)
at myAdd.matlabAdd.<init>(matlabAdd.java:62)
at com.example.myapplication.MainActivity.onCreate(MainActivity.java:33)
at android.app.Activity.performCreate(Activity.java:7990)
at android.app.Activity.performCreate(Activity.java:7979)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1309)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3308)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3477)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2043)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:216)
at android.app.ActivityThread.main(ActivityThread.java:7464)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:549)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:955)
So does anyone know how to fix this problem?
My operation system is Windows10, but this libmwmclmcrrt.so.9.7 seems like a dynamic link library which works on Linux. And I cannot find this file in my MATLAB installation directory.
If Android Studio and MATLAB cannot work together directly, is there other indirect way for me to call MATLAB funcitons in my Android code?

  0 Comments

Sign in to comment.

Answers (1)

Sutanu Maiti
Sutanu Maiti on 22 May 2020
If you can move to Simulink then, Simulink support package for Android Devices can be used to deploy matlab code directly to android phone without doing any java / android coding.
There is also an example Detect Boundaries of Objects Within Video Using MATLAB Function Block on Android Device that describes how to write matlab code that generates code and deploys on Android device.

  0 Comments

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!