MATLAB Answers

0

Why does Build fail during Hardware Setup for Simulink Android Support Package for R2018a and R2018b

Asked by Sruthi Yenugula on 26 Sep 2018
Latest activity Commented on by Sruthi Yenugula on 11 Dec 2018 at 5:44
Build fails during the Hardware Setup with the following failure
Build App A problem occurred configuring root project 'TestApp'. > No toolchains found in the NDK toolchains folder for ABI with prefix: mips64el-linux-android *

  5 Comments

yes, I have met the same problem. When typed cordertarget.androi.AppBuilder(1) in MATLAB command, ans is following: >> codertarget.android.AppBuilder(1)
ans =
AppBuilder - 属性:
GradlePath: 'X:\Program Files\Android\Android Studio\gradle\gradle-4.6'
JavaPath: 'X:\Program Files\Android\Android Studio\jre'
NDKPath: 'X:\Users\Longhore\AppData\Local\Android\sdk\ndk-bundle'
OpenCVPath: 'X:\ProgramData\MATLAB\SupportPackages\R2018b\3P.instrset\androidopencv.instrset\opencv-android-sdk'
SDKPath: 'X:\Users\Longhore\AppData\Local\Android\sdk'
AppName: []
ApkFilePath: []
PackageName: []
ProjectPath: []
ActivityName: []
DefDevice: []
Devices: []
NDKBuildType: 'release'
SkipDeviceCheck: 1
AndroidPluginVersion: '2.3.0'
AppCompactVersion: '26.0.0-alpha1'
DesignVersion: '26.0.0-alpha1'
CompileSdkVersion: '28'
BuildToolsversion: '28.0.3'
defOpts: [1×1 struct]
my mobile phone is Huawei mate 9 pro.
Hi Longhai Li,
From the information you shared, looks like you have not updated the Android Support package with patch.

Sign in to comment.

Products


Release

R2018a

6 Answers

Answer by Sruthi Yenugula on 26 Sep 2018
 Accepted Answer

Use the following workaround, only if you get the error mention Question section.
To resolve the issue for R2018a,
This issue is with new NDK version. Use this work around for now to get started with Android Support Package. Attached the Androidfix_18a.zip file. It contains 5 files. In MATLAB, go to path where you have placed that unzipped folder and then open the androidfix.m file and click on Run button. Now try Hardware Setup again. If copy files, start MATLAB as administrator.
To resolve the issue for R2018b,
This issue is with new NDK version. Use this work around for now to get started with Android Support Package. Attached the Androidfix_18b.zip file. It contains 5 files. In MATLAB, go to path where you have placed that unzipped folder and then open the androidfix.m file and click on Run button. Now try Hardware Setup again. If copy files, start MATLAB as administrator.

  11 Comments

Hi Danyang Zhang,
Thanks for providing the information. Sorry, third command given in the comment above had some indentation issues.
Please execute the following commands in MATLAB prompt. Replace the username with your system username while executing. First command would be the path of the Android SDK in your system, that is default location. If you had changed the location please use changed location.
sdkPath = 'C:\Users\username\AppData\Local\Android\Sdk'
[s,r] = codertarget.android.internal.runAdb(sdkPath,[' shell dumpsys window | grep mCurrentFocus'])
Hi Sruthi Yenugula,
Thanks for this info. I was trying also to setup for device Galaxy S5.I follow the above solution but still encountering the Test connection error. When typing in MATLAB the command:
[s,r] = codertarget.android.internal.runAdb(sdkPath,[' shell dumpsys window | grep mCurrentFocus'])
MATLAB command window displays:
s =
255
r =
''grep' is not recognized as an internal or external command,
operable program or batch file.
'
Thanks a lot Ryan, for providing the information. Will investigate and get back.

Sign in to comment.


Answer by Sruthi Yenugula on 22 Oct 2018
Edited by Sruthi Yenugula on 10 Dec 2018 at 2:50

@Ryan, @Danyang, @Longhai, @Jorge : Thanks for your patience.
This patch is only for 18b release, don't use for any other release
Use this patch if you get the following error:
Could not detect TestApp on the device screen. The screen may be locked or turned off. Ensure that your device screen is unlocked throughout the verification process.
Attached the Androidpatchfor18b_name.zip file. It contains 4 files. In MATLAB, go to path where you have placed that unzipped folder and then open the pluginfix.m file and click on Run button. Now try Hardware Setup again. If copy files, start MATLAB as administrator. Thanks for your patience. Let us know if you face any issues.

Answer by Emilio Maranci on 28 Oct 2018

Hi Sruthi Yenugula, I had the same problem described before, in particular the error "No toolchains found in the NDK toolchains folder for ABI with prefix: mips64el-linux-android *". I've fixed it using Androidfix_18b.zip, but now I've a new issue. During hwsetup I've encountered problem with the connection test. The error is: "Could not find device configuration file created by TestApp.". How can I solve it?

  2 Comments

