Android Studio is the new IDE (Integrated Development Environment) for Android, replacing Eclipse. See Android Studio Overview.
Installation on Microsoft Windows and Linux is similar.
www.java.com
and click on “Do I have Java?”.
To download the JDK, go
here
and press the big square download button captioned
“Java Platform (JDK) 8u45”
Scroll down to
“Java SE Development Kit 8u45”
(not “Java SE Development Kit 8u45 Demos and Samples Downloads”)
and select the
.dmg
file for Mac OS X x64.
On my Mac, the JDK was installed into the folder
/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home
.dmg
file
to the Downloads folder on your Macintosh.
(On PC, it’s a
.exe
file.)
~
stands for the full pathname of your home directory.
For the numbers 21 and 22, see
What
is API Level?.
cd ~/Library/Android/sdk/platforms pwd ls -l drwxr-xr-x 11 myname mygroup 374 Mar 22 21:02 android-21 drwxr-xr-x 11 myname mygroup 374 Mar 22 21:16 android-22
import
statements automatically for you.
PATH
environment variable.
Put the following
export
statement into the
.bash_profile
file in your home directory on your Mac.
Each backslash must be the last character on its line.
#Android SDK command-line tools export PATH=\ ~/Library/Android/sdk/tools:\ ~/Library/Android/sdk/platform-tools:\ $PATHOne way to find out if
.bash_profile
already exists,
and to edit it if it does,
is to launch the application
TextEdit
and pull down
.bash_profile
change it to a plain text file:
adb
,
sqlite3
,
and
android
from the shell command line:
echo $PATH | tr : '\n' which adb adb version Android Debug Bridge version 1.0.32 adb --help sqlite3 -version 3.8.10.2 2015-05-20 18:17:19 2ef4f3a5b1d1d0c4338f8243d40a2452cc1f7fe4 sqlite3 -help Usage: sqlite3 [OPTIONS] FILENAME [SQL] etc. android --help | more
We will run our apps in an Android emulator. The emulators provided by Google are too slow, so we will use the third-party emulator Genymotion. If you’re running Genymotion on a machine other than a Windows PC, it will need VirtualBox.
Go to the
VirtualBox
download page
and download the VirtualBox binary for OS X.
Double-click on the VirtualBox
.dmg
file in your Downloads folder.
If the link you need in the VirtualBox download page is broken, try this mirror site for the latest version of VirtualBox.
Create a Genymotion account and activate it. Get a license for the free version of Genymotion and download it. Follow the instructions for installation and getting started.
When you first launch Genymotion,
click on its Settings gear and select the
ADB
tab.
ADB tool connection settings
• Use custom Android SDK tools
Android SDK: /Users/yourname/Library/Android/sdk
(Specify your name in place of yourname).
Press the OK button.
To create an Android virtual device,
click on the Add button in the Genymotion app.
The virtual device I chose to create was a Samsung Galaxy S5.
After you have created the device,
but before you launch it,
click on the wrench icon next to the device in the Genymotion app
and check the checkboxes for Android navigation bar
(the black bar across the bottom of the screen)
and virtual keyboard.
The latter will allow an
EditText
object to slide a keyboard up onto the screen;
see
this app.
Configuration
Android system options
☑ Show Android navigation bar.
☑ Use virtual keyboard for text input.
OK
To launch the Android virtual device, select it in the Genymotion app and press the Start triangle.
If the time displayed by the virtual device is in the wrong time zone, go to the Settings app in the Android virtual device and select Date & time. Uncheck the “Automatic time zone” and select your time zone (Eastern Time, GMT −5:00). Then press the device’s Home button.
The Genymotion plugin has to be plugged into Android Studio.
To see if it’s already plugged in,
Android Studio → Preferences…
In the left panel, select Plugins.
In the center panel, select Genymotion.
If the right panel shows an
“×
Uninstall plugin”
button, it means that the Genymotion plugin is already plugged in.
Here are
instructions
for plugging it in; look for
“Genymotion Plugin for Android Studio”.
If the Genymotion emulator gets stuck “Waiting for adb”,
kill and re-start the adb server
with the following commands in the Mac Terminal.
The
-
is a dash.
You may also have to quit and restart the emulator,
and maybe also Android Studio.
adb kill-server adb start-server
One of the students kindly supplied the following notes.
To give you some feedback on running Android Studio on Windows, when I installed Android Studio on Windows 7 I noticed a few differences:
Suppose you wanted to to erase everything we installed above, either because you suspect you botched it and want to make a clean start, or because you’re just giving up. Launch VirtualBox, remove your virtual machines, and quit VirtualBox. Then remove the following files and directories.
~/Downloads/android-studio-ide-*.dmg
~/.android
~/Library/Android
~/AndroidStudioProjects
/Applications/Android Studio.app
~/Downloads/VirtualBox-*.dmg
/Applications/VirtualBox.app
~/Downloads/genymotion-*.dmg
~/.Genymobile
/Applications/Genymotion.app
/Applications/Genymotion Shell.app
Start looking at the apps we will do in class.