How To Run Ionic 4 App In Your Android Device Step By Step guide [2021]

Some Files You Need To Download

  1.  Download Java JDK 8
  2. Download and install Android Studio and Updated Android SDK tools, platform, and component dependencies. Available through Android Studio’s SDK Manager. if you would not update the android component then you will get many errors so keep in mind to update your android studio with the latest component dependencies.
  3.   Download gradle 6.5

Now set an environment variable

Here I am showing how to open the Environment Variables tab in the windows operating system.

Windows 10

  1. In Search,  type “env” and hit enter
  2. Click Environment Variables.
  3. Click Environment Variables. In the section User Variables,

Windows 7

  1. From the desktop, right-click the Computer icon.
  2. Choose Properties from the context menu.
  3. Click the Advanced system settings link.
  4. Click Environment Variables. In the section system Variables,

 

Now create 3 new variables

  • ANDROID_HOME
  • ANDROID_SDK_ROOT
  • JAVA_HOME 
  • GRADLE_USER_HOME
  • Path

Here I am showing you my path of SDK and JDK

create a variable ANDROID_HOME and give the path of SDK example below
C:\Users\myname\AppData\Local\Android\sdk

#2 create a variable ANDROID_SDK_ROOT and give the path of SDK again example below
C:\Users\myname\AppData\Local\Android\sdk

#3 create a variable JAVA_HOME and give the path of JDK example below
C:\Program Files\Java\jdk1.8.0_112

#4 create a variable [GRADLE_USER_HOME] and give the path of  example below

C:\gradle-6.5\bin

#5  create a variable in system variable  and give the path of sdk platform-tools and gradle

C:\gradle\bin

C:\Users\myname\AppData\Local\Android\sdk\platform-tools

 

Android studio gradle path setting

go to files >> setting  >> gradle  give your path see below image.

gradle path in android studio

 

Enable USB debugging on your Android phone

  1. Open the Settings app.
  2. Select System.
  3. Scroll to the bottom and select About phone.
  4. Scroll to the bottom and tap the Build number 7 times.
  5. Return to the previous screen to find Developer options near the bottom.
  6. Scroll down and enable USB debugging.
  7.  also, enable install via USB  mode.

 

Now build your android app by this command

ionic build android

Now add your device by this command

adb devices

Now use this command to run your app in connected android device

ionic cordova run android

Leave a Comment