1

Android Studio 4.1 suggests avoiding using android.media.exifinterface and using android.support.media.exifinterface instead. We may want to suppress it, e.g., if the project has min SDK API 24, and it is known that android.media.exifinterface is fine for API 24 and above.

Android Studio's context menu gives Add @SuppressLint("ExifInterface") but nothing happens on clicking that. Adding @SuppressLint("ExifInterface") in several places (trying one at a time, of course) doesn't work, e.g.,

  • the line immediately above the import android.media.exifinterface; statement
  • the line before the package line at the top of the whole file

Where is the right place to add this @SuppressLint annotation?

auspicious99
  • 3,902
  • 1
  • 44
  • 58
  • 1
    I think you would need to suppress it at the module level, using `build.gradle` or `lint-baseline.xml` or something. I don't see an option for applying that annotation to an `import` statement, which I assume is where you are seeing it. FWIW, I filed [this issue](https://issuetracker.google.com/issues/184290317) to get that class reference updated -- I was surprised to see a reference to the old `android.support.media.ExifInterface` floating around. – CommonsWare Apr 02 '21 at 12:10
  • Thanks, doing it in the `build.gradle` worked. Yes. the lint suggestion was coming at the import statement. If you'd like to write it as answer, I can accept that. – auspicious99 Apr 02 '21 at 13:17
  • 1
    FWIW, I starred the issue you filed – auspicious99 Apr 02 '21 at 13:19

2 Answers2

1

Like you, I cannot find a place for the @SuppressLint that works to suppress a Lint warning on an import statement.

In this case, my guess is that you would want to be suppressing this module-wide anyway. I cannot think of a scenario where you would want to use the framework ExifInterface in some places and the library ExifInterface in others. So, you could use stuff like lint.xml or lintOptions in the module's build.gradle file to suppress it for the entire module.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
0

You can try this:

//noinspection ExifInterface
import android.media.exifinterface;
  • 1
    As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-ask). – Community Sep 16 '21 at 04:49