Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-15929] Parity: Android should support require-ing .json files like on iOS

GitHub Issuen/a
TypeBug
PriorityLow
StatusClosed
ResolutionDuplicate
Resolution Date2017-07-08T22:29:57.000+0000
Affected Version/sRelease 3.2.0, Release 3.2.1
Fix Version/sn/a
ComponentsAndroid
Labelsandroid, json, module, parity, require
ReporterFokke Zandbergen
AssigneeEric Merriman
Created2013-12-06T15:17:11.000+0000
Updated2017-07-20T19:11:03.000+0000

Description

In iOS, you can do:
var object = require('data.json');
On Android, you can't and get:
[ERROR] TiExceptionHandler: (main) [545,551] ----- Titanium Javascript Runtime Error -----
[ERROR] TiExceptionHandler: (main) [0,551] - In ti:/module.js:280,9
[ERROR] TiExceptionHandler: (main) [0,551] - Message: Uncaught Error: Requested module not found: data/book.json
[ERROR] TiExceptionHandler: (main) [0,551] - Source: 		throw new Error("Requested module not found: " + request);
This should be quite easy to add to: https://github.com/appcelerator/titanium_mobile/blob/master/android/runtime/common/src/js/module.js

Comments

  1. Shak Hossain 2013-12-09

    Hi Fokke, Thanks for submitting this request. I have moved your request to TIMOB so that Engineering can consider this for future release. If you have any question or comment, please feel free to post it here. Regards,
  2. Hans Knöchel 2017-07-08

    This is supported in 6.0 as part of the major require-changes.
  3. Lee Morris 2017-07-20

    Closing as duplicate.

JSON Source