android-studio Getting started with android-studio

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Insert
> Step 2: And Like the video. BONUS: You can also share it!

Remarks

Android Studio is the official IDE by Google for Android app development, based on IntelliJ IDEA. [1]

It utilizes a Gradle-based build system through the Android Plugin for Gradle. [2]

Versions

VersionRelease Date
0.1.x2013-05-01
0.2.x2013-07-01
0.3.22013-10-01
0.4.22014-01-01
0.4.62014-03-01
0.5.22014-05-01
0.8.02014-06-01
0.8.62014-08-01
0.8.142014-10-01
1.02014-12-01
1.0.12014-12-02
1.1.02015-02-01
1.2.02015-04-01
1.2.12015-05-01
1.2.22015-06-01
1.3.02015-07-01
1.3.12015-08-01
1.3.22015-08-02
1.4.02015-09-01
1.4.12015-10-01
1.5.02015-11-01
1.5.12015-12-01
2.02016-04-01
2.1.02016-04-02
2.1.12016-05-01
2.1.22016-06-01
2.1.32016-08-01
2.2.02016-09-01
2.3.02017-03-02
2.3.12017-04-02

Installation or Setup

Windows

  1. Verify that you have the correct JDK. You can check it by opening command prompt (press windows key and write cmd ). In the command prompt type javac -version , this will show the current version of JDK installed on your matching or an error* if Java is missing. If the JDK is not available or the version is lower than 1.8, download the Java SE Development Kit 8.

  2. Download the latest Android Studio.

  3. Launch the downloaded .exe file.

  4. Follow the wizard to install Android Studio

  5. After installation completes, open Android Studio from the shortcut that has been made on Desktop during the installation process.

  6. When you open Android Studio for first time, it may ask you to copy your previous settings, but as it is your first time you can simply choose not to copy anything.

  7. Then Android Studio ask to download the required API's to develop Android apps. Download those, after downloading the IDE will open and you will be able to write your first app.

Mac

  1. Verify that you have the correct JDK. You can check it by opening terminal (press command + space and write terminal). In the command line type javac -version, this will show the current version of JDK installed on your matching or an error* if Java is missing. If the JDK is not available or the version is lower than 1.8, download the Java SE Development Kit 8. **

  2. Download the latest Android Studio.

  3. Launch the downloaded .dmg file.

  4. Drag and drop Android Studio into the Applications folder, then launch Android Studio.

  5. Open Android Studio.

  6. When you open Android Studio for first time, it may ask you to copy your previous settings, but as it is your first time you can simply choose not to copy anything.

  7. Then Android Studio ask to download the required API's to develop Android apps. Download those, after downloading the IDE will open and you will be able to write your first app.

Linux

  1. Verify that you have the correct JDK. You can check it by opening terminal (press command + space and write terminal ). In the command line type javac -version , this will show the current version of JDK installed on your matching or an error* if Java is missing. If the JDK is not available or the version is lower than 1.8, download the Java SE Development Kit 8. **

  2. Download the latest Android Studio.

  3. Unzip/extract Android Studio in a specific folder.

  4. Open terminal and go the path where you have extracted the Android Studio. (Then, use cd command to go inside the Android Studio folder.) After going in we need to go inside bin folder so again,use command cd bin and enter.

  5. Now we need to change the mod of our required file i.e studio.sh to do so enter command sudo chmod 777 -R studio.sh , press enter and write your password(if any) and enter. (Also you can see the list of files present inside bin by command ls .).

  6. After changing mod we just have to run the .studio.sh file to do so enter command ./studio.sh

  7. When you run above command Android Studio launch for first time, it may ask you to copy your previous settings, but as it is your first time you can simply choose not to copy anything.

  8. Then Android Studio ask to download the required API's to develop Android apps. Download those, after downloading the IDE will open and you will be able to write your first app.

You may encounter "unable to run mksdcard SDK tool" when you are installing android studio in 64 bit ubuntu os because studio requires some 32 binaries. To overcome this error finish and close Android Studio & go to terminal and run sudo apt-get install lib32z1 lib32ncurses5 lib32bz2-1.0 lib32stdc++6 . Once installation is completed for these binaries again go back to step 6 and resume installation process.

Notes

  • If you have already installed JDK and still getting then make sure you have set JAVA_HOME in your System Variables . You can check this answer on how to setup one.

  • There are, however, known stability issues in Android Studio on Mac when using JDK 1.8. Until these issues are resolved, you can improve stability by downgrading your JDK to an older version (but no lower than JDK 1.6).

  • While the Android Studio download completes, verify which version of the JDK you have: open a command line and type javac -version . If the JDK is not available or the version is lower than 1.8, download the Java SE Development Kit 8.

  • If you are running a 64-bit version of Ubuntu, you need to install some 32-bit libraries with the following commands:

    sudo dpkg --add-architecture i386
    sudo apt-get update
    sudo apt-get install lib32z1 lib32ncurses5 libbz2-1.0:i386 lib32stdc++6

  • If you are running 64-bit Fedora, the command is:

    sudo yum install zlib.i686 ncurses-libs.i686 bzip2-libs.i686

Problem with downloading

  • If you would face any issue like message that your system is not compatible with Android Studio (it may happen when you're using web browser different than Chrome) download Android Studio from: http://tools.android.com/

That's it!

Preview Different Screen Size (Devices) and Orientations

2.1.3

1. Preview Different Devices

There is a preview panel at the right of the android studio. In thispanel there is a button with device name with which you are previewing the UI of your app like this .

enter image description here

Click on small dropdown indicator of this and a floating panel will appear with all the predefined devices. You can select any of them to preview your App UI with different devices mentioning their screen sizes.

Check this image

enter image description here

2. Switching Orientation

And Next to this button there is another button like

enter image description here

Clicking to its dropdown a floating panel will appear with some options like portrait , landscape etc. select one of them to preview in different orientations.
Check the this image

enter image description here

2.2.0

The option to preview all screen sizes is not available from Android Studio 2.2 Beta 2. However, you can resize the preview screen to see how your layout would look on different screen sizes, as shown in the attached.

Android Studio 2.2 Beta 3 Preview Screen resize example

Check: Android Studio 2.2 Preview all screen sizes missing

Use your favorite tool shortcuts in Android Studio

Go to File > Settings > Keymap and select the Keymaps option from:

  • Mac OS X
  • Emacs
  • Visual Studio
  • Eclise
  • Netbeans
  • Jbuilder

and others, to map the shortcuts to the wanted tool ones.

Useful shortcuts

Navigation Shortcuts

 Go to class                       Ctrl+N
 Go to file                        Ctrl + Shift + N
 Navigate open tabs                ALT + Left-Arrow; ALT + Right-Arrow
 Lookup recent files               CTRL + E
 Go to line                        CTRL + G
 Navigate to last edit location    CTRL + SHIFT + BACKSPACE
 Go to declaration                 CTRL + B
 Go to implementation              CTRL + ALT + B
 Go to source                      F4
 Go to super Class                 CTRL + U
 Show Call hierarchy               Ctrl + Alt + H
 Search in path/project            CTRL + SHIFT + F
 

Navigation Shortcuts - Mac OS X

 Go to line number                 CMD + L
 

Programming Shortcuts

 Reformat code                       CTRL + ALT + L
 Optimize imports                    CTRL + ALT + O
 Code Completion                     CTRL + SPACE
 Issue quick fix                     ALT + ENTER
 Surround code block                 CTRL + ALT + T
 Rename and refactor                 Shift + F6
 Line Comment or Uncomment           CTRL + /
 Block Comment or Uncomment          CTRL + SHIFT + /
 Go to previous/next method          ALT + UP/DOWN
 Show parameters for method          CTRL + P
 Quick documentation lookup          CTRL + Q
 Project                             Alt+1     
 Version Control                     Alt+9    
 Run                                 Shift+F10     
 Debug                               Shift+F9     
 Android Monitor                     Alt+6     
 Return to Editor                    Esc     
 Hide All Tool Windows               CTRL +Shift+F12
 Auto generate code(constructor,    
      getter/setter etc)             Alt+insert
 Code completion                     CTRL+Space
 Smart code completion
    (by expected type)               CTRL+Shift+Space
 Show quick fix                      CTRL+Enter
 Duplicate Line                      Ctrl+D
 Delete Line                         Ctrl+Y
 


Got any android-studio Question?