Search code examples
titaniumappceleratortitanium-alloyappcelerator-titaniumappcelerator-alloy

In Appcelerator / Titaium is it possible to share images across iOS and Android?


I created an app with Appcelerator Studio / Titanium, originally just for iOS and I placed all of my images into the assets folder directly; app/assets. All of the images load fine on iOS, for example:

<ImageView id="logo" image="logoHorizontalWhite.png" />

However, when I build the app for Android, the image doesn't show.

Does this mean I have to place images into the Android specific directory and I will need to have duplicates of all images for both iOS and Android?


Solution

  • The folder app/assets is the "root" folder for images. Recommended is putting all images in app/assets/images.

    Android is particular about the leading slash. Try:

    <ImageView id="logo" image="/logoHorizontalWhite.png" />
    

    Any images not to be shared across platforms should go to platform specific folders, app/assets/iphone/images and app/assets/android/images