Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-26954] Android: Reading a JSON file fails on Android Q

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionFixed
Resolution Date2019-06-13T18:33:40.000+0000
Affected Version/sRelease 8.0.0, Release 7.3.0
Fix Version/sRelease 8.1.0
ComponentsAndroid
LabelsBlob, JSON, android, engSchedule
Reportergrebulon
AssigneeJoshua Quick
Created2019-03-14T14:39:17.000+0000
Updated2020-03-25T17:48:49.000+0000

Description

Running the following code, returns t==null {quote} var file=Ti.Filesystem.getFile(Config.PathRoot.resources,'some.json'); var d=file.read(); var t=d.text; {quote} Analysis: TiBlob#getText checks TiMimeTypeHelper.isBinaryMimeType(mimetype) and if the file is binary, it only allows application/octet-stream. The detected mime type comes from android.webkit.MimeTypeMap#getMimeTypeFromExtension (in TiMimeTypeHelper#getMimeTypeFromFileExtension). This used to return the octet-steam mime on *.json files, but it was probably fixed to properly return application/json.

Comments

  1. grebulon 2019-03-14

    BTW, I fixed this in TiMimeTypeHelper#isBinaryMimeType {quote} if (mimeType.startsWith("application/") && !mimeType.endsWith("xml") && !mimeType.endsWith("json")) return true; else ... {quote} Not very comprehensive, but does the job
  2. Rakhi Mitro 2019-03-20

    Thanks for sharing with us. Just following up to check the status of this case and if you need further help on it.   
  3. Abir Mukherjee 2019-04-01

    [~ahutton] Would you please check if you can repro this? I just spoke with [~jquick] and he suggested to do a quick check before scheduling this.
  4. Alan Hutton 2019-05-15

    [~amukherjee] Reproducible.
  5. Michael Gangolf 2019-06-03

    There is also an issue on github from the Android team about this: https://github.com/appcelerator/titanium_mobile/issues/10852 with some log-data
  6. Joshua Quick 2019-06-04

    PR (master): https://github.com/appcelerator/titanium_mobile/pull/10931
  7. Lokesh Choudhary 2019-06-05

    FR Passed. PR Merged.
  8. Joshua Quick 2019-06-10

    PR (8.1.x): https://github.com/appcelerator/titanium_mobile/pull/10955
  9. Lokesh Choudhary 2019-06-11

    Backport merged.
  10. Keerthi Mahalingam 2019-06-13

    Verified the fix on SDK 8.2.0.v20190612155743 and 8.1.0.v20190612160220. Works as expected. Closing
         Name                        = Mac OS X
          Version                     = 10.13.6
          Architecture                = 64bit
          # CPUs                      = 8
          Memory                      = 17179869184
        Node.js
          Node.js Version             = 10.13.0
          npm Version                 = 6.4.1
        Titanium CLI
          CLI Version                 = 5.1.1
        Titanium SDK
          SDK Version                 = 8.2.0.v20190612155743 and 8.1.0.v20190612160220
        Emulator = pixel 2 Q
        
  11. cstefaniga 2019-09-06

    Hello, I am contacting you on behalf of ATOSS Software company. Our mobile application is built based on your framework entirely. The problem is the following: as you already know, android 10 was officially released a few days ago and some of our customers already have it. We received from them a lot of complaints in which they said that the application doesn't work anymore. We are reading a local JSON file and the problem described here reproduces here on our product. Unfortunately we are unable to change sdk from 7.5.2 (what we currently have) to 8.1.0 (which has the fix) in a time that is agreeable by the customers so this leave us with no option but the sdk patch. Could we please get a patch with this fix for SDK 7.5.2 ? We would greatly appreciate your support on this one! Thanks!
  12. Hans Knöchel 2019-09-06

    For anyone running into this, here a custom build thats 7.5.2-GA + this patch (nothing else): https://www.dropbox.com/s/pmsn9g9v7gqdkme/mobilesdk-7.5.2-osx.zip?dl=1

JSON Source