I cannot debug a custom view. "No executable code found at line" message shown. Also on a MainActivity the debug works fine and stop on setText
method, but in my custom view not. The debug cannot in to my custom view method. And on the other methods did not stop, like onDraw
.
How can I fix it?
I have tried to clean, rebuild and restart project. Instant run is disabled. The Android Studio 3.4.1 version.
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
debug {
debuggable true
minifyEnabled false
}
}
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
val pipsTextView = findViewById<PipsTextView>(R.id.pips_text_view)
pipsTextView.setText("1123.23444", 5, 2, 3, -1)
}
}
override fun setText(value: String, pipSize: Int, prePipSize: Int, floatingPipSize: Int, direction: Int) {
this.pipSize = pipSize
this.prePipSize = prePipSize
this.floatingPipSize = floatingPipSize
this.direction = if (direction < 0) DOWN else if (direction == 0) NEUTRAL else UP
preparePipValues(value)
invalidate()
}
I expect the debug will work.
Based on this question, the following steps may help you:
After this, usually it covers 99% of the problems. Otherwise, Probably you will have to examine some other possibilities.