0

Possibly relevant info:

  • NewApi lint rule is enabled and marked as error as shown below
  • minSdkVersion is set to 21
  • Android Gradle Plugin version is 3.6.3
  • Android Studio version is 3.6.3
  • Project uses Kotlin

I expect the IDE to mark the usage of an unavailable API as an error as it used to before, I'm unaware of when it stopped working and can't get it to work again. An example is shown below of an API level 23 method being called without errors, which would crash on an older device.

enter image description here

enter image description here

JaviCasa
  • 698
  • 8
  • 17
  • 1
    At least about your example, checkSelfPermission is **ContextCompat.checkSelfPermission** which is available under api23. But AndroidStudio is probably showing the normal checkSelfPermission's document. – hata Apr 17 '20 at 23:46
  • Good catch, but it was just a bad example, the problem is there. The one that made me realize this was happening is `Context.getColor(Int)`, which crashed on me on an old device during runtime. – JaviCasa Apr 18 '20 at 03:39

1 Answers1

0

Found the culprit! It was a particular version of Firebase Cloud Messaging, 20.1.4.

For some reason, it disabled all kinds of Android inspections in the IDE. Raising it to 20.1.6 made things work again!

implementation 'com.google.firebase:firebase-messaging:20.1.4'

JaviCasa
  • 698
  • 8
  • 17