File Exchange

image thumbnail

Simulink Support Package for Android Devices

Run models on Android devices

131 Downloads

Updated 12 Sep 2018

Simulink® Support Package for Android™ Devices enables you to create and run Simulink models on supported Android devices. Support includes a library of Simulink blocks for:

• Sensors
• Audio capture and playback
• Camera input and video display
• UI widgets
• Network interface

This support package is functional for R2014a and beyond.

Comments and Ratings (95)

Hi Sruthi,
I'm using Version: 9.2.0.538062 (R2017a)

Hi Jayanth,
Which version of MATLAB are you using? To find version type ver in the MATLAB command prompt.

Im getting an error while verifying configuration of you android device, the error message as follows

"Building App
Build did not succeed (Error id : BUILDAPPNOAPPB).
The build log is stored in C:\Users\ajaya\AppData\Local\Temp\tp1637fe65_d0ad_48b8_8902_5e6d49eeb1d6\androidTestAppDiagnostic.zip.
Contact technical support and send the file."

Hi Faza,
We are looking into that issue, as a work around you can uninstall Android Studio and install in a folder path which doesn't have space eg: D:\Android\Android_Studio .After installing, run the Hardware Setup screens again. This will resolve your issue.

Faza Seiko

Error: "'D:\Program' is not recognized as an internal or external command, operable program or batch file. ", on executing command 'D:\Program Files\Android\Android Studio\gradle\gradle-4.4\bin\gradle -v'.

i have this error on Hardware Set up, help me!

Hi Irqa Naqvi,
Which version of MATLAB are you using? To find version type ver in the MATLAB command prompt.
If you are using R2017b or lower, you need to run MATLAB as administrator, when installing the support Package.
Please provide the error which you are getting while installing.

iqra Naqvi

i am having error in installing support packages...kindly help me...

Eyu Wo

Eyu Wo (view profile)

Hi Sruthi, Thanks for the help! I re installed the support package and everything starts to work properly. P.s I am using R2018a and Android Studio 3.1.3.

Hi Eyu,
From your error looks like your using R2017b or lower version of MATLAB. For this version Android Studio is not required for the Support package. And also looks like you have updated the android SDK downloaded by the Android Support Package. For versions R2017b or lower, we require a particular SDK, please don't update the SDK present in the Support Package path. Please uninstall the support package and install again.

Eyu Wo

Eyu Wo (view profile)

Hi there, I get this error at the 'Verify Configuration of Your Android Device' step. I have installed the latest version of MATLAB and Android studio also followed each steps as instructed.
Thank you for the help.

Build App Unexpected error : **************************************************************************
The "android" command is deprecated. For manual SDK, AVD, and project management, please use Android Studio. For command-line tools, use tools\bin\sdkmanager.bat and tools\bin\avdmanager.bat **************************************************************************
Invalid or unsupported command "create project --target 1 --name TestApp --path C:\Users\username\AppData\Local\Temp\tp21c8e64c_1d8a_4f83_8a39_63747b9a4415\TestApp --activity TestApp --package com.mathworks.test -g -v 1.2.1" Supported commands are: android list target android list avd android list device android create avd android move avd android delete avd android list sdk android update sdk

Hi,
I am on Version R2017b. The Installation worked fine but during the verification I get the same error as Tudor & Ayad. I started Matlab as administrator on Windows 10 and I am connected to Internet via WIFI.

Thanks Tian
@Ayad, Tudor
Please run MATLAB as administrator as suggested by Tian and Internet should be connected to PC when you run hardware setup screens
If you still face issues, check the following instructions
To know the version, type ver in MATLAB command window.

If your using R2017b or lower, the issue is due to no internet connection. When you run hardware setup, makes sure your PC is connected to internet.

If your using R2018a, seems like your using old Android Studio version

If you are using old Android Studio version, please upgrade it and try again.

To upgrade, using the following link
https://www.mathworks.com/help/supportpkg/android/ug/get-latest-version-of-android-studio.html

