Tuesday, October 10, 2017

Setting up Android studio and running a apk file in Emulator in Mac

These steps are for Mac machine.

Installing Android Studio

Setting JAVA_HOME
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/
export PATH=$PATH:$JAVA_HOME/bin/
Verify like this : $JAVA_HOME/bin/java -version

Setting GRADLE_USER_HOME
export GRADLE_USER_HOME=/scratch/skukkada/OMC_Softwares/gradle-2.14.1/
export PATH=$PATH:/scratch/skukkada/OMC_Softwares/gradle-2.14.1/bin

For Mac, download android-studio(which is a dmg file supported for mac)
open the dmg file and drag dmg into applications. it will show Android-Studio in “Finder” or "Launchpad"
open android studio, click next, select default sdk path click on next..
it would ask for proxy give the proxy details(if you are behind a proxy)

Proxy:
http, host='<proxy url>' port=<port> --proxy=http "platforms;android-25”
enable https also

Click next.. Downloading of the components will start.
It will take lot of time even after connecting to lan.

once the android studio opens, go to SDK manager and in Platform, select version from 7,6,5(all) and update. in SDK tools we need emulator. download these packages.


(Not Required) Setting path for Android home
   export ANDROID_HOME=/Applications/ADT/sdk
   export PATH=$PATH:$ANDROID_HOME/bin

For Mac
Android studio automatically sets Android_Home to : /Users/sriramkukkadapu/Library/Android/sdk

if it is not set you can run: export ANDROID_HOME=$HOME/Library/Android/sdk

Installation is done. Now we need to create a AVD(Android Virtual Device or Emulator)

AVD Manager (Or) Emulator

First set these env variables. In Terminal

export ANDROID_TOOLS=$ANDROID_HOME/tools
export ANDROID_PLATFORM_TOOLS=$ANDROID_HOME/platform-tools
export PATH=$PATH:$ANDROID_TOOLS:$ANDROID_PLATFORM_TOOLS

Go to Android Studio-> AVD Manager -> create virtual device.
Click Next(device selection)
In the System image. install all the android version images(click download link in each of them and download the packages)
Install 8,7 versions

Once the device is ready, 
Open Emulator


we need to install the apk file of the application which you want to run in Emulator
In the mac terminal go to the path where .apk file is present and run this command.

adb install <testapp.apk>

This command will install the application in the emulator(which is currently running).



No comments:

Post a Comment

How to avoid our mails going to spam - FIx the issue in 3 simple steps

If you see our emails from (info@jobcurator.in) are going to spam, fix it using below steps. Note: Try this in desktop/laptop 1) Go to any...