Build and Run Your Hybrid App on Android
Before building, be sure that you’ve installed Android Studio, including Android SDK and at least one Android emulator. Refer to the Android requirements for Mobile SDK to make sure you install the correct versions of the Android components.
After you’ve run cordova prepare
, build and run the project.
To run the app in Android Studio:
-
Launch Android Studio.
-
From the welcome screen, select Import project (Eclipse ADT, Gradle, etc.). Or, if Android Studio is already running, select File | New | Import Project.
-
Select
<*your_project_dir*>/platforms/android
and click OK. If you’re prompted to use the Gradle wrapper, accept the prompt. -
After the build finishes, select the
android
target and click Run ‘android’ from either the menu or the toolbar. -
Select a connected Android device or emulator.
If Android Studio offers to update your Gradle wrapper version, accept the offer. After the process finishes, Android Studio automatically re-imports your project.