In my Android app, I am using the camera by using the android.media.action.IMAGE_CAPTURE
intent. I then use ExifInterface because I need to send the miniature of the photo to my server:
ExifInterface exif = new ExifInterface(GetinnersActivity.this.getExternalFilesDir(null).toString() + File.separator + fileName);
byte[] thumbnail = exif.getThumbnail();
String miniature = Base64.encodeToString(thumbnail,Base64.DEFAULT); //This line crashes on Nexus 5
I don't have any problem with others phones, but Nexus 5 crashes when trying to execute the last line of code I provided. The Nexus 5 is running on Android 5.1.1. In my Android Manifest,
<uses-sdk
android:minSdkVersion="17"
android:targetSdkVersion="19" />
I was wondering if that's due to some known bug with Nexus 5 or if I am doing something wrong.
06-21 19:49:55.748: E/AndroidRuntime(29256): java.lang.NullPointerException: Attempt to get length of null array
06-21 19:49:55.748: E/AndroidRuntime(29256): at android.util.Base64.encode(Base64.java:494)
06-21 19:49:55.748: E/AndroidRuntime(29256): at android.util.Base64.encodeToString(Base64.java:456)