Saturday, March 18, 2017

Cordova Setup In Android Studio


  1. In Cordova you can also build mobile app using with CLI(Command Line interface). but many people using android studio so i think its better practice to build your mobile app in android studio.
  2. Using android studio you can build and test your mobile app in emulator or on your mobile device in faster way.
  3. So before setting up in project in android studio you have to create project in cordova by using following commands.
                                                          First create a project. 

                                  cordova create hello com.example.hello HelloWorld

                                          Once project is created entered into project folder 

  cd hello

After entering into the project folder add platform android

C:\users\sushant\hello> cordova platform add ios  android --save

       4. Once you completed all above steps launch your android studio.
       5. Select option "Open an  existing Android Studio Project".
                   


       6. After that browser your cordova project directory. Goto your project directory for e.g project                directory is  sampleX then select platforms  -> android directory once selected android                       directory press Ok button.


  
      7. Gradle Sync dialoug box will open just click on Ok . wait for to build Gradle completely.


 8. Now Goto Project tab which on left of android studion and select Project option from it

              Once you setup cordova project in android studio. you will get all yours project files in                         assets/www folder and index.html is launching page of your app.
          
    9. Now build and test mobile app on your mobile device.so you are required to follow some steps.
         1. First Goto your mobile device setting option  enable Developer options for enabling this option you must goto About phone -> tap 3 times on build number option once done you will see the toast mesage saying you are developer now.
         2. Goto to Developer option and enable it and also enable USB debugging  
         3. Now connect your mobile device with your pc using USB cable.
         4. After that select Run/Debug configuration option in android studio. steps as follow:-

               1. Select Edit Configuration  option


      2. after clicking Edit configuration option following dialog box will open, in that select                            Deployment Target Options -> USB Device
                 
      3. Then Run the project on clicking Run button in android studio. In bottom android monitor                   option display your mobile device name means your device connected successfully. 
         
    4. In end test your mobile app on your device once your mobile app build successfully.

   
   

No comments:

Post a Comment

Cordova Push Notification Using Firebase & Onesignal Plugin

What is Push Notification Push notification is one of the best way to send messages to app user and its simplest way to reach to the a...