Android Studio API level warning not showing on some newly added methods

Furkan Yurdakul :

Note: There is a question with a similar title however this is not a duplicate. If you wonder what question that is: question link The option is already enabled in my IDE.

Recently we have updated an app with some bug fixes but one of the changes caused a critical crash, depending on a method that has been added in API 29, and Android Studio didn't warn me about it which led to an unavoidable crash at user base.

If you wonder, I also have API 29 documentation downloaded in IDE, so I can see the sources, javadocs in it.

The method I've used is Parcel.writeBoolean(val) method. According to the documentation, this was added in API level 29 (I don't know why it's added this late but it was), however this is how it looks when I use it in the IDE. (Minimum API version is 21)

Screenshot of the issue (no warnings)

There are no warnings about the API usage. Hence I casually used it and it lead to a huge crash rate in our app.

Is there a way to check every method based on its API level? On normal cases (such as using Context.getSystemService(Class clazz) the IDE gives a warning that it is added in API level 23) it seems to be working, but on really newly added methods, it sometimes skips the warning.

Do I need to check every Android framework based method before using it? Or is there something that do this task properly? Any help is appreciated, thanks.

Furkan Yurdakul :

Well, apparently I had an old version of Android Studio (3.5.1), updating it to 3.6.1 solved the issue.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=342065&siteId=1