It's essential for creating, debugging, and testing Android apps.
Mac OS X IssueAfter installing Android Studio, I couldn't start VMware Fusion virtual machines on my Mac--I got this error:Could not open /dev/vmmon: No such file or directory.This problem is caused by the Intel Hardware Accelerated Execution Manager (HAXM).
One workaround is to restart the Mac. After a restart, VMware Fusion works.
Another workaround is to unload the Intel HAXM module with this Terminal command:There are several links at the end of this project explaining Intel HAXM.
sudo kextunload -b com.intel.kext.intelhaxm
But you'll be dependent on the lab to do future projects, and the lab can get crowded. It'll be a lot more conveneint for you to set this up on your own computer.
Follow the instructions on the Web page to download and install Android Studio for your OS. The Mac version is 234 MB in size, but the Windows version is 828 MB.
Finish the install and launch Android Studio.
A box pops up, asking if you want to import settings from a previous installation. Accept the default selection refusing to do that.
The Setup Wizard launches. Click Next.
If you are using a PC, start the installation process.
In either case, you will probably see a screen saying that you need the Java SDK, as shown below.
In the Android Studio Setup Wizard, click the blue link.
Download the correct Java SDK for your OS, as shown below.
Install the Java SDK, with the default options.
Install Android Studio with the default options.
Accept all the license agreements, of course.
It's a long process, with a lot of files downloaded and installed.
You should see the "Welcome to Android Studio" screen, as shown below.
On the right side, click "Start a new Android Studio project", as shown below.
In the "New Project" screen, enter an Application name of YOURNAME-hello, as shown below.
Don't use the literal text "YOURNAME" -- replace that with your own name.
The next screen asks which versions of Android you are targeting, as shown below.
Accept the default selection and click Next.
In the "Add an activity to Mobile" screen, accept the default selection of "Blank Activity" as shown below, and click Next.
In the "Choose options for your new file" screen, accept the default selections as shown below, and click Finish.
If you are using Windows, it will spend several minutes "Indexing".
Other messages go by, initializing things and "Building".
When all that stuff is done, a project page appears, as shown below.
If "Windows Firewall" boxes pop up, approve Java to access the Internet.
If a "Tip of the day" pops up, close it.
If a "Rendering problems" box appears, close it.
However, if a "Gradle project sync failed" message appears, as shown above, that means you have errors that matter, probably Java errors.
Java fails to work most of the time. It is maddening, but there's no way to escape it.
The most common problem is that the Java files are installed in a directory that the application cannot find. It's been this way for many years, and somehow Java never fixes it.
Here's what I did, but your errors will probably be different. Expect this to take time and a lot of Googling.
In my case, there is a yellow bar saying "Gradle project sync failed...", and a pop-up box titled "Language Level Changed", as shown above.
In the pop-up box titled "Language Level Changed", click Yes.
The project reloads. Now the lower pane shows some Java error messages, as shown below.
Open a Terminal window, and execute this command:
The response tells you where Java is installed, as shown below.
On my Mac, Java is installed at
In the lower pane of Android Studio, click "Open SDK Settings".
As you can see below, the "JDK location" is wrong.
Copy and paste in the correct location, as shown below.
Then click OK.
Android Studio displays a yellow bar at the top, saying "Gradle sync in progress".
After that, the "Language Level Changed" box pops up again. Click Yes.
The left pane shows the files in your app.
A much easier way to control your app is to use the right pane. Click the activity_main.xml tab.
The center now shows the screen of a phone, showing "Hello world!" in tiny letters, as shown above. This is a graphical view of how your app will look on a phone.
In the lower right of the Android Studio window, in the Properties section, scroll down to textSize and change the size to 40. Press Enter. The "Hello world" text gets larger, as shown below.
On the phone face, double-click "Hello world".
A little box appears with a "text" field containing "@string/hello_world", as shown below.
Replace the "@string/hello_world" text with this text:
Hello from YOUR NAME
Use your own name, not the literal text "YOUR NAME".
In the "id" field, enter
YOURNAMEReplace "YOURNAME" with your own name, without any embedded spaces, as shown below.
The phone face should now show the revised message containing your name, as shown below.
Save a full-desktop image of this screen. On a Mac, press Shift+Commmand+3. On a PC, press Shift+PrntScrn and paste into Paint.
YOU MUST SUBMIT A FULL-SCREEN IMAGE FOR FULL CREDIT!
Paste the image into Paint.
Save the image with the filename "YOUR NAME Proj 1", replacing "YOUR NAME" with your real name.
stackoverflow: Error:compileSdkVersion android-21 requires compiling with JDK 7
Intel® Hardware Accelerated Execution Manager
Installation Instructions for Intel® Hardware Accelerated Execution Manager - Mac OS X*
Fusion 5 - Could not open devvmmon: No such file or directory.