In Android Studio 2.0, Cannot find local variable of method in debug mode

AndroidAndroid StudioGradle

Android Problem Overview


After Updating the android version 1.5 to 2.0 Preview4. Android studio Debugger unable to find the local variable defined in method definition. For reference, find the below screenshot.

enter image description here

Android Solutions


Solution 1 - Android

In your gradle, do you enable test coverage ?

    buildTypes {
        debug {
            testCoverageEnabled = true
        }
    }

Set testCoverageEnabled = false , it fixed the issue. https://code.google.com/p/android/issues/detail?id=78045

Solution 2 - Android

Make sure you are not building a 'Release' Build Variant. You will get above warning when it is a Release Build.

Solution 3 - Android

if you have minifyEnabled true in

debug { minifyEnabled true debuggable true }

remove that and using just like that debug { debuggable true }

its work for me

Solution 4 - Android

Disable jack for debug build type (build.gradle):

buildTypes {
    ...
    debug {
        jackOptions {
            enabled false
        }
    }
}

Note: 1.8 source compatibility requires jack!

Solution 5 - Android

Make sure that you build configuration with debuggable flag.

buildTypes {
    debug {
        minifyEnabled false
        debuggable true
    }
}

Solution 6 - Android

You can try this solution - open the Android Device Monitor, do a 'Reset adb'.

A screenshot where to find 'Reset adb'.

A screenshot where to find 'Reset adb'

Solution 7 - Android

> I got the problem , it was in build.gradle file

buildTypes { debug{ minifyEnabled true //This was the problem , make it false

    }
    release{
        
    }
}

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionMANISH PATHAKView Question on Stackoverflow
Solution 1 - AndroidRaymond ChenonView Answer on Stackoverflow
Solution 2 - AndroidParinda RajapakshaView Answer on Stackoverflow
Solution 3 - AndroidKrishna Mohan SinghView Answer on Stackoverflow
Solution 4 - AndroidMiklós KeresztesView Answer on Stackoverflow
Solution 5 - AndroidDanil ShaykhutdinovView Answer on Stackoverflow
Solution 6 - AndroidMykolaView Answer on Stackoverflow
Solution 7 - AndroidVivek Pratap SinghView Answer on Stackoverflow