Update Android Studio to the latest version available for download.
To get the latest Android Tools, use
https://www.mathworks.com/help/supportpkg/android/ug/install-android-sdk-platform-packages-and-sdk-tools.html

After getting all latest tools, try the hardware setup again. Please feel free to contact, if you still face any issues.

For those who failed to download, pls make sure you run Matlab as administrator....

Hello,

I get the same error as Ayad during setup:

Unexpected error : FAILURE: Build failed with an exception. * What went wrong: A problem occurred configuring root project 'TestApp'. > Could not resolve all dependencies for configuration ':classpath'. > Could not resolve com.android.tools.build:gradle:1.2.1. Required by: :TestApp:unspecified > Could not resolve com.android.tools.build:gradle:1.2.1. > Could not get resource 'https://repo1.maven.org/maven2/com/android/tools/build/gradle/1.2.1/gradle-1.2.1.pom'. > Could not GET 'https://repo1.maven.org/maven2/com/android/tools/build/gradle/1.2.1/gradle-1.2.1.pom'. > peer not authenticated * Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. BUILD FAILED Total time: 3.611 secs

What am I missing? I can find that file just fine in my browser, no authentication needed...

Ayad waiss

Hi,
I did all procedures correctly but I get this error when I run the verification

Unexpected error : FAILURE: Build failed with an exception. * What went wrong: A problem occurred configuring root project 'TestApp'. > Could not resolve all dependencies for configuration ':classpath'. > Could not resolve com.android.tools.build:gradle:1.2.1. Required by: :TestApp:unspecified > Could not resolve com.android.tools.build:gradle:1.2.1. > Could not get resource 'https://repo1.maven.org/maven2/com/android/tools/build/gradle/1.2.1/gradle-1.2.1.pom'. > Could not GET 'https://repo1.maven.org/maven2/com/android/tools/build/gradle/1.2.1/gradle-1.2.1.pom'. > peer not authenticated * Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. BUILD FAILED Total time: 7.174 secs

my email is ayad.dalloo@gmail.com

Hi Luca,
During verification of installation, make sure your screen is unlocked and when you get the install notification on the screen, please accept it. After this action, the app should automatically start, you need not start the app. Please try the Hardware Setup again. If you are still facing any issues with Setup, please provide your email id. We will help you out.

Luca Bossi

During the Hardware Setup, when I verify the installation, the app is buoilded on my huawei P8 lite, the phone ask me to install it, and after installation to run it. After I started execution of the app, the app seems working but on the PC I see the waiting logo on the "Build app" and the software remain blocked. Phone and PC are connected on the same wifi. On PC run Windows 10 last version. Can you help me?

Hi Dirk,
Please change Android Studio(present in path C:\PROGRA~1\Android\Android Studio) folder name to Android_Studio and when you run Hardware Setup, in the first screen change the path of Android Studio accordingly and try. This will resolve your issue. If you are still facing any issues with Setup, please provide your email id. We will help you out.

Dirk Mayer

Hi, after installation of Android Studio the verification of the installation fails, message:
Error: "Der Befehl "C:\PROGRA~1\Android\Android" ist entweder falsch geschrieben oder konnte nicht gefunden werden. ", on executing command 'C:\PROGRA~1\Android\Android Studio\gradle\gradle-4.4\bin\gradle -v'

From the command line, gradle -v works fine and returns the information.

I'd be grateful for any hint.

Hi Felipe,
Make sure your phone is connected to the same WIFI network as your PC and your phone should be unlocked and Test app should be running on your phone screen. If you are still facing any issues with Setup, please provide your email id. We will help you out.

I get this error when trying the test app (R2017b):

"Could not detect TestApp listening on port 7777. Ensure WiFi on your device is turned on."

WIFI is actually turn on. Help please

HEMANT GHUGE

Hello Sutanu Maiti,

Thanks for assisting me. Please reach me out quickly.

Hemant Ghuge
hemantghuge0050@gmail.com

BLE Scan issue will be fixed with May 9th update.

Meanwhile to fix the issue, please check the Answer Section of https://www.mathworks.com/matlabcentral/answers/396945-cannot-scan-in-ble-receive-block?s_tid=prof_contriblnk

