Вы находитесь на странице: 1из 7

Steps to build and run the cordova sample app:

Instructions:

MAC:

Open the terminal, type the command.


$ cordova -version.
If “Command not found” need to install the cordova.

Cordova Installation:

1.To install the Cordova Utility. In the terminal, run the command:
$ sudo npm install -g cordova
2. To verify cordova installation, run the following below command.
$ cordova —version.

Set Up Android Project:

1. Run the command to create a project;


$ cordova create hello com.example.hello HelloWorld

Note: a. “hello” indicates project directory.


b. HelloWorld indicates Project Name.
2. Change directory to project director.
$ cd hello

Adding the Platforms:

1. Add the platforms that you want to target your app.


hello  $ cordova platform add android

2. To check your current set of platforms.


hello $ cordova platform ls

Adding the Plugins:

1. Add the plugin to project


hello $ cordova plugin add PATH_TO_PLUGIN.

(e.g $ cordova plugin add https://github.com/CAAPIM/Cordova-MAS-


Foundation.git)
(PATH_TO_PLUGIN can be downloaded plugin repo (or) git clone URL).

2. Change the index.html file of newly created project with Plugin


index.html file.

Replace the sample index.html file


PROJECT_DIR_NAME/www/index.html with
PROJECT_DIR_NAME/plugins/cordova-plugin-mas-
core/sample/html/index.html.

3. To update the index.html to specific project, run the following


command:
hello $ cordova prepare

4. Add a valid “msso_config.json “ of your gateway into your project


directory. For more information about “msso_config.json”.

5. Run the following command to build the project for all platforms.
hello $ cordova build

6. You can optionally limit the scope of each build to specific platform -
“android” in this case;
hello $ cordova build android

Importing of Android project needs to open the


<DIR>/platforms/android folder in android studio.

7. And also add Android(.aar file):

Need to add .aar file which is generated from native app to have
communication between the java classes and js files.
(e.g masauth-debug.aar)

Add through android studio.


Select the file add click New  new module  select “+” icon top left


select the import JAR/.AAR Package.
And Click Next….

In the next screen, need to select the path .aar folder and say “finish”..

Immediately, select “app” and open “Dependencies “


Click on “+” add as dependent library and say “Finish “.
After that restart your android studio..

Test the App:


1. Running the app, Click the green color triangle icon top middle.
Select the real device to run the app, Which installs the app to your
device..

Вам также может понравиться