Android Error While using ExifInterface
for AndroidX use
androidx.exifinterface.media.ExifInterface
Import this dependency in build.gradle
:
implementation 'androidx.exifinterface:exifinterface:1.3.2'
Add this to your build.gradle file
compile "com.android.support:exifinterface:25.1.0"
for me it worked.
You are attempting to use android.media.ExifInterface
. On Android 7.0+ (API Level 24), that class is safe to use and has a constructor that takes an InputStream
. Apparently, you are running your app on an older device. That results in two problems:
The older device will not have that constructor
ExifInterface
has security flaws on older devices, opening your app up to malware attacks
Use android.support.media.ExifInterface
instead. It is from the support libraries (com.android.support:exifinterface
, specifically). It offers a constructor taking an InputStream
that works on all supported versions of Android. And, it bypasses the security bug on older devices.