hi . can you send me this pakage to my email ?
My email address is : hosseinbalani6@gmail.com

Orhan

Orhan (view profile)

In BLE Receive module, scan doesn't work. Can't use Bluetooth as a client.

Sutanu Maiti

Hello Hemant Ghuge,

I will assist you in resolving the issue that you are facing. Can you please share with me with an email id through which I can reach you and help you out?

Thanks,
Sutanu

HEMANT GHUGE

HEMANT GHUGE

Unable to find the NDK at the specified path. Run the Hardware Setup process and try again.
### Build procedure for model: 'android150418' aborted due to an error.
Error(s) encountered while building "android150418":
### Failed to generate all binary outputs.

HARDWARE SETUP process is successfully completed but when I try to deploy my Simulink model above error is prompted.
I am struggling for many days. I have reinstalled android studio and Simulink support for Android devices twice.
I am using Redmi Note 4 as my android devices. Test App was generated successfully. In addition to that OpenCV manager is also installed.

Sutanu Maiti

For those who are getting error message below during the last step of the setup process i.e. 'Verify Configuration of Your Android Device' - Build App step:

"Unable to find Android Software Development Kit (SDK) Build-Tools. Install Android SDK packages and tools as described in Install Android SDK Platform Packages and Tools and run the Hardware Setup process again."

Please note, the Support Package verification step works fine with Android SDK Build Tools 27.0.3. However, if build tool version 28.0.0-rc1 is present then the above issue comes up.
To come out of this issue, either you can wait for April update that will be available in mid of April, or you can uninstall build tool 28.0.0-rc1 and install version 27.0.3 to have the support package work properly.

Check out this cool Example which uses Statistics and Machine learning toolbox to classify different Human activities like sitting, standing etc. and then use this Support Package to use this classified data to detect Human activity using Mobile sensors. This example is added in R2018a.
https://www.mathworks.com/help/supportpkg/android/examples/human-activity-recognition-simulink-model-for-smartphone-deployment.html

Pradeep KS

MATLAB R2018a is out!!

1. Flexibility in Android support package installation
Before R2018a, installation of Simulink® Support Package for Android™ Devices included installation of Android platform packages and Software Development Kit (SDK) tools. As of R2018a, the installations of the Android platform packages and SDK tools can be done independently after a successful installation of the Android support package. This change in the installation process shortens the time required to install the support package. For more information, see
https://www.mathworks.com/help/supportpkg/android/ug/install-support-for-android-devices.html#mw_ce00da2f-bde9-4f39-a69a-a9aaf014dbc0

2. Accept data from Android keyboard
You can use the Data Input block to create a data input field on an Android device screen. This input field accepts data from the keyboard of the device. For more information on how to use the Data Input block, see
https://www.mathworks.com/help/supportpkg/android/examples/accept-input-from-android-keyboard.html

3. Measure data using Android sensor blocks - You can use the Magnetometer block and Orientation block to measure data from the built-in sensors on an Android device.
* Magnetometer: Measures the magnetic field along the X, Y, and Z axes of an Android device.
* Orientation: Measures device rotation along the X, Y, and Z axes of an Android device.

Nicholas Zhou

由于GFW的存在,如果从中国访问,请翻墙

Zhang Huayou

failed to download

Jean Marc

With the simulink model Android camera connected to Android video dysplay, named andro1, i have the error message :
C:\Windows\System32\slprj\_cgxe\andro1\src>"C:\Program Files\MATLAB\R2017a\sys\lcc64\lcc64\bin\lccmake.exe" -f andro1_cgxe.lmk
C:\Program Files\MATLAB\R2017a\sys\lcc64\lcc64\bin\lccmake.exe: Can't open andro1_cgxe.lmk
why ?

qiushengpeng

lu sheng

I am trying to run the example androidSensorFilterExample
### Starting build procedure for model: androidSensorFilterExample
there is some error as follow:

