0

Here's a picture (i.e., 1000 words): enter image description here

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.

enter image description here

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".

DSlomer64
  • 4,234
  • 4
  • 53
  • 88
  • your post provides no useful informations. Your first image is fully useless as what matters (tooltips for these "X" etc) is not included nor quoted. Rework your question – Marcin Orlowski Aug 08 '17 at 19:13
  • @MarcinOrlowski, you did not read carefully. Your comment is useless and your -1 vote unfair because I used perfect English to communicate a commonplace Android Studio situation and DID PROVIDE TOOLTIP QUOTE in the Question: `flags lines with executable with an 'X', saying` “***No executable code found***”. So in your haste to score it -1, you didn't notice the considerable RESEARCH I had done nor the LINK to it. Do you have Android Studio experience? Did you really not see the intent of the question? I made several changes to make it clearer for you but they DO NOT ALTER CONTENT AT ALL. – DSlomer64 Aug 08 '17 at 19:59
  • In this case, a few lines of code would be better than 1,000 words or a picture. Your screen shot doesn't show the entire method, so there's no context. For the first problem line, your picture doesn't even show the entire line of code. Please post something more informative, like the entire method, along with the exact wording of the error message(s). – Ted Hopp Aug 08 '17 at 20:00
  • Seriously?? The question is about clean and rebuild and maybe gradle, not about programming. You don't need more code to see what the problem is nor to answer the question about clean and rebuild. Does ANYBODY read carefully anymore? – DSlomer64 Aug 08 '17 at 20:03
  • Sorry. The way you phrased the question is confusing. The standard prescription for this kind of problem is to clean and rebuild your project, because something's out of sync between your source code and the build artifacts. Normally, after you do a Clean, when you launch your app with the Debug command, it will do a build before launching. So the behavior shouldn't be any different than doing a Rebuild. I have no idea why you experienced something different. (Did you perhaps attach the debugger to a running instance of your app after Clean instead of launching a new instance?) – Ted Hopp Aug 08 '17 at 20:16
  • 1
    Also, you might consider upgrading to a newer version of Android Studio. Yours is quite out of date. – Ted Hopp Aug 08 '17 at 20:17
  • We now know that, *as of AS 1.4, CLEAN IS IDENTICAL TO REBUILD*. See, e.g., [this](https://stackoverflow.com/a/24083753/2737933) – DSlomer64 Nov 01 '17 at 11:42

0 Answers0