Skip to Content
Author's profile photo SIMMACO FERRIERO

How to install Hybrid Application Toolkit (HAT) on Windows (part 2 of 3)

Introduction to part 2

This is the continuation of this blog.

The entire blog has been split in 3 parts:

Link Content
Part1 Install JDK, Android SDK and Apache ANT
Part2 Install NodeJS, Cordova, Kapsel, Git, Plugman and configure environment variables
Part3 Install HAT and test it

At the end of this series of  parts, you should be able to successfully install your Hybrid Application Toolkit with minimum effort. In the previous part we have already seen how to install JDK, Android SDK and Apache Ant.

Now I’m going to show you how to install Kapsel, how to configure some environment variables and how to install a bunch of other components like GIT, Node.js, Kapsel CLI, Cordova and Plugman. This is the complete list of the steps we will go through in this part:

  • Download and install SAP Kapsel Plugin
  • Configure some environment variables (JAVA_HOME, ANT_HOME, KAPSEL_HOME, ANDROID_HOME and PATH)
  • Install a GIT client
  • Install Node.js
  • Install Kapsel CLI
  • Install Apache Cordova
  • Install Plugman

Download and install SAP Kapsel Plugin

SAP Kapsel Plugin is included in the SAP Mobile Platform SDK package, which can be downloaded from the SAP Store at this link. Download is free.


1) Click on Trial Version. Once you have filled the contact form and sent it, you will receive an email with the download link

/wp-content/uploads/2015/07/2015_06_25_13_21_55_743973.jpg


2) Once downloaded the package you can extract it. You can do it in the current folder because we won’t need the entire package, but just a small part


3) Navigate to the extracted folder down to the path \modules\KapselSDK. You will find another zip file. Right click on it and select Extract all

/wp-content/uploads/2015/07/13_828023.jpg


4) Just extract it in the C:\KapselSDK folder: this is what you should get at the end

/wp-content/uploads/2015/07/09_778830.jpg



Configure some environment variables (JAVA_HOME, ANT_HOME, KAPSEL_HOME, ANDROID_HOME and PATH)

Let’s now configure a bunch of system variables.

First of all, let’s set the JAVA_HOME. The steps listed here for setting the JAVA_HOME variable are the same for all the other 3 variables. For the PATH variable you just need to append a new string to the existing PATH. You will see this later.

These are the variables you need to configure:

VARIABLE VALUE
JAVA_HOME C:\Program Files\Java\jdk1.8.0_65 (pay attention to the correct path here!!!)
ANT_HOME C:\apache-ant
KAPSEL_HOME C:\KapselSDK
ANDROID_HOME C:\Users\Winuser\AppData\Local\Android\android-sdk

NOTE: Of course, in your case the paths can be different, if you have specified different folders during the previous steps.


NOTE: The ANDROID_HOME variable is NOT mandatory, but it’s better to have it because it’s much easier to set up the PATH variable for the Android tools.

So let’s see how to configure the JAVA_HOME: then you can do the same also for the other variables.

1) Right click on the Start button and choose System. Alternatively you can open the Control Panel and navigate to System and Security –> System

/wp-content/uploads/2015/07/2015_06_25_13_54_55_743977.jpg

2) Click on Advanced System Settings

/wp-content/uploads/2015/07/2015_06_25_13_55_19_743978.jpg

3) Click on Environment Variables

/wp-content/uploads/2015/07/2015_06_25_13_55_37_743979.jpg

4) In the System Variables panel click on New

/wp-content/uploads/2015/07/2015_06_25_13_55_52_743980.jpg

5) Enter the variable name JAVA_HOME and its value according to the table above and click on OK

/wp-content/uploads/2015/07/14_828024.jpg

6) Do the same for all the other variables.

7) Once all the 4 environment variables have been set up we can configure the path. In the System Variables panel, select the PATH variable and click on Edit

/wp-content/uploads/2015/07/2015_07_07_14_46_13_743982.jpg

8) Append to the PATH variable the following string(including the first semicolon) and click on OK

;%JAVA_HOME%\bin;%ANT_HOME%\bin;%ANDROID_HOME%\tools;%ANDROID_HOME%\platform-tools

9) At the end, you can check if you have done all correctly by typing one by one the following commands

