Crash at titleField.setText(crime.title)

After following coding guidelines to page 254 and running criminal intent app, app crashes.

I tried debugging and found that it makes it to the point where the titleField variable should be set to the data from the database. This is where is fails. I commented out this line and the program runs through completion without crashing.

I stepped into the code in the debugger and began seeing the message
“Sourcecode does not match Bytecode”

What is this??? Thanks.

So i looked through my logcat after crash and found a reference to crime.title requiring a sequence. I went to the textwatcher and removed the crime.title.toString().

I ran the program. It worked!!!

i then switched it back to crime.title.toString()… it worked.

Now it works the exact way it was before I started???

Is this common in android studio? Very frustrating. As a new programmer how will I know if I’m wrong or android studio is acting buggy??

This question is only a little rhetorical. I am interested if this kind of behavior is common in the IDE. thanks.

“Sourcecode does not match Bytecode” sounds like it found a source code file that should have been recompiled but wasn’t. It may be that your subsequent code changes caused it to recompile that code.

I’ve run into that a few times with XCode on the Mac as well, where forcing XCode to rebuild everything will fix a problem. As good as compilers are about figuring out source code dependencies, they’re not always perfect.

Is there a way to force the recompile periodically?

And thanks for the response.

I’m not familiar with Android, so I can’t say whether that compiler has such a feature or not. I’ve not run across such a feature in the compilers I’ve used in the last few years (Virtual Studio, XCode)

For me it was crashing at titleField's textwatcher because I had the kotlin method todo() which sends an exception if used.