How to take a video of an Android device from shell

If you develop for Android you might want to be able to capture your screen to show a bug or the differences between two things and ask for suggestions.
So to do so we need adb installed and configured.

First of all make sure that adb sees your device:


adb devices

Then you can launch the recording session:


adb shell screenrecord /sdcard/android-video-capture.mp4

adb shell screenrecord --help
Usage: screenrecord [options] 

Android screenrecord v1.2.  Records the device's display to a .mp4 file.

Options:
--size WIDTHxHEIGHT
    Set the video size, e.g. "1280x720".  Default is the device's main
    display resolution (if supported), 1280x720 if not.  For best results,
    use a size supported by the AVC encoder.
--bit-rate RATE
    Set the video bit rate, in bits per second.  Value may be specified as
    bits or megabits, e.g. '4000000' is equivalent to '4M'.  Default 4Mbps.
--bugreport
    Add additional information, such as a timestamp overlay, that is helpful
    in videos captured to illustrate bugs.
--time-limit TIME
    Set the maximum recording time, in seconds.  Default / maximum is 180.
--verbose
    Display interesting information on stdout.
--help
    Show this message.

Recording continues until Ctrl-C is hit or the time limit is reached.

Include an extra library from Maven into an Android Project

To include an extra dependency into an Android project we need to:

  1. Go to file and select “Project Structure”:
    Android studio file project structure
  2. Next step it is to select the app section and then the Dependencies tap.
    Open the app tap
  3. At this point we click on the plus sign at the bottom of the window and then we select add library dependency:
    Add library dependency
  4. The last step it is to add the dependency we’re looking for, in my case it is to include the apache commons, so I search for org.apache.commons.io and I select on the package I am interested to and click OK.
    Add external library dependency into project android studio