[ALOY-1504] ERROR: Alloy is not defined

GitHub Issuen/a
Resolution Date2017-04-03T20:57:08.000+0000
Affected Version/sn/a
Fix Version/sRelease 6.2.0, alloy 1.9.10
LabelsAlloy, Alloy_is_not_defined, Push_Notification
AssigneeFeon Sua Xin Miao


I have an Android project integrated with _iamyellow.net_ Push Notification module. Erroneous scenario generated by following steps. 1. App is closed manually in background 2. There is a notification in notification bar for the app 3. App is opened by tapping on the notification. 4. An error with "Alloy is not defined", sourced build/android/assets/alloy.js, is appeared. Please refer screenshot in attachment. 5. App sticks at default screen after receiving error. Please consider this as high priority issue. Regards.




  1. Sharif AbuDarda 2016-04-29 Hello, The issue is with this line of code in the alloy.js
       if (style.queries && style.queries.formFactor && !Alloy[style.queries.formFactor]) continue;
    Here, Alloy as a variable is not defined. It will be helpful for you if you query in iamyellow.net website. My suggestion would be using cloudpush module for push notification with Appcelerator. Regards, Sharif.
  2. Christian Brousseau 2016-04-29 Sorry to say this [~sdarda], but how is using another module a viable solution to an actual Alloy bug? This isn't Stack Overflow where people are just _asking for ways_ to get around their problems. This is an actual ticket, raised by +a paying customer+, so it is not unreasonable to expect your responses to take this into consideration.
  3. Investis 2016-05-04 Hello, This is extremely urgent at our end to get this issue resolved asap. Can someone please help here to resolve this issue. Regards
  4. Sharif AbuDarda 2016-05-04 Hello, The issue is with the alloy.js code. Can you please tell me where did you get the code. Is it provided by the iamyellow.net? If so, Maybe they can help you out. Thay are an independent company providing push notification support. Please contact their support person. We are also looking into it. Regards, Sharif.
  5. Investis 2016-05-04 Hi Sharif, Re - alloy.js , I have also mentioned the location of the file in (if you can review point 4) when I have registered bug ticket. alloy.js placed at *build/android/assets/alloy.js*. this file is being added with few functions by appcelerator studio at build time. There is a function _*exports.createStyle*_ in alloy.js, which has a condition as per the screenshot and causing the error when opening the app from a push notification. Please review _*exports.createStyle*_ function in attached alloy.js file with this ticket. I hope this would be helpful for further investigation. Regards,
  6. Feon Sua Xin Miao 2016-05-05 After the app starts, Alloy is one of the globals which should be accessible by alloy.js the core builtin client library. It looks like there might be an issue when the app is put in the background, then brought to the foreground. Probably the activities are being recreated? We'll look into this. In the mean time, one question: do you still see the same error if you kill the app and launch it again?
  7. Ayoub Zamouchi 2016-06-13 Facing the same issue here, the error appear only when the app is killed, and launched via the click on the received push notification.
  8. Jonas Funk Johannessen 2016-08-02 Same here. Using this module though: https://github.com/morinel/gcmpush
  9. Jonas Funk Johannessen 2016-08-18 Is there any way to fix this temporarily, while we wait for a fix? For the missing Alloy references in lib-files, we can just do a require('alloy'), but as it is now, we are forced to remove all Alloy references in our tss-files. This is an extensive operation, that we would like to avoid.
  10. Jason Knight 2016-09-20 This has been an obstruction for us and the source of multiple deadline push backs. We hope this issue can be moved up the queue of tasks.
  11. Feon Sua Xin Miao 2017-03-07 PR: https://github.com/appcelerator/alloy/pull/819
  12. Bo Wang 2017-09-22 Hi I am facing the same error some times on starting up the app. Which alloy.js file do I apply the changes to? I couldn't find the code need to be corrected in the alloy.js within the project. Could anybody help? I currently could not update Appcelerator, because the latest SDK 6.2.1 and 6.2.2 breaks my UI. I just want to fix this issue and release a stable version of our APP.
  13. Feon Sua Xin Miao 2017-09-22 [~bwang@metroland], which version of Appc CLI are you using? The fix should be in latest CLI 6.2.3, it's independent of titanium SDK.
  14. Bo Wang 2017-09-25 @Feon Sua Xin Miao, my appc -v shows 6.2.4 . Does that mean I just need to build in latest Appcelerator Studio, and use the previous Titanium SDK. The error should be gone?

JSON Source