Monday, August 26, 2013

Configuring Apache Cordova Android project in Android Studio

The earlier blogpost describes setting of Apache Cordova Android project in eclipse.

There is another good tool Android Studio along with Eclipse for Android development which we will be looking at in this blog post. If you want to continue using Eclipse only as your IDE you can skip. And if you want to try out Android Studio, continue following this blog post.

Android Studio Installation


Android Studio is the latest development built on top of Intellij IDEA. Android Studio is integrated Android development IDE which includes all the required developer tools for development and debugging of Android Applications.

Android Studio is currently available as early access preview.


Download the latest version of Android studio from the below website.


Launch the downloaded EXE file, android-studio-bundle-<version>.exe.

Follow the setup wizard to install Android Studio.

As of now there is no direct way to create a Cordova Android project for Android Studio.

So we will have to create a Cordova Android project for eclipse and port it to Android Studio.

Exporting from eclipse


Please check your Eclipse ADT plugin version. If the version is older than 22.0, upgrade it to the latest version.

 In Eclipse, select File > Export.


In the window that appears, open Android and select Generate Gradle build files.


Select the project you want to export for Android Studio and click Finish.


Your selected project remains in the same location but now contains a build.gradle file and is ready for Android Studio.



Importing into Android Studio


Launch the Android Studio IDE with Administrator role. Right now there are some permission issues with user roles other than Administrator which is expected to be fixed in the next version of Android Studio (0.2.6).

Click on Import Project.


Locate the project you exported from Eclipse, expand it, select the build.gradle file and click OK.


In the following dialog, leave Use gradle wrapper selected and click OK. (You do not need to specify the Gradle home.)


It will take some time to complete the import since it will do the necessary downloads for Gradle if you are using Android Studio for the first time. Also,it will take some time to complete the indexing of the files. Android Studio is slow in doing this.

Running Project from Android Studio


Once the project import is completed, click on the run button in the menu bar.


Android Studio will ask for the device in which the application needs to be launched from the list of AVD's available on your system.


Select the emulator on which you want the application to run and Android Studio will launch that emulator, install the application into that emulator and will run the application in the emulator.



We have just created a blank Cordova Android project and so will just see the screen above. In the later posts we will modify the project and view the changes in the emulator.

12 comments:

  1. this is nonsense it doesn't work

    ReplyDelete
  2. Android allows you to customize your app the way you like it - that's the foremost reason why developers love developing apps on Android than any other platforms.ShowBox APK

    ReplyDelete
  3. Also, it does not regulate the Android devices launched by various manufacturers. Hence, the devices come with varying hardware features despite being powered by the same version of Android.Download ShowBox APK

    ReplyDelete
  4. Thus, the prospects for Android development are now potentially infinite as more and more unique Android apps are being created every day. Custom Software Development Company

    ReplyDelete
  5. Nice information sharing. If any one wants to develop mobile app in 50% percent discount then please visit limratechnosys.com. Limra Technosys is leading mobile app development company in Mumbai

    ReplyDelete
  6. Nice and good article. It is very useful for me to learn and understand easily. Thanks for sharing your valuable information and time. Please keep updating.
    Top Web Design Training India

    ReplyDelete
  7. I read that Post and got it fine and informative. Android

    ReplyDelete
  8. Thus, the prospects for Android development are now potentially infinite as more and more unique Android apps are being created every day.If any one wants to develop mobile app in 50% percent discount then please visit prolifiquetech.com.Mobile app development company in mumbaiSoftware development company in mumbai

    ReplyDelete
  9. Very useful post. This is my first time i here. I found so many interesting stuff in your blog especially its discussion. Really its great article. Keep it up.
    Tax preparer

    ReplyDelete
  10. I would like to say that this blog really convinced me to do it! Thanks, very good post.
    useful content

    ReplyDelete