MANISH PATHAK
MANISH PATHAK

Reputation: 2650

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

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

Upvotes: 58

Views: 30776

Answers (7)

Raymond Chenon
Raymond Chenon

Reputation: 12662

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

Upvotes: 89

Danil Shaykhutdinov
Danil Shaykhutdinov

Reputation: 2287

Make sure that you build configuration with debuggable flag.

buildTypes {
    debug {
        minifyEnabled false
        debuggable true
    }
}

Upvotes: 1

Vivek Pratap Singh
Vivek Pratap Singh

Reputation: 1662

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

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

    }
    release{

    }
}

Upvotes: 0

Parinda Rajapaksha
Parinda Rajapaksha

Reputation: 3109

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

Upvotes: 11

Krishna Mohan Singh
Krishna Mohan Singh

Reputation: 327

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

Upvotes: 9

Mykola
Mykola

Reputation: 435

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'

Upvotes: 1

Miklós Keresztes
Miklós Keresztes

Reputation: 180

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

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

Note: 1.8 source compatibility requires jack!

Upvotes: 6

Related Questions