Unexpected error : [armeabi] Compile thumb : androidSensorFilterExample <= ert_main.c
In file included from ../androidSensorFilterExample.h:9:0,
from ../ert_main.c:4:
../rtwtypes.h:4:22: fatal error: tmwtypes.h: No such file or directory
#include "tmwtypes.h"
^
compilation terminated.
make: *** [D:\MatCode\screenOn\androidSensorFilterExample_ert_rtw\androidSensorFilterExample\src\main/obj/local/armeabi/objs/androidSensorFilterExample/ert_main.o] Error 1

I want to know what wrong with it?

@alaa,Huayou, Michal, Wy Rao: Sorry for the Inconvenience.
Please try the following for the installation of Android Support Package

1)Start MATLAB as administrator.

2)To remove partially installed support package
a) In the MATLAB command window type the following command
cd(matlabshared.supportpkg.getSupportPackageRoot)

b) Go to 3P.instrset folder
c) Delete the following folders(if present)
androidsdk.instrset
androidsupportrepository.instrset
androidsdkbuildtools.instrset
gradle-android.instrset
androidjdk.instrset
androidsdkplatforms.instrset
androidndk.instrset
androidsdkplatformtools.instrset
androidopencv.instrset
androidsupportlibrary.instrset

3)Now install the Android Support Package.

Zhang Huayou

There was a problem downloading the third-party software. To resolve this issue, contact Technical Support

alaa nasef

failed to download

alaa nasef

can i make standalone object recognition app using this package on android? i read it have opencv support
if anyone download it can answer me plz?

Andreas Rauh

For me, the solution was very simple to circumvent the "Failed to install the third-party software: Android SDK Platform" issue... I just started Matlab (R2017b) with administrator priviledges, removed the incomplete installation of this support package. Afterwards, the installation wenth through smoothly, without any error message

Need to rate it so low, because:

""Failed to install the third-party software: Android SDK Platform
This is required by: Simulink Support Package for Android Devices"

It is described in one of the threads on "MATLAB Answers", but there is no solution still. Waiting for support.

https://www.mathworks.com/matlabcentral/answers/355781-why-do-i-encounter-a-error-while-installing-third-party-files-when-installing-a-support-package-in

Wy Rao

Wy Rao (view profile)

Third party package can not connect consistently...

cui

cui (view profile)

when to " Verifying configuration of your Android device" this step
Running App
Could not run TestApp on the device (Error id : RUNAPPF).
The log is stored in C:\Users\ADMINI~1\AppData\Local\Temp\tp0b816b38_8667_4091_b21c_70509384becc\androidTestAppDiagnostic.zip.
Contact technical support and send the file.
why?

@Guolong: Thank you for the rating. In R2017b, the BLE Send and BLE Receive blocks were added to this support package. You can check out the below example for a demonstration of how this communication works:
https://www.mathworks.com/help/supportpkg/android/examples/work-with-ble-blocks-on-android-devices.html

but how to use bluetooth to communicate?

@Athlon (and everyone else for that matter): If you are seeing a relatively generic error message, or are experiencing difficulty with this support package but aren't sure of any specifics, contacting Technical Support is a far easier way to address the issue than trying to go back and forth in the comments section here:

https://www.mathworks.com/support/contact_us.html

If you discover or they help you to find a resolution step, feel free to post it here though, to help future users.

Athlon

Athlon (view profile)

i have issue to setup my samsung device....
in verify step i have problem and do no run test and verify.
please help me to solve this issue.

@Kres Nielsen: This support package should be able to generate apps for any Android phones above the required Android version. However, it only has built-in functionality to use the Android SDK, not a custom development kit. You could try to follow our workflow to generate projects for Android Studio as a starting point, and then connect them up to the custom Moto Mods functionality manually. We cannot guarantee that it will work seamlessly though.

Kres Nielsen

Could this add-on be used with a new device built using the Moto Mods Development Kit for the Motorola Moto Z line of Android smart phones? I.e. could it replace the need for writing a custom Android App?

Here is a link to the MDK:
https://developer.motorola.com/buy/

Thanks

QF LI

QF LI (view profile)

I could not find my android cellphone

aa a

aa a (view profile)

