Some Files You Need To Download
- Download Java JDK 8
- 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.
- 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
- In Search, type “env” and hit enter
- Click Environment Variables.
- Click Environment Variables. In the section User Variables,
Windows 7
- From the desktop, right-click the Computer icon.
- Choose Properties from the context menu.
- Click the Advanced system settings link.
- 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.
Enable USB debugging on your Android phone
- Open the Settings app.
- Select System.
- Scroll to the bottom and select About phone.
- Scroll to the bottom and tap the Build number 7 times.
- Return to the previous screen to find Developer options near the bottom.
- Scroll down and enable USB debugging.
- 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