echo %JAVA_HOME%

echo %ANT_HOME%

echo %ANDROID_HOME%

echo %KAPSEL_HOME%

path

You should get something like this

/wp-content/uploads/2015/07/32_828041.jpg

For each variable you receive the related path. Check that they are all correct. All the environment variables have been properly configured.

Install a GIT client

A GIT client is another very important tool for HAT: it’s used to manage source code on the GIT server. There are many GIT clients available on the web, what we really need is a GIT client which works in the Terminal window. You can check if you have such a Git client installed on your machine by opening a Terminal window, typing the word “git” and hitting ENTER. You should get something like this

/wp-content/uploads/2015/07/2015_07_07_23_07_08_743984.jpg

This means that the Git client is installed. If you don’t have the Git installed you can follow this procedure to install it.

1) Download the Git client from here Git. Feel free to download the latest version

2) Start the installation process by double clicking on the installation file

3) Click on Next at the Welcome screen

4) Click on Next at the License information

5) Choose the path where you want to install it or leave the proposed one and click on Next

6) At the Select Components screen simply click on Next

7) Click again on Next to create a shortcut in the Start Menu

8) You come now to an important step: here you need to choose how you would like to use Git from the command line. Choose the second option and click on Next

/wp-content/uploads/2015/07/2015_07_07_23_01_28_743985.jpg

9) At next screen you are called to decide how Git client needs to deal with the line ending conversions. Let’s choose the first option and click on Next

/wp-content/uploads/2015/07/2015_07_07_23_04_36_743986.jpg

10) At the screen named “Configuring the terminal emulator to use with Git Bash” keep the “Use MinTTY” option selected and click on  Next

11) At the screen named “Configuring experimental performance tweaks” keep the “Enable file system caching” option unselected and click on Next

12) The installation starts. At the end simply click on Finish

13) Close any open Terminal window and reopen a new one and issue again the “git” command. You should see that the Git client is now installed

14) In case you are behind a proxy firewall and you need to manually configure the proxy settings for Git, you can do it by following the steps listed in the APPENDIX to this part under the chapter How to configure proxy for Git

Install Node.js

Node.js is the main tool for HAT setup: the script which installs HAT uses this tool for executing the installation instructions.

It can be freely downloaded from https://nodejs.org/

The installation of Node.js brings in bundle a package manager which is called “npm” and can be used from the command line. This package manager is an important tool here for next steps. The “npm” tool is able to connect to some remote repository and install the package specified in the command line. For this reason, since it needs to connect to the internet network, it might be required to configure the proxy settings for it, in case your machine is behind a proxy firewall. The HAT installation will automatically ask you for proxy information and will set the npm configuration for you. In case you need to do it manually you can by following the steps listed in the APPENDIX to this part under the chapter How to configure proxy for npm

NOTE: You MUST NOT install the latest version, but just a specific version which is 10.4x. In this guide I’m going to install the 10.40 – 64bit.


1) Download the application


2) Double click on the download file to launch the installation process


3) Click on Next at the Welcome screen


4) Accept the license agreement and click on Next


5) For the destination folder you can leave the proposed one (the default for 64bit should be C:\Program Files\nodejs\) and click on Next


6) Click on Next again on the screen named Custom Setup


7) Click on Install to start the installation


8) If you get the User Access Control popup, click on Yes to install the “node.js” program


9) Click on Finish when the installation finishes


10) If you close and reopen the terminal window now you should be able to check the versions of the two new commands “npm” and “node”

/wp-content/uploads/2015/07/17_828025.jpg


NOTE: if the npm command is not recognised in the Terminal window at the end of the installation, you might require to reboot your PC.




Install Kapsel CLI

This step will install the Command Line Interface for Kapsel. This is a very short step. All you have to do is just to run the following command in a Terminal window:

npm install -g c:\KapselSDK\cli (of course if you have installed the Kapsel plugin in a different folder you have to adapt this line)

You should get something like this:

/wp-content/uploads/2015/07/18_828029.jpg


NOTE: If you get errors here it’s because most likely you have not properly configured your proxy settings for npm. Please follow the steps listed in the APPENDIX to this part under the chapter How to configure proxy for npm



Install Apache Cordova 5.2.0

Apache Cordova can be even installed during the HAT setup, but for sake of simplicity I’m going to install it here. It’s important to mention that if you want to install Cordova during the HAT setup, you don’t have to take care of the version to install, because the HAT setup will automatically propose you the right version: doing it in this phase requires that you know exactly which is the right version to install. For the HAT version I’m going to install in the 3rd part of this blog, the right Cordova version is 5.2.0 and this is exactly what I’m going to install here.

The installation is pretty simple: it’s done through the “npm” command. You need just to open a Terminal window and run the command:

npm install -g cordova@5.2.0

/wp-content/uploads/2015/07/19_828030.jpg


NOTE: If you get errors here it’s because most likely you have not properly configured your proxy settings for npm. Please follow the steps listed in the APPENDIX to this part under the chapter How to configure proxy for npm


Install Plugman

Plugman is a tool for installing/uninstalling plugins for Apache Cordova.

The installation of Plugman is achieved through an npm command as well:

npm install -g plugman

/wp-content/uploads/2015/07/20_828031.jpg


In case you are behind a proxy firewall and you need to manually configure the proxy settings for Plugman, you can do it by following the steps listed in the APPENDIX to this part under the chapter How to configure proxy for Plugman

Let’s continue now with the third and last part!



APPENDIX

How to configure proxy for npm

These are the steps if you want to manually configure the proxy for the “npm” command:

1) Run the command

npm config list

to check that there is any proxy set for npm. Should you need to delete any old proxy information from npm configuration you can use the two commands:

npm config del proxy

npm config del https-proxy

2) Run

npm config set proxy <protocol>:://<proxyhost>:<proxyport>

to set the http proxy

3) Run

     npm config set https-proxy <protocol>:://<proxyhost>:<proxyport>

to set the https proxy

4) Run again the

     npm config list

command

5) Check that now the proxy information is set correctly

/wp-content/uploads/2015/07/2015_07_09_09_47_01_743990.jpg

How to configure proxy for Git client

These are the steps if you want to manually configure the proxy for the “git” command:

1) Run the command

git config –list

to check that there is any proxy set for Git. Should you need to delete any old proxy information from Git configuration you can use the two commands:

     git config –global –unset http.proxy

     git config –global –unset https.proxy

2) Run

git config –global http.proxy <protocol>:://<proxyhost>:<proxyport>

to set the http proxy

3) Run

     git config –global https.proxy <protocol>:://<proxyhost>:<proxyport>

to set the https proxy

4) Run again the

     git config –list

command

5) Check that now the proxy information is set correctly

/wp-content/uploads/2015/07/2015_07_09_09_53_17_743991.jpg

How to configure proxy for Plugman

These are the steps if you want to manually configure the proxy for the “plugman” command:

1) Run the command

plugman config list

to check that there is any proxy set for Plugman. Should you need to delete any old proxy information from Plugman configuration you can use the two commands:

plugman config del proxy

plugman config del https-proxy

2) Run

plugman config set proxy <protocol>:://<proxyhost>:<proxyport>

to set the http proxy

3) Run

     plugman config set https-proxy <protocol>:://<proxyhost>:<proxyport>

to set the https proxy

4) Run again the

     plugman config list

command

5) Check that now the proxy information is set correctly

/wp-content/uploads/2015/07/2015_07_09_10_01_24_743992.jpg

