Android Error While Using Exifinterface
Solution 1:
for AndroidX use
androidx.exifinterface.media.ExifInterface
Import this dependency in build.gradle
:
implementation 'androidx.exifinterface:exifinterface:1.3.2'
Solution 2:
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.
Solution 3:
Add this to your build.gradle file
compile"com.android.support:exifinterface:25.1.0"
for me it worked.
Solution 4:
The ExifInterface constructor being used in your code sample:
ByteArrayInputStreambs=newByteArrayInputStream(bitmapdata);
was added in SDK level 24.
But it looks like the code is being run on a device with an earlier version of Android than 24.
Post a Comment for "Android Error While Using Exifinterface"