简体   繁体   English

将Java包从Matlab deploytool导入Android Studio App

[英]Import java package from Matlab deploytool to Android Studio App

I managed to create a java package from a Matlab function (for image processing) using deploytool. 我设法使用deploytool从Matlab函数(用于图像处理)创建Java包。 I tested it in Eclipse and it runs perfectly. 我在Eclipse中对其进行了测试,并且运行完美。 The problem is that I want to use this Matlab function for an Android Studio project and I can´t find any way to make it work. 问题是我想将此Matlab函数用于Android Studio项目,但找不到任何使它起作用的方法。

As you may know, when you use Matlab´s deploytool for java packages it generates three folders: "for_redistribution" which contains an .exe file (MyAppInstaller_web.exe), "for_redistribution_files_only" that contains the .jar and documentation, and "for_testing" which contains pretty much the same, the .jar file, documentation and java classes 如您所知,当您使用Matlab的deploytool用于Java软件包时,它将生成三个文件夹:“ for_redistribution”包含一个.exe文件(MyAppInstaller_web.exe),“ for_redistribution_files_only”包含一个.jar和文档,以及“ for_testing”其中包含几乎相同的.jar文件,文档和Java类

My question is: is it possible to use this in an Android App? 我的问题是:可以在Android应用程序中使用它吗? And if so, how? 如果是这样,怎么办? And are there any other options (other than using openCV instead of a Matlab function) to make it work? 还有其他选择(使用openCV代替Matlab函数除外)使其工作吗?

Thank you in advance 先感谢您

Java components that are generated from MATLAB code using deploytool (or using other functionality from MATLAB deployment products such as MATLAB Compiler, MATLAB Builder etc.) depend on the MATLAB Compiler Runtime (MCR). 使用deploytool (或使用MATLAB部署产品的其他功能,如MATLAB Compiler,MATLAB Builder等)从MATLAB代码生成的Java组件取决于MATLAB Compiler Runtime(MCR)。

The MCR has much too large a footprint to run on an Android device, and it's really not possible to deploy MATLAB Code to Android in this way. MCR的占用空间太大,无法在Android设备上运行,因此,实际上不可能以这种方式将MATLAB代码部署到Android。

You have two main options: 您有两个主要选择:

  1. Use the add-on product MATLAB Coder to convert your MATLAB code to C. This C code does not (unlike the deployment products) depend on the MCR, and be compiled and incorporated into your Android app like other C code. 使用附加产品MATLAB Coder将您的MATLAB代码转换为C。此C代码(与部署产品不同)不依赖于MCR,而是像其他C代码一样被编译并集成到您的Android应用中。
  2. Deploy your java component as a web service, and have your Android app communicate with it remotely. 将您的Java组件部署为Web服务,并让您的Android应用与其进行远程通信。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM