How to run a Simulink package on android and deploy an external project(aar)

1 visualización (últimos 30 días)
How to run a Simulink package on android and deploy an external project(aar)
I'm trying to introduce a model package created in simulink into an android app. With reference to the reference URL, we introduced the simulink model to Android Studio and succeeded in executing the application on the android device. But I had to add another package (AAR file). When I add the path of the dependency AAR package and run it, I get an error (error message). The build succeeds, but then the app crashes. Other settings have not changed. Apparently there is an error in the "System.loadLibrary (libname );" section. Probably the path specification isn't working, but I don't know the solution. Please help me.
Android Gradle plugin Ver 4.0.2
Gradle Ver 6.5
What I did on Android studio
-Loading a project
-Edit configuration
-Adding dependencies
Error code
java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "~~”]] couldn't find "~~.so"
(“~~” is file pass or file name)
reference URL
  2 comentarios
Sutanu Maiti
Sutanu Maiti el 9 de Sept. de 2021
Hi Shota,
May I know a bit details about the steps you had followed?
Have you first created a Simulink model and then Build that model?
After model build, Have you imported that generated code into android studio and then added 3rd party library?
If so, then can you please confirm if src\main\jni folder in your android studio project contains the armeabi-v7a folder and that folder contains a .so file or not?
From your error message it looks like that <model name>.so is missing.
Shota Kitazawa
Shota Kitazawa el 9 de Sept. de 2021
Hi Sutanu,Thank you for your reaction. Let me elaborate on the process I went through.
I created a model on simulink and even built it.
Also, when I ran the app on simulink, I was able to confirm the operation on the device.
Next, I imported the "~ _ert_rtw" folder generated when building with simulink into Android studio as a project.
I have confirmed that there is a "<model name> .so" file in the "armeabi-v7a" folder inside the "~ _ert_rtw" folder.
However, there was an "armeabi-v7a" folde in the "src \ main \ libs" folder instead of the "src \ main \ jni" folder.
I'm not sure if the third party library addition was done correctly.
I was wondering if this was okay because there was "System.loadLibrary (libname)" in the Java code automatically generated by simulink.
After importing it into Android studio as a project, I just changed the deployment of "Debug Configuration / Installation Options" to "APK of App Bundle".
Up to this point, the app has been built and executed, and it has been successfully executed. In other words, the application that introduced only the model created by simulink is running well. Therefore, I think that it is not a missing file, but a problem with the location of the file or the read folder path.
In addition to this, when I add another external SDK project (AAR file), it crashes immediately after launching the app. The build is successful.
I have installed the SDK by selecting the folder containing the AAR file from "Dependencies" in "Project Construction".
If I add only this external SDK (without the simulink model), I can confirm that the app can be executed.
In other words, if I install only the simulink model or only the external SDK, I have successfully executed it, but I cannot install these two files at the same time.
If you have any concerns, please let me know again.

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Android Devices en Help Center y File Exchange.

Productos


Versión

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by