The purpose of this section is to guide you to install in your development environment all the dependencies for Android development.
At the core of Android Studio is an intelligent code editor capable of advanced code completion, refactoring, and code analysis. The powerful code editor helps you be a more productive Android app developer. Yes you need Mac for development for any apple product. There is no alternate for this. Android (operating system) Is MacBook good to develop iOS/Android apps using Xamarin with Visual Studio? Update Cancel. A d by GitKraken. What are good Git GUI clients for Windows? GitKraken is cross-platform, has a beautiful UI, is easy to setup/use.
The fastest way is to download and install Android Studio.
Latest current version for Android Studio is available at: https://developer.android.com/studio/index.html
Select the Installer Icon:
To install Android Studio on your Mac, proceed as follows:
- Launch the Android Studio DMG file.
- Drag and drop Android Studio into the Applications folder, then launch Android Studio.
- Select whether you want to import previous Android Studio settings, then click OK.
- The Android Studio Setup Wizard guides you though the rest of the setup, which includes downloading Android SDK components that are required for development.
Click the Next button.
Select a Standard installation and click Next.
On the Verify Settings window, click Finish.
Once installed, you get the Welcome to Android Studio window :
Click on the Configure Button and select SDK Manager:
In the left pane select Android SDK. On the right pane, select the SDK Platforms Tab and select the SDKs for API level 22 up to 24.
Click the OK button to download and install these Android SDKs.
After accepting the licence you should see the following screen:
Wait until all components are installed.
Setup the ANDROID_HOME system variable
Open the SDK Manager and make a copy of the Android SDK Location :
Open the Terminal app and type the following command:
To check the ANDROID_HOME is correctly setup type the following commands:
You should see the following result:
Persist the ANDROID_HOME system variable for the current user
The ANDROID_HOME system variable must be persisted when you leave and resstart a new Terminal Window.
One way to do this is to create or update a .profile file in the user's home directory. This file should contain all the commands that should be executed before the Terminal Window session starts.
Open the Terminal app and type the following commands:
In the Text Editor, add the following line
You should have a screen similar to the following screenshot:
To save the .profile file, type
CTRL + X
, then type Y
followed by the ENTER
key.Once done, quit the Terminal window, reopen a new one and type the following command to check if the system variable has been persisted:
You should have a non empty response.
References
-->To connect to the Android Emulator running on a Mac from a Windowsvirtual machine, use the following steps:
- Start the emulator on the Mac.
- Kill the
adb
server on the Mac: - Note that the emulator is listening on 2 TCP ports on the loopbacknetwork interface:The odd-numbered port is the one used to connect to
adb
. See alsohttps://developer.android.com/tools/devices/emulator.html#emulatornetworking. - Option 1: Use
nc
to forward inbound TCP packets received externally on port 5555 (orany other port you like) to the odd-numbered port on the loopbackinterface (127.0.0.1 5555 in this example), and to forward theoutbound packets back the other way:As long as thenc
commands stay running in a Terminal window, thepackets will be forwarded as expected. You can type Control-C inthe Terminal window to quit thenc
commands once you're doneusing the emulator.(Option 1 is usually easier than Option 2, especially if System Preferences > Security & Privacy > Firewall is switched on.)Option 2: Usepfctl
to redirect TCP packets from port5555
(or any other port youlike) on theShared Networking interface tothe odd-numbered port on the loopback interface (127.0.0.1:5555
in this example):This command sets up port forwarding using thepf packet filter
system service. The line breaks are important. Be sure to keep themintact when copy-pasting. You will also need to adjust theinterface name from vmnet8 if you're using Parallels.vmnet8
isthe name of the special NAT device for the Shared Networkingmode in VMWare Fusion. The appropriate network interface inParallels is likelyvnic0. - Connect to the emulator from the Windows machine:Replace 'ip-address-of-the-mac' with the IP address of the Mac, for example as listed by
ifconfig vmnet8 | grep 'inet '
. If needed, replace5555
with the other port you like from step 4. (Note: one way to get command-line access toadb
is via Tools > Android > Android Adb Command Prompt in Visual Studio.)
Alternate technique using ssh
If you have enabled Remote Login on the Mac, then you can use
ssh
port forwarding to connect to the emulator.- Install an SSH client on Windows. One option is to installGit for Windows. The
ssh
command will then be available in the Git Bash command prompt. - Follow steps 1-3 from above to start the emulator, kill the
adb
server on the Mac, and identify the emulator ports. - Run
ssh
on Windows to set up two-way port forwarding between alocal port on Windows (localhost:15555
in this example) and theodd-numbered emulator port on the Mac's loopback interface(127.0.0.1:5555
in this example):Replacemac-username
with your Mac username as listed bywhoami
. Replaceip-address-of-the-mac
with the IP address ofthe Mac. - Connect to the emulator using the local port on Windows:(Note: one easy way to get command-line access to
adb
is viaTools > Android > Android Adb Command Prompt in Visual Studio.)
A small caution: if you use port
5555
for the local port, adb
willthink that the emulator is running locally on Windows. This doesn'tcause any trouble in Visual Studio, but in Visual Studio for Mac itcauses the app to exit immediately after launch.Alternate technique using adb -H
is not yet supported
In theory, another approach would be to use
adb
's built-in capabilityto connect to an adb
server running on a remote machine (see forexample https://stackoverflow.com/a/18551325).But the Xamarin.Android IDE extensions do not currently provide a wayto configure that option.Contact information
This document discusses the current behavior as of March, 2016. Thetechnique described in this document is not part of the stable testingsuite for Xamarin, so it could break in the future.
![Android Android](https://c.slashgear.com/wp-content/uploads/2013/05/androidstudio.jpg)
If you notice that the technique no longer works, or if you notice anyother mistakes in the document, feel free to add to the discussion onthe following forum thread:http://forums.xamarin.com/discussion/33702/android-emulator-from-host-device-inside-windows-vm.Thanks!