Sutanu Maiti

@Erik S: Can you please check if "HostLib_Network.h" file is present in below directory?
<C:\Program Files\MATLAB\R2017a\toolbox\shared\dspblks\extern\include>
If it is not present then, it could be an installation issue.

Erik S.

I get the following error when I try to build the example: androidSensorAndUDPUsageExample

Unexpected error : [armeabi] Compile thumb : androidSensorAndUDPUsageExample <= HostLib_Network.c
../HostLib_Network.c:6:29: fatal error: HostLib_Network.h: No such file or directory
#include "HostLib_Network.h"
^
compilation terminated.
make: *** [C:\Users\erik_\Documents\MATLAB\androidSensorAndUDPUsageExample_ert_rtw\androidSensorAndUDPUsageExample\src\main/obj/local/armeabi/objs/androidSensorAndUDPUsageExample/HostLib_Network.o] Error 1

I build for a Samsung Galaxy S5 on R2017a. The verification process was successful.

WX Zhao

It can not download,why?Who can help me?

Zhu Hongbin

Hi, I am trying to do the "verification of Android devices". However, when I try to do "building App", error displayed as:

Warning: Escaped character '\U' is not valid. See 'doc sprintf' for supported special characters.
>In codertarget.setup.AndroidFirmwareUpdate/createDiagnostic
In codertarget.setup.AndroidFirmwareUpdate/displayDiagnostic
........
Unexpected failure (Error id: BUILDAPPNOAPPB-CREATDIAGNOWRIT). Press 'Retry'.

I'm using matlab 2017a.
Simulink Support Package for Android Devices version 17.1.0
Thank you for your time.

eliseo pachas

@sara I see. I'm using matlab 2016a, I will change it, , thanks for the information !!!

saras

saras (view profile)

@Eliseo: What version of MATLAB are you running? This block was add in R2016b.

Hello
I have a problem, I cant find data display in my simulink support package...there is a option to install or replace it ?

Henrik

Henrik (view profile)

saras

saras (view profile)

In this case, the installation was successful after deleting the Support Package directory (C:\ProgramData\MATLAB\SupportPackages\R2017a) and re-installing the support package.

Pedro Vizcaya

Hi, I am trying to install these package for Matlab 2017a:
MATLAB Support Package for Android Sensors version 17.1.0
Simulink Support Package for Android Devices version 17.1.0
I get an error:

Install Error

There was a problem installing the support package. To resolve this issue, contact Technical Support
What can be missing?

saras

saras (view profile)

@ECE ESWAR @Sathya: Please reach out to MathWorks Technical Support (US: 508-647-7000) so they can help identify and fix the issue.

cannot install it
error displayed is
"There was a problem executing post-install actions for package with basecode ANDROID

Caused by:
Unable to load a message catalog 'android:utils'. Please check the file location and format."

sathya seelan

saras

saras (view profile)

@Hai: What is the error you are seeing? Are you able to run models in external mode?

hai du

hai du (view profile)

failed to pass the "testing connection" on my nexus 6p. But I can see the test app running on the phone. I've tried to select s4 and tab and both failed. any idea of fixing this problem?

found version 16.2.1 on R2016b. If changed support package path to the shortest (G:\S etc.),and if bear and wait 15 minutes or so during installation of the 3rd party products, we can find installation successfully. I tryed sample model and confirmed working.

saras

saras (view profile)

There was an issue with 16a installation that was recently fixed. Can you retry the installation?

Li

Li (view profile)

Hi, the following error appears when i installed the package:
"There was an error installing third-party software for Support Package Android:
C:\MATLAB\SupportPackages\R2016a\downloads\android_download
does not contain archives for third-party software used by the support package." How to fixed it.
Thanks
maode

Great job team! This is working very nicely. Each release is getting better and better.

fgao

fgao (view profile)

@Hamid Alavi Can you reinstall it?

Hamid Alavi

Hello
i am trying to install this package but when my wifi disconnect for just a sec, the installation fails!
is there another way to download this package?

Anshuman G

