Uploaded image for project: 'Alloy'
  1. Alloy
  2. ALOY-957

Alloy: How to consume alloy widget asset in 3.2.0?


    • Type: Bug
    • Status: Closed
    • Resolution: Invalid
    • Affects Version/s: Alloy 1.3.1
    • Fix Version/s: None
    • Labels:
    • Environment:

      Product: Alloy
      Titanium SDK: Mobile 3.2GA
      Platform OS: Android
      Platform OS Version: 4.4


      I am having trouble using assets that belong to a widget. On SDK 3.2.0 (Studio I am creating a widget and adding assets to the following path:


      I am following the app level assets structure as indicated in the Alloy Widgets guide: http://docs.appcelerator.com/titanium/3.0/#!/guide/Alloy_Widgets

      When I attempt to use my image asset I have tried many different paths but cannot get the image to show up within the app. In SDK 3.1.3 I used "/images/user/MyWidget/user.png" as the path in the tss and it worked. Now in 3.2.0 I cannot get this to work. I have also tried using WPATH('images/user/user.png'), this also is not working.

      I do not think that the images folder is merging correctly in the Resources directory. I have attached an image of the resulting directories in Resources, both the android and iphone folders are dropping into Resources\android and not getting merged with the existing Resources\images folder. So the path to the widget images is then Resources\android\android\images[res-hdpi|res-mdpi]\user\MyWidget\user.png . Notice the double layering of android folders. Correct me if I am wrong here but I am pretty sure the build should be merging "\MyWidget\assets\android\images" with "\app\assets\android\images"?

      Please advise as to how I am supposed to be able to consume a widget asset image. I have attached a sample widget that I have been playing with. Also an image of the resulting folder structure in Resources.

      I cannot get the images to show up via android or iOS.

      Steps to reproduce:

      1.Create New Ti Sample alloy project
      2.Download the attachment and paste the files to app or import the downloaded files
      3.Run the app and Check console

      Error Logs:

      Titanium Command-Line Interface, CLI version 3.2.1, Titanium SDK version 3.2.0.GA
      Copyright (c) 2012-2014, Appcelerator, Inc. All Rights Reserved.
      Please report bugs to http://jira.appcelerator.org/
      [INFO] : Found Titanium plugin id=ti.alloy version=1.0
      [INFO] : Deploy type: development
      [INFO] : Building for target: simulator
      [INFO] : Building using iOS SDK: 7.0.3
      [INFO] : Building for iOS iPhone Simulator: 7.0.3
      [INFO] : Building for device family: universal
      [INFO] : Minimum iOS version: 6.0
      [INFO] : Debugging disabled
      [INFO] : Profiler disabled
      [INFO] : Initiating prepare phase
      [INFO] : Found Alloy app in /Users/rmitro/Documents/Titanium_Studio_Workspace/helpdesk2/app
      [INFO] : Executing Alloy compile: /usr/local/bin/node /usr/local/bin/alloy compile /Users/rmitro/Documents/Titanium_Studio_Workspace/helpdesk2/app --config platform=ios,version=0,simtype=none,devicefamily=universal,deploytype=development
      [INFO] : ----- MVC GENERATION -----
      [INFO] : [global style] loading from cache...
      [INFO] : [index.xml] view processing...
      [INFO] : style: "index.tss"
      [INFO] : view: "index.xml"
      [INFO] : controller: "index.js"
      [INFO] : created: "Resources/iphone/alloy/controllers/index.js"
      [INFO] : created: "Resources/iphone/alloy/styles/index.js"
      [INFO] :
      [INFO] : [app.js] using cached app.js...
      [INFO] :
      [INFO] : ----- OPTIMIZING -----
      [INFO] : - iphone/alloy.js
      [INFO] : - iphone/alloy/sync/localStorage.js
      [INFO] : - iphone/alloy/sync/properties.js
      [INFO] : - iphone/alloy/sync/sql.js
      [INFO] : - iphone/alloy/widgets/com.appcelerator.loading/controllers/widget.js
      [INFO] : - iphone/alloy/widgets/com.appcelerator.loading/styles/widget.js
      [INFO] :
      [INFO] : Alloy compiled in 0.65125s
      [INFO] : Alloy compiler completed successfully
      [INFO] : Initiating Xcode pre-compile phase
      [INFO] : Processing JavaScript files
      [INFO] : Skipping xcodebuild
      [INFO] : Finished building the application in 4s 321ms
      [INFO] : Running application in iOS Simulator
      [INFO] : Launching application in iOS Simulator
      [INFO] : Focusing the iOS Simulator
      [INFO] : Application started
      [INFO] : helpdesk2/1.0 (3.2.0.GA.d9182d6)
      [ERROR] : Script Error

      { [ERROR] : backtrace = "#0 () at file:///Users/rmitro/Library/Application%20Support/iPhone%20Simulator/7.0.3/Applications/1ABCCDBD-3931-4732-9230-5217BAB36DEA/helpdesk2.app/alloy.js:231"; [ERROR] : line = 142; [ERROR] : message = "Can't find variable: WPATH"; [ERROR] : name = ReferenceError; [ERROR] : sourceId = 303020448; [ERROR] : sourceURL = "file:///Users/rmitro/Library/Application%20Support/iPhone%20Simulator/7.0.3/Applications/1ABCCDBD-3931-4732-9230-5217BAB36DEA/helpdesk2.app/alloy/controllers/index.js"; [ERROR] : }




            • Assignee:
              shossain Shak Hossain (Inactive)
              rmitro Rakhi Mitro (Inactive)
            • Watchers:
              3 Start watching this issue


              • Created:

                Backbone Issue Sync

                • Backbone Issue Sync is enabled for your project, but we do not have any synchronization info for this issue.

                  Git Integration