“'this' is not available” in debug windows of Android Studio

前端 未结 6 1248
梦如初夏
梦如初夏 2020-12-10 10:23

I get this message in debug windows in Android Studio. This is not a static method, nor is it a class. What does it mean?

相关标签:
6条回答
  • 2020-12-10 10:39

    I've got a simple workaround for it:

    int tmp = this.a; // tmp is available
    this.a++; // this is not available
    int tmp2 = this.a // tmp2 is available
    
    0 讨论(0)
  • 2020-12-10 10:40

    this keyword is references to the current object instance, as in the the official Java documentation.

    In your case the error message 'this' is not available means that the debugger cannot access (i.e. does not know) the current object.

    0 讨论(0)
  • 2020-12-10 10:49

    when i change my gradle config,the work for me. this is error config:

         buildTypes {
        release {
            minifyEnabled true
            zipAlignEnabled true
            shrinkResources true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            signingConfig signingConfigs.release
        }
    
        debug {
            minifyEnabled true
            zipAlignEnabled true
            shrinkResources true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            signingConfig signingConfigs.release
        }
    }
    

    and, this is work for me.

    debug {
    
            minifyEnabled false
            zipAlignEnabled false
            shrinkResources false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            signingConfig signingConfigs.release
        }
    
    0 讨论(0)
  • 2020-12-10 10:50

    Change'Build Variant' to debug

    0 讨论(0)
  • 2020-12-10 10:54

    Inside Lambda expressions we can't evaluate the value of variables. Changing from the lambda expression to normal expression solved my issue

    0 讨论(0)
  • 2020-12-10 10:57

    I think this is an issue related to Reflexion. My project was using Hugo. As soon as I disable it, the bug disappeared.

    Issue has been pushed : https://github.com/JakeWharton/hugo/issues/127

    0 讨论(0)
提交回复
热议问题