Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-4757] Android: ImageView doesn't show the image

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionDuplicate
Resolution Date2012-02-07T10:14:57.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsAndroid
Labelsn/a
ReporterAleix Casagolda
AssigneeNeeraj Gupta
Created2011-06-10T01:26:52.000+0000
Updated2017-03-24T18:33:51.000+0000

Description

I've added an ImageView to the Window and the image doesn't show in the emulator. I've tested it on a Nexus S device and in the device the app crashes. If I remove the ImageView, the app doesn't crash in the device. The same code works in mobile SDK 1.6.2 on Windows and using the same 1.7 SDK in Linux, it works well so it could be a bug that only affects Windows version of the SDK?
Ti.UI.backgroundColor = "#FFFFFF";

var win = Ti.UI.createWindow({
  modal:true
});

var myimage = Ti.UI.createImageView({
  image: '/image.jpg'
});

win.add(myimage);
win.open();

Attachments

FileDateSize
image.jpg2011-06-25T04:56:54.000+0000692

Comments

  1. Paul Dowsett 2011-06-13

    Aleix Please try this using the latest Titanium SDK 1.7.X, and report back stating the build date and hash tested. Many thanks
  2. Aleix Casagolda 2011-06-14

    Hi Paul, I've tested it again with Titanim SDK 1.7.1 06/13/11 15:33 with hash 84a68cc Still doesn't load the image in the Emulator (tested on Android SDK 2.3.1 and 2.3.3) and crashes when the app loads in device Nexus S (Android 2.3.4) Thanks.
  3. Paul Dowsett 2011-06-25

    Aleix Your code works without issue on my system, a Android 2.3.3 emulator and Titanium 1.7.1 (2011/06/17 00:13 293a6d...). However, I really do think it's a false economy when you reduce the code's readability by saving a line or two of code. I have updated the usecase with what I would use. Would you mind confirming that you still experience the same issue using it? The only thing I can think of is that your image file is not in a valid format. I have attached an image file that works on my system.
  4. Aleix Casagolda 2011-06-27

    Hi Paul, Thank you for your reply. I've tested again using your code and your image with the latest version of Titanium I've found (1.7.1 06/21/11 14:28 1293a6d) and I'm still having the same error using the emulator (Android 2.3.3): image doesn't show and I'm still having the same issue on my device (Samsung Nexus S with Android 2.3.4): the app crashes on startup. I've seen this message in the stackTrace (I don't know if it's useful for you): W/TiDrawableReference( 673): (main) [5,616] Bitmap bounds could not be determined. If bitmap is loaded, it won't be scaled. I'm using Windows 7 64 bits and of course, Titanium mobile SDK for Windows. I tested it some days ago using the Linux SDK in an Ubuntu VM and it worked well. Thanks.
  5. Derrick Huth 2011-06-27

    I can confirm Aleix's findings. I installed Studio on my Windows Vista development computer as I was keen to try the Blackberry SDK, after a number of failures in getting it to work I decided that the three year old machine was due a clean up. I have re-installed Windows Vista from scratch, clean install on reformated drive, not a repair or upgrade. The only software installed other than Titanium Studio and it's dependancies is MS Office. I have imported a project that previously worked (as far as it had got) and all imageViews are blank. They are all there and respond to touch events, they just don't show the image. I initially assumed that it was an issue with the images so tried converting the png to jpg and gif, no luck. As the image was being resized and 1.7 raises some issues with resizing I created images in all three formats at the correct size, still no luck. After that I decided that Titanium had to be the issue and followed the advice on the Titanium Q&A to disable FastDev and that made the app work correctly, but only once. When I altered the app and redeployed it was broken again. Whilst I appreciate that you cannot test every environment, and Vista is not a supported OS (XP & 7 are ??!!) I assumed that this would mean a loss of functionality like FastDev not working, not my apps being trashed. This sort of catastrophic failure deserves a serious warning, (like DO NOT UNDER ANY CIRCUMSTANCES INSTALL ON WINDOWS VISTA IT WON'T WORK AND YOUR APP WILL NOT RUN), not 'Vista is not supported'. And whilst you cannot duplicate this on Windows 7, it is real, and it is a showstopper, IT NEEDS FIXING.
  6. Paul Dowsett 2011-07-08

    OK, Aleix What we need is a full trace log when running 1.7.X + Android 2.3.3 in an emulator. Would you be able to provide this? Once this is done, I will move the ticket over to the mobile project. Just to note, see the [Jira Ticket Checklist](http://wiki.appcelerator.org/display/guides/Contributing+to+Titanium#ContributingtoTitanium-Summary%3AJiraTicketChecklist) to see what is required for most tickets. Many thanks
  7. Aleix Casagolda 2011-07-15

    Hi Paul, Thanks. The log. Let me know if you need something more.
       D/dalvikvm(  134): GC_EXPLICIT freed 59K, 47% free 3177K/5895K, external 6275K/7568K, paused 134ms
       D/dalvikvm(  219): GC_EXPLICIT freed 19K, 52% free 3025K/6279K, external 1625K/2137K, paused 238ms
       D/AndroidRuntime(  507): 
       D/AndroidRuntime(  507): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
       D/AndroidRuntime(  507): CheckJNI is ON
       D/AndroidRuntime(  507): Calling main entry com.android.commands.pm.Pm
       D/dalvikvm(  394): GC_EXPLICIT freed 2K, 51% free 2726K/5511K, external 1625K/2137K, paused 51ms
       W/ActivityManager(   64): No content provider found for: 
       W/ActivityManager(   64): No content provider found for: 
       D/PackageParser(   64): Scanning package: /data/app/vmdl1346280695.tmp
       I/PackageManager(   64): Removing non-system package:com.agilogy.prova
       I/ActivityManager(   64): Force stopping package com.agilogy.prova uid=10038
       I/Process (   64): Sending signal. PID: 483 SIG: 9
       E/InputDispatcher(   64): channel '4082f6c8 com.agilogy.prova/com.agilogy.prova.ProvaActivity (server)' ~ Consumer closed input channel or an error occurred.  events=0x8
       E/InputDispatcher(   64): channel '4082f6c8 com.agilogy.prova/com.agilogy.prova.ProvaActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
       I/ActivityManager(   64):   Force finishing activity HistoryRecord{40663ca0 com.agilogy.prova/.ProvaActivity}
       I/WindowManager(   64): WIN DEATH: Window{4082f6c8 com.agilogy.prova/com.agilogy.prova.ProvaActivity paused=false}
       I/WindowManager(   64): WIN DEATH: Window{40706bc8 com.agilogy.prova/org.appcelerator.titanium.TiModalActivity paused=false}
       E/InputDispatcher(   64): Received spurious receive callback for unknown input channel.  fd=168, events=0x8
       W/InputManagerService(   64): Got RemoteException sending setActive(false) notification to pid 483 uid 10038
       D/PackageManager(   64): Scanning package com.agilogy.prova
       I/PackageManager(   64): Package com.agilogy.prova codePath changed from /data/app/com.agilogy.prova-2.apk to /data/app/com.agilogy.prova-1.apk; Retaining data and using new
       I/PackageManager(   64): Unpacking native libraries for /data/app/com.agilogy.prova-1.apk
       D/installd(   35): DexInv: --- BEGIN '/data/app/com.agilogy.prova-1.apk' ---
       D/dalvikvm(  516): DexOpt: 'Lorg/apache/commons/codec/binary/Base64;' has an earlier definition; blocking out
       D/dalvikvm(  516): DexOpt: 'Lorg/apache/commons/codec/binary/Hex;' has an earlier definition; blocking out
       D/dalvikvm(  516): DexOpt: 'Lorg/w3c/dom/UserDataHandler;' has an earlier definition; blocking out
       D/dalvikvm(  516): DexOpt: not verifying 'Lorg/apache/commons/codec/binary/Base64;': multiple definitions
       D/dalvikvm(  516): DexOpt: not verifying 'Lorg/apache/commons/codec/binary/Hex;': multiple definitions
       I/dalvikvm(  516): DexOpt: not resolving ambiguous class 'Lorg/apache/commons/codec/binary/Hex;'
       I/dalvikvm(  516): DexOpt: not resolving ambiguous class 'Lorg/apache/commons/codec/binary/Base64;'
       I/dalvikvm(  516): DexOpt: not resolving ambiguous class 'Lorg/apache/commons/codec/binary/Base64;'
       D/dalvikvm(  516): DexOpt: not verifying 'Lorg/w3c/dom/UserDataHandler;': multiple definitions
       D/dalvikvm(  394): GC_EXPLICIT freed 7K, 51% free 2724K/5511K, external 1625K/2137K, paused 1390ms
       I/dalvikvm(  516): DexOpt: not resolving ambiguous class 'Lorg/apache/commons/codec/binary/Base64;'
       D/dalvikvm(  516): DexOpt: load 784ms, verify+opt 6886ms
       D/installd(   35): DexInv: --- END '/data/app/com.agilogy.prova-1.apk' (success) ---
       W/PackageManager(   64): Code path for pkg : com.agilogy.prova changing from /data/app/com.agilogy.prova-2.apk to /data/app/com.agilogy.prova-1.apk
       W/PackageManager(   64): Resource path for pkg : com.agilogy.prova changing from /data/app/com.agilogy.prova-2.apk to /data/app/com.agilogy.prova-1.apk
       D/PackageManager(   64):   Services: org.appcelerator.titanium.analytics.TiAnalyticsService
       D/PackageManager(   64):   Activities: com.agilogy.prova.ProvaActivity org.appcelerator.titanium.TiActivity org.appcelerator.titanium.TiModalActivity ti.modules.titanium.ui.TiTabActivity ti.modules.titanium.ui.android.TiPreferencesActivity
       I/ActivityManager(   64): Force stopping package com.agilogy.prova uid=10038
       I/installd(   35): move /data/dalvik-cache/data@app@com.agilogy.prova-1.apk@classes.dex -> /data/dalvik-cache/data@app@com.agilogy.prova-1.apk@classes.dex
       D/PackageManager(   64): New package installed in /data/app/com.agilogy.prova-1.apk
       I/ActivityManager(   64): Force stopping package com.agilogy.prova uid=10038
       D/dalvikvm(   64): GC_EXPLICIT freed 928K, 44% free 4886K/8647K, external 3901K/4872K, paused 119ms
       D/dalvikvm(  134): GC_EXPLICIT freed 117K, 49% free 3060K/5895K, external 6102K/7568K, paused 114ms
       W/RecognitionManagerService(   64): no available voice recognition services found
       D/GTalkService(  219): handlePackageInstalled: re-initialize providers
       D/GTalkService(  219): [RawStanzaProvidersMgr] ##### searchProvidersFromIntent
       D/GTalkService(  219): [RawStanzaProvidersMgr] no intent receivers found
       D/dalvikvm(   64): GC_EXPLICIT freed 283K, 45% free 4798K/8647K, external 3226K/4029K, paused 103ms
       I/installd(   35): unlink /data/dalvik-cache/data@app@com.agilogy.prova-2.apk@classes.dex
       D/AndroidRuntime(  507): Shutting down VM
       D/dalvikvm(  507): GC_CONCURRENT freed 100K, 72% free 293K/1024K, external 0K/0K, paused 3ms+1ms
       D/jdwp    (  507): adbd disconnected
       I/AndroidRuntime(  507): NOTE: attach of thread 'Binder Thread #3' failed
       D/AndroidRuntime(  521): 
       D/AndroidRuntime(  521): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
       D/AndroidRuntime(  521): CheckJNI is ON
       D/AndroidRuntime(  521): Calling main entry com.android.commands.am.Am
       I/ActivityManager(   64): Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.agilogy.prova/.ProvaActivity } from pid 521
       I/ActivityManager(   64): Start proc com.agilogy.prova for activity com.agilogy.prova/.ProvaActivity: pid=529 uid=10038 gids={1015, 3003}
       D/AndroidRuntime(  521): Shutting down VM
       D/dalvikvm(  521): GC_CONCURRENT freed 101K, 69% free 318K/1024K, external 0K/0K, paused 2ms+1ms
       I/AndroidRuntime(  521): NOTE: attach of thread 'Binder Thread #3' failed
       D/jdwp    (  521): adbd disconnected
       D/dalvikvm(   64): GC_EXTERNAL_ALLOC freed 60K, 45% free 4781K/8647K, external 3826K/4029K, paused 213ms
       I/TiApplication(  529): (main) [0,0] checkpoint, app created.
       I/TiApplication(  529): (main) [202,202] Titanium 1.7.1 (2011/06/21 14:28 293a6d)
       D/TiDeployData(  529): (main) [80,282] Read deploy data: {"debuggerPort":-1,"debuggerEnabled":false,"fastdevPort":53196}
       I/TiRootActivity(  529): (main) [0,0] checkpoint, on root activity create, savedInstanceState: null
       E/TiApplication(  529): (main) [293,293] APP PROXY: [Ti.App]
       D/TiCommonContactsApi(  529): (main) [28,321] Using newer contacts api.  Android SDK level: 10
       D/TiFastDev(  529): (kroll$1: app://app.js) [605,926] Enabling Fastdev on port 53196
       D/TiFastDev(  529): (kroll$1: app://app.js) [13,939] sent tokens successfully
       D/TiFastDev(  529): (kroll$1: app://app.js) [27,966] Fastdev session handshake succesful.
       D/TiFastDev(  529): (kroll$1: app://app.js) [27,993] sent tokens successfully
       D/KrollContext(  529): (kroll$1: app://app.js) [2,995] Running evaluated script: file:///android_asset/Resources/app.js
       D/dalvikvm(  529): GC_CONCURRENT freed 1045K, 52% free 3267K/6727K, external 1625K/2137K, paused 8ms+8ms
       I/ActivityManager(   64): Starting: Intent { cmp=com.agilogy.prova/org.appcelerator.titanium.TiModalActivity (has extras) } from pid 529
       I/TiRootActivity(  529): (main) [0,0] checkpoint, on root activity resume. context = org.appcelerator.titanium.TiContext@40587470
       I/ActivityManager(   64): Displayed com.agilogy.prova/.ProvaActivity: +4s495ms
       D/TiFastDev(  529): (main) [616,616] sent tokens successfully
       D/skia    (  529): --- decoder->decode returned false
       W/TiDrawableReference(  529): (main) [4,620] Bitmap bounds could not be determined.  If bitmap is loaded, it won't be scaled.
       D/TiFastDev(  529): (main) [7,627] sent tokens successfully
       D/skia    (  529): --- decoder->decode returned false
       I/ActivityManager(   64): Displayed com.agilogy.prova/org.appcelerator.titanium.TiModalActivity: +712ms
       W/TiAnalyticsSvc(  529): (Thread-14) [1933,2560] Analytics Service Started
       I/TiAnalyticsSvc(  529): (Thread-14) [1540,4100] Sending 1 analytics events.
       D/dalvikvm(  529): GC_CONCURRENT freed 540K, 51% free 3331K/6727K, external 1967K/2137K, paused 6ms+6ms
       
  8. Paul Dowsett 2011-07-24

    Aleix Please remember to use the code block markup provided. Thanks. I'm moving this to the main project for the core team to review. Cheers
  9. Johannes Engel 2012-02-07

    Still seeing this in SDK 1.8.1 on win64 (image not displaying in ImageView on the android-emulator) 2 observations:

    it works with remote URLs (even when fastdev is enabled):
    image: 'http://www.appcelerator.com/wp-content/uploads/2009/06/titanium_desk.png'

    it works with local URLs only when fastdev is disabled

    So it seems this is a problem with fastdev on the windows platform: [http://developer.appcelerator.com/question/121031/titanium-studio-and-mobile-sdk-17-createimageview-no-longer-works]
  10. Bill Dawson 2012-02-07

    Worked on in the newer ticket.
  11. Lee Morris 2017-03-24

    Closing ticket as duplicate with reference to the linked issues.

JSON Source