Hello,
I am trying to access the Microphones (ADC1,ADC3 and ADC4) on Motorola Nexus 6 through Simulink Support package.
Can anyone contribute? Any useful information?Links?

Mauro

Mauro (view profile)

Hello. It is a very good package, also for educational purposes.
I wander if S4 Mini requires a different connection setup with respect to S4.
The 'test connection' with my Galaxy S4 Mini fails, nevertheless the device model and its IP are correctly discovered.
Then the 'Filtering Sensor Data' example does not work (it uses external simulation mode) while the 'Sensor application' model (which is deployed to hardware) works correctly.

Da Bu

Da Bu (view profile)

Thanks Brian, but I couldn't find neither "Download from Internet" nor "Install from folder" option in the support package installer! Could you please help me find these options?

Da Bu

Da Bu (view profile)

Is there a step by step guide to install this hardware support package on a PC which is couldn't connect to internet?
I mean could 3rd party softwares be downloaded seperatly and then configure the package with some commands or additional files?

Reza

Reza (view profile)

The package was successfully installed on windows 7. All the examples work for both Galaxy S4 and Nexus 5 phones. In case of Nexus 5 you need to select 'Galaxy Note' in the 'targetupdater' wizard.

Don

Don (view profile)

I can confirm that the package is working for accelerometers using a Note 3, android 4.4.2 and Windows 7. I previously had an issue with the Java JDK. I didn't get the "Test Connection" to work on installation, but just ignored that and tried a simulation.

Don

Don (view profile)

I'm having trouble passing the installation "Test Connection". I see my device (Note 3), but fail the test. My IP looks correct. Do you have any troubleshooting tips.

For those with issues seeing your device in Windows, it takes a long time for Windows to install the Galaxy drivers. If I recall, there were 4 drivers needed for my Note 3. After those were installed, then I could see my device listed after pressing refresh.

If you're not sure about drivers, I noted an icon with activity showing in the taskbar display indicating that drivers were being located.

Brian McKay

@Prashant: We have reached out to you, to better understand the challenges you had, but have not received a response. Please contact us to expand on the issues.

For anyone else with similar issues – we would like to understand any problems you run across.

And for all those with no issues – we are open to any feedback on the Galaxy Android support and hope you are finding it useful.

Thanks,
-Brian

Henrik

Henrik (view profile)

Hi Brian,
thanks for the response. Just to clarify:
I have selected the Device type (tried with choosing the Tab 2 and the S4); the problem occurs 4 screens later ("Connect your device and install app") where the device simply doesn't show up (despite pressing "Refresh" several times).

Brian McKay

Hi @Reto and @Henrik,

If your device isn't showing, choose "Select Tablet" device type and follow instructions from there.

Henrik

Henrik (view profile)

I have got the same problem as Reto: my device doesn't show up in the List of devices.
I have tried this with a Galaxy S and a Galaxy Note 10.1. The Galaxy S showed up once, but I haven't been able to get it to appear again.
The devices show up in Device Manager, and I can connect to them with adb.
Any suggestions?

Hello Hans,

We believe it will work on any Samsung Galaxy Android device, assuming they are running Android 4.3 or 4.4.

However, we have only done full testing on the Galaxy S4 and Tab 2 10.1.

Note: It is possible that this Support Package will also work on non-Samsung Android devices - I had it running on my Google Nexus 7 (2013) tablet. My Nexus 7 test model only used the screen and accelerometer; so I cant confirm if all the IO will work for any particular device.

Please download and try the Support Package - and let us know if you were successful.

Thanks,
-Brian

Hans

Hans (view profile)

Hi there,

excellent package.

Does this package support also other Galaxy Device such as Galaxy Note 3 or
Samsung Galaxy Tab 3 7.0 Hello Kitty?

Or are only Galaxy S4 and Samsung GALAXY Tab 2 10.1?

MATLAB Release Compatibility
Created with R2014a
Compatible with R2014a to R2018b
Platform Compatibility
Windows macOS Linux

MATLAB Online Live Editor Challenge

View the winning live scripts from faculty and students who participated in the recent challenge.

Learn more

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video