Here's a picture (i.e., 1000 words):
As it clearly says in the Title, Android Studio 2.1.2 flags lines with executable with an 'X', saying
“No executable code found”--Why?
I merely did a Debug
of the project and got the above.
Note that:
550 is an if
statement yet is flagged with X--“No executable code found”
551 is a non-executable {
yet is not flagged.
552 is a method call yet is flagged with X--“No executable code found”
553 and 554 are okay as is.
555 is a comment and not executable, yet is not flagged.
556 is an if
statement yet is flagged with X--“No executable code found”
Then I did a Clean
and then Debug
to see if the X situation changed.
It didn't.
Then I did a Rebuild
followed by Debug
.
Now all looks fine. All the executable statements are NOT flagged with X and all NON-executables are flagged with X.
So message received: if the X situation is silly, Rebuild
the project.
But what's going on? Why are some perfectly good executable lines flagged with X while lines that are definitely not valid breakpoints are NOT flagged?
To try to answer my own question, I found this:**
A clean just removes all build artifacts.
A rebuild does a clean followed by a build of your project.
That's probably true, but what does it say? In the comments section of the Question, someone says:
Just verified that this is a recent change to Android Studio and the gradle setup. The "Rebuild" doesn't actually create the APK, you have to try to run or export as release first. And, the "Clean" in Android Studio is doing the same tasks as "Rebuild":
So Clean = Rebuild
?? Apparently not, as I've experienced.
Another take was this:
Clean removes the build folders contents.
Rebuild removes the build folder's contents.
And builds some binaries;
not including the APK!
I need an explanation, please, especially if this is gradle
's "fault".