Android Debugging is not working

PROBLEM

You add breakpoints and you cannot debug your code.

CAUSE

The problem might be that you have ProGuard enabled in the gradle file.

buildTypes {
  release {
     minifyEnabled true
}

SOLUTION

So if you set minifyEnabled to FALSE, your debugging should start working.

If this is not the issue, then you can try restart AndroidStudio or your device.

Genymotion Get Google Play Services

If you need Google Play Services, you must know that Genymotion doesn’t have Google Play by default, at least for the moment. So you have to download a zip file containing it from here.

  1. In the site from above,  you should search for the package name (you can see the package name on the table below). For example if you have already created an emulator with Android 4.3 version than you will have to search after 20130813, and you should find the following zip file: gapps-kk-20140606-signed.zip. The same thing you have to do for other versions.genymotion google mapsUPDATE: For Lollipop (Android 5.0) download the ZIP file from here!
  2.  After you downloaded your zip file with corresponding maps, all you have to do is to drag and drop the ZIP file into your emulator (while you are on the Home screen) and confirm all the prompts that will show up.
  3. Drag and Drop ZIP

    Drag and Drop ZIP

    Start Flash

    Start Flash

    Flash Success

    Flash Success

  4. After the install completes, restart your emulator
  5. Now that you restarted the emulator you should see the Play Store app. In some cases you might be prompted with some Google+ errors, but you can solve this by setting your Google account (introduce your email and password) and then update the Google+ app from Play Store. This should solve the error prompts.

Android Studio Tip #2 – Extract Instance Variable

You might need to “convert” a local variable into an instance variable. Well, you can do this very easy with Android Studio.

So, in order to extract an instance variable (field) you can do this by using the following shortcut:

CTRL + ALT + F (on Windows) or Cmd + ALT + F (on Mac OS)

extract field