Question

Developing for Android, I'm targetting SDK 18 which no longer contains the method "setPluginsEnabled" (websettings). I would like to use this method if the user is running an older SDK (if version <= 4.2, websettings.setPluginsEnabled(true)), but I'm not sure if it's possible to suppress a "method undefined" error.

@SuppressLint("NewApi") doesn't work here

EDIT: I realize there is now a replacement method for setPluginsEnabled (setPluginState), but I'm still curious if there is a way to suppress if necessary

Was it helpful?

Solution

method undefined means compiler cannot physically find this method at the SDK you provided. I suppose, you've attached SDK > 4.2 to your project. It cannot be supressed, you should use older SDK with your project, if you would like to use this method. Try to use targetSDK = 17

OTHER TIPS

That's one of the few methods that has actually been removed instead of just being deprecated. If you want to compile your code using setPluginsEnabled then you need to use Android 4.2.2 to compile it (API 17). Before API 17 the method has just been deprecated.

You need to set the build target to Android 4.2.2 or lower: enter image description here

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top