Hi Emilio, Please check the above answer(2nd answer). https://www.mathworks.com/matlabcentral/answers/420799-why-does-build-fail-during-hardware-setup-for-simulink-android-support-package-for-r2018a-and-r2018b#answer_342686
Thank you, Sruthi. Probably there was some issues with my smartphone, but I fix it. I've changed device and now it works.

Sign in to comment.


Answer by Alessio Conte on 19 Nov 2018 at 14:56
Edited by Alessio Conte on 19 Nov 2018 at 15:03

Dear Sruthi Yenugula. I have R2018b version of MATLAB.
  • When I try to build an app on my device i get the error:
Cannot write to file androidObjectDetection\\src\\main\\res\\layout\\fragment_app.xml.
  • This is my situation:
>> codertarget.android.AppBuilder(1)
ans =
AppBuilder with properties:
GradlePath: 'C:\Android\gradle\gradle-4.6'
JavaPath: 'C:\Android\jre'
NDKPath: 'C:\Users\User\AppData\Local\Android\sdk\ndk-bundle'
OpenCVPath: 'C:\ProgramData\MATLAB\SupportPackages\R2018b\3P.instrset\androidopencv.instrset\opencv-android-sdk'
SDKPath: 'C:\Users\User\AppData\Local\Android\sdk'
AppName: []
ApkFilePath: []
PackageName: []
ProjectPath: []
ActivityName: []
DefDevice: []
Devices: []
NDKBuildType: 'release'
SkipDeviceCheck: 1
AndroidPluginVersion: '3.1.0'
AppCompactVersion: '26.0.0-alpha1'
DesignVersion: '26.0.0-alpha1'
CompileSdkVersion: '28'
BuildToolsversion: '28.0.3'
defOpts: [1×1 struct]
What can I do?

  1 Comment

If you had installed the latest Android Support package, then no need of applying the patch.
The patch should be applied only if you get the following error during hardware setup
"No toolchains found in the NDK toolchains folder for ABI with prefix: mips64el-linux-android *"
If we didn't get that error and still applied that patch, i suggest you to uninstall and reinstall the Android Support package.
regarding the below error, looks like permission issues. Please build the models in different directory and see if you get the same issue. please let us know if you face any issues
Cannot write to file androidObjectDetection\\src\\main\\res\\layout\\fragment_app.xml.

Sign in to comment.


Answer by yubao cao on 23 Nov 2018 at 2:48

Dear Sruthi Yenugula.
I have R2018a version of MATLAB. When I run the app,it shows "com.mathworks.test not install."
I have installed the package for a week.

  3 Comments

Hi Yubao,
You mean, when you run Hardware Setup, you are getting that error?
Hi,Sruthi Yenugula,
I tried many times,then it works!But when I run the communication with android device, it shows,
Unexpected error : [armeabi-v7a] Compile thumb : androidCommunicationExample <= ert_main.c In file included from ../ert_main.c:4: In file included from C:/Users/CYB/AppData/Local/Temp/ANDROI~2/androidCommunicationExample.h:10: C:/Users/CYB/AppData/Local/Temp/ANDROI~2/rtwtypes.h:4:10: fatal error: 'tmwtypes.h' file not found #include "tmwtypes.h" ^~~~~~~~~~~~ 1 error generated. make: *** [C:\Users\CYB\AppData\Local\Temp\androidCommunicationExample_ert_rtw\androidCommunicationExample\src\main/obj/local/armeabi-v7a/objs/androidCommunicationExample/ert_main.o] Error 1
There is some issue with your MATLAB installation, please reinstall the MATLAB and also the Support Package.

Sign in to comment.


Answer by omar sheishaa on 9 Dec 2018 at 0:08

kingly note that i run pluginfix.m file and its output is "Could not copy .p files : No matching files were found." then i tried to verify the configuration of Android Device and got the same error at the step of testing connection like before "Could not detect TestApp on the device screen. The screen may be locked or turned off. Ensure that your device screen is unlocked throughout the verification process."

  3 Comments

Please ignore that error and go ahead and create models and deploy on your device. Test Connection issue will be resolved in next update. But for now, you can ignore it and work with Support package.
Hi Sruthi
i proceeded with deployment of the model but i got an error "Simulink cannot determine sizes and/or types of the outputs for block 'slexHARAndroidExample/predictActivity' due to errors in the block body, or limitations of the underlying analysis. The errors might be inaccurate. Fix the indicated errors, or explicitly specify sizes and/or types for all block outputs." although it worked before , also this model is verified by matlab in this links https://www.mathworks.com/help/supportpkg/android/ug/run-model-on-android-hardware.html
Hi Omar,
I have checked this example with R2018b MATLAB, example works fine. Please make sure you have followed all the steps before deploying and also have required toolboxes.
'EnsembleModel.mat' is created?

Sign in to comment.