For example, I now have a program like Figure 1 (based on Android O):
Then I tried to write a notification function, and found a NotificationChannel object, but after writing it, like figure two
,
when I removed the if, I would make a mistake on the cell phone below Android O, because I couldn't find this class.
Then Android O's notice also added a setTimeoutAfter (2000) method to set the notification disappear delay. This method didn't exist before Android O, but this method didn't add if limit, and it didn't report the error when running on the cell phone below Android O. I want to know why this is? Why does NotificationChannel make a mistake, and setTimeoutAfter doesn't make a mistake.
Or, as the title, Android compiler, I think I was determined with the 26 source code version, then run to each low version of the mobile phone, the mobile phone also should be each own version, I wonder why is setTimeoutAfter this method can perform (and no effect), rather than the exception.