Deployed jar file to create android app

I was trying to use deployed jar file to create an android app.Specifically I needed image processing application. I am trying to run the app in virtual machine in eclipse. But I am getting run time errors : Unsatisfied linkage error and Exception in initializer error. I have used jdk, matlab, mcr of 64 bit and java version used is jre6. I couldnot solve this issue from any forum. I have set the classpath as \matlabroot\toolbox\javabuilder\jar\win64; (Is this the correct way of setting classpath?)

 Accepted Answer

This is not possible with any current release. The Compiler SDK can only generate for deployment to one of the os that MATLAB itself runs on. The generated jar is not pure java, it is a series of jni interfaces to Windows or Osx or Linux code.

6 Comments

_UnsatisfiedLinkError:Failed to find library libmwmclmcrrt.so.8.1, required by matlab builder ja on java.library.path
What could be the reason for the above error? The path variable is set as '\matlabroot\toolbox\javabuilder\jar\win64' on a windows 7 machine.
Are you cross-compiling for Android? Android uses a completely different ABI which cannot link to Windows libraries.
I am using matlab deploytool to create the necessary jar file and using that in android project. I have imported the javabuilder.jar file and deployed jar file into my android project in eclipse. I am not sure if this is cross-compiling. Importing in this way, works perfectly in java project in eclipse. But shows run time error for android project.
The .jar files that Compiler SDK generates cannot be run on Android. The .jar has a small interface to call upon the machine code library that is MCR, and otherwise the .jar contains encrypted data files. The encrypted data files are the "compiled" .m code, which is not compiled to java, but rather to MATLAB's internal threaded interpreter. MCR decrypts the encrypted pcode'd .m files and uses them as data to be processed by the threaded interpreter. The encrypted data files themselves can be fairly operating system independent, but you need MCR to interpret them, and MCR is in x86 or x64 machine code for all versions of MATLAB since about R2009a. Android does not run on x86 or x64: Android runs on ARM processors (or possibly PowerPC as well, I am not certain.)
In short, you cannot use Compiler SDK to generate for anything useful on Android.
At this time, the only way to deploy for Android is to use Simulink with Target set to Android. You can have your Simulink blocks call a MATLAB Function block which is specialized MATLAB code (that has to be careful about how it allocates memory.) There is not much graphics you can do with this mechanism but it is the best that is available at this time.
Thank you. The description was very helpful.
I happened to look last night at some of the blocks available for deployment to a couple of the Android Galaxy devices. There is a block which accepts R, G, and B signals and displays the result as the screen. It would require computing the entire screen, I suspect. Some of the routines in the Vision toolbox help in that.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!