Skip to content

fix(Android): exifinterface unsupported image format file - #6868

Closed
NathanWalker wants to merge 1 commit into
NativeScript:masterfrom
NathanWalker:fix/android-exifinterface
Closed

NathanWalker wants to merge 1 commit into
NativeScript:masterfrom
NathanWalker:fix/android-exifinterface

Conversation

@NathanWalker

@NathanWalker NathanWalker commented Feb 6, 2019 •

Copy link
Copy Markdown
Contributor

PR Checklist

What is the current behavior?

Android apps using images can become unstable and error prone with:

02-06 11:21:32.918 21648 21648 W ExifInterface: Invalid image: ExifInterface got an unsupported image format file(ExifInterface supports JPEG and some RAW image formats only) or a corrupted JPEG file to ExifInterface.
02-06 11:21:32.918 21648 21648 W ExifInterface: java.io.IOException: Invalid marker: 89
02-06 11:21:32.918 21648 21648 W ExifInterface: 	at android.media.ExifInterface.getJpegAttributes(ExifInterface.java:1885)
02-06 11:21:32.918 21648 21648 W ExifInterface: 	at android.media.ExifInterface.loadAttributes(ExifInterface.java:1517)
02-06 11:21:32.918 21648 21648 W ExifInterface: 	at android.media.ExifInterface.<init>(ExifInterface.java:1216)

What is the new behavior?

Android apps are stable and no longer suffer from this error.
However this does require this:

implementation 'com.android.support:exifinterface:28.0.0'

in the gradle file. Possible we could add this to all {N} Android apps? It's a nasty one to run into and seems to solve for all versions.
The manual typings change should probably be handled a different way but wanted to get this open to discuss.

The fix is based on what was also discussed here:
Yalantis/uCrop#367 (comment)

@NathanWalker
NathanWalker force-pushed the fix/android-exifinterface branch from 051074a to f7c50e3 Compare February 24, 2019 05:23
@vakrilov

Copy link
Copy Markdown
Contributor

Hey @NathanWalker
Thanks for bringing this up.
The transition-definitions.android.d.ts doesn't seem the right place for the android.support.media.ExifInterface class. I thought the we could just use the definitions generated for the support library in the tns-platform-declarations package. However, I can't find the ExifInterface in there at all. Any Ideas?

@NathanWalker

Copy link
Copy Markdown
Contributor Author

@bradmartin or @triniwiz may can shed more light - I’m not certain if these support libs would auto have types in tns-platform-declarations or if we’d need to manually add support lib declarations for each support lib that was added to core modules?

@manoldonev

Copy link
Copy Markdown
Contributor

test branch_tns_core_modules_widgets#nathanwalker-exif-support-lib

@SvetoslavTsenov

Copy link
Copy Markdown
Contributor

test branch_tns_core_modules_widgets#nathanwalker-exif-support-lib android@latest --ignore branch_uitests_android api23

@SvetoslavTsenov

Copy link
Copy Markdown
Contributor

Hi @NathanWalker, the unit tests for tns-core-modules as well as some e2e tests are crashing. I am posting here the crash form unit test app. Please have in mind that "tns-core-modules-widgets" package is built from this PR

Screenshot 2019-03-19 at 19 13 54

We need to make the tests passing in order to merge the PRs.

@manoldonev

Copy link
Copy Markdown
Contributor

Can be reopened when comments on widgets PR above are addressed.

@manoldonev manoldonev closed this Apr 2, 2019
@ghost ghost removed the in progress label Apr 2, 2019
@lock

lock Bot commented Apr 2, 2020

Copy link
Copy Markdown

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock Bot locked and limited conversation to collaborators Apr 2, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants