Note: For up-to-date product documentation, see the IBM MobileFirst Foundation Developer Center.

Running a Cordova Project in Android Studio

Develop your Cordova app with MobileFirst for Android using Android Studio.

Before you begin

You must have a Cordova app project set up with Apache Cordova CLI (see Creating a new Cordova app without the MobileFirst template).


  1. If you have not already done so, from the command line run
    cordova prepare

    This creates the file in the assets folder. If this file does not exist, you cannot run your app.

  2. Open the project in Android Studio.
    1. From Android Studio select File->New->Import Project.
    2. Navigate to the build.gradle file in project name and click OK.
  3. In the project navigator pane the project looks like this:
    Table 1. Android Studio navigation pane
    Android Studio navigation pane Description of selected files
    Android Studio


    One of the functions of the AndroidManifest.xml file is list the start up code for the app.

    The start up code for the app.


    Various configurations including:
    • Calls hooks.
    • Points to the default html page:
      <content src="index.html" />


    Contains the JavaScript, HTML, and CSS files loaded into the WebView.


    The initial html page loaded by the WebView, defined in the config.xml file.

    The file containing information for connecting to the MobileFirst server. See

  4. Run your application to view it in the emulator.
    1. From the Run menu choose Run Android.
    2. Choose a device from the Device Chooser dialog.
    The app is displayed in the emulator.

What to do next

You now have your Cordova project set up in Android Studio. You must register your app before you can start writing your code. See Registering Cordova applications to MobileFirst Server.