Assigned Tags

      20 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Laurent RIEU
      Laurent RIEU

      HI Simmaco

      i am having issues with the HAT installer. Keeps saying that i have not added the various HOME variables to the Path (which i have done), and cannot seem to recognize the Android SDK is installed (i've installed it twice, using different paths - same results).

      While i can fix the HOME thing with the installer (option to fix the issue - nothung changes in the Path variable but seems to work) i am still struggling with the Android SDK not being detected.

      Any clue?

      thanks!

      laurent

      Author's profile photo SIMMACO FERRIERO
      SIMMACO FERRIERO
      Blog Post Author

      Laurent,

      could you please send me some screen shots of how you defined your ANDROID_HOME variable? You can also send me an email with them.

      Did you define that as a system variable? Are you sure that the path is correct?

      Regards,

      Simmaco

      Author's profile photo Arun Rajamani
      Arun Rajamani

      Even i have the same issue .

      Author's profile photo Laurent RIEU
      Laurent RIEU

      things went ok on my side when i started using System variables only as Simmaco suggested.

      Author's profile photo Former Member
      Former Member

      It says node 10.40 in the first part of that blog. But in this second part, I find:

      NOTE: You MUST NOT install the latest version, but just a specific version which is 10.3x. In this guide I'm going to install the 10.38 - 64bit.



      Author's profile photo Former Member
      Former Member

      Hi,

      I'm trying to check HAT pre requisites, and I got an error on step 5

      ERROR:

      cordova add android platform error!

      npm http GET http://registry.npmjs.org/cordova/cordova-android

      npm http GET http://registry.npmjs.org/cordova/cordova-android

      npm http GET http://registry.npmjs.org/cordova/cordova-android

      Unable to fetch platform android: Error: getaddrinfo ENOTFOUND

      I have already set my .npmrc file:

      proxy=http://proxy:8080/

      https-proxy=https://proxy:8080

      registry=http://registry.npmjs.org/cordova

      strict-ssl=false

      But I still have the same issue. Could, please, help me.

      Author's profile photo Sudarshan David
      Sudarshan David

      Hi   SIMMACO FERRIERO,


      I had succesfully completed the part 1 and part 2 installation process and while installing HAT command script which is extracted. It get an error.

      /wp-content/uploads/2016/01/error_873788.gif

      Author's profile photo Sudarshan David
      Sudarshan David

      Please reply how to overcome this error!!!!

      regards,

      sudarshan

      Author's profile photo Sudarshan David
      Sudarshan David

      hi ,

      I have installed the version required. Do I have to repeat the step again.

      regards,

      sudarshan

      Author's profile photo SIMMACO FERRIERO
      SIMMACO FERRIERO
      Blog Post Author

      Yes, you need to repeat the step.

      Regards,

      Simmaco

      Author's profile photo Former Member
      Former Member

      hi simmaco,

      i have problems for instaling the kapsel cli, the path is correct, i change the proxy config of the npm an show me this:

      Captura.JPGplease help.

      regards,

      simón.

      Author's profile photo SIMMACO FERRIERO
      SIMMACO FERRIERO
      Blog Post Author

      Hi Simon,

      try by reverting everything as without the proxy. Then go inside HAT installation folder and run the command "proxy.cmd on". This should set everything for you automatically.

      In case you need to switch off the proxy you simply run "proxy.cmd off".

      Regards,

      Simmaco

      Author's profile photo Former Member
      Former Member

      Hi SIMMACO FERRIERO,

      When I try to configure the proxy settings in command prompt (which you provided above) it's not executing...Please help me.

      regards,

      Bhargav

       

      Author's profile photo Former Member
      Former Member

      Hi Simmaco,

      I have completed part1 &2..while I run the setup.cmd in the HAT above screen appearing can you please help me.

       

      regards,

      Bhargav

      Author's profile photo Former Member
      Former Member

      I had this error I thinks that's because incompatibility between Node Version & NPM version

      what I can do?

      any advice .. ?

      Author's profile photo Former Member
      Former Member

      Hi Beshoy

      I am also facing the same issue, If you had found any solution please help me with the same.

      Author's profile photo Former Member
      Former Member

      Hi Ashwin,

      Please delete the existing npm folder from the windows user(C:\Users\xxxxx\AppData\Roaming) and reinstall the node.js

      Please let me know if you did successfully.

      Thanks & Regards,

      Satya Kudumula

      Author's profile photo Former Member
      Former Member

      Hi Sathya

      Thanks and I got it installed successfully.

      Author's profile photo Ludo Noens
      Ludo Noens

      This blog post is outdated. We have reached end-of-maintenance for HAT local add-on. You can no longer download this tool from the SAP Store. We no longer support this tool. You are strongly advised to make use of our Cloud Build Service provided through Mobile Services. More information can be found here: https://blogs.sap.com/2018/08/16/announcing-end-of-maintenance-for-hybrid-app-toolkit-local-add-on-local-builds-only

      Ludo Noens
      Product Owner - Hybrid Application Toolkit

      Author's profile photo Khalid ABDELMOUNIM
      Khalid ABDELMOUNIM

      hi

      i need link to download Hybrid Application Toolkit

      Thamks