{ "id": "132389", "key": "TIMOB-17462", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [], "resolution": null, "resolutiondate": null, "created": "2014-06-28T17:04:51.000+0000", "priority": { "name": "Medium", "id": "3" }, "labels": [], "versions": [], "issuelinks": [], "assignee": null, "updated": "2018-07-27T23:21:50.000+0000", "status": { "description": "The issue is open and ready for the assignee to start work on it.", "name": "Open", "id": "1", "statusCategory": { "id": 2, "key": "new", "colorName": "blue-gray", "name": "To Do" } }, "components": [], "description": "h4. Problem Description\r\nEverytime I try to use a density independent image as map annotation rightButton property, I get the following error (like the image was not there):\r\n\r\n{code}\r\n[WARN] dalvikvm: VFY: unable to resolve static field 1611 (common_google_play_services_install_button) in Lcom/google/android/gms/R$string;\r\n[WARN] dalvikvm: VFY: unable to resolve static field 1608 (common_google_play_services_enable_button) in Lcom/google/android/gms/R$string;\r\n[WARN] dalvikvm: VFY: unable to resolve static field 1623 (common_google_play_services_update_button) in Lcom/google/android/gms/R$string;\r\n[WARN] dalvikvm: VFY: unable to resolve static field 1619 (common_google_play_services_unknown_issue) in Lcom/google/android/gms/R$string;\r\n[WARN] dalvikvm: VFY: unable to resolve static field 1613 (common_google_play_services_install_text_tablet) in Lcom/google/android/gms/R$string;\r\n[WARN] dalvikvm: VFY: unable to resolve static field 1612 (common_google_play_services_install_text_phone) in Lcom/google/android/gms/R$string;\r\n[WARN] dalvikvm: VFY: unable to resolve static field 1609 (common_google_play_services_enable_text) in Lcom/google/android/gms/R$string;\r\n[WARN] dalvikvm: VFY: unable to resolve static field 1624 (common_google_play_services_update_text) in Lcom/google/android/gms/R$string;\r\n[WARN] dalvikvm: VFY: unable to resolve static field 1621 (common_google_play_services_unsupported_text) in Lcom/google/android/gms/R$string;\r\n[WARN] dalvikvm: VFY: unable to resolve static field 1617 (common_google_play_services_network_error_text) in Lcom/google/android/gms/R$string;\r\n[WARN] dalvikvm: VFY: unable to resolve static field 1615 (common_google_play_services_invalid_account_text) in Lcom/google/android/gms/R$string;\r\n[WARN] dalvikvm: VFY: unable to resolve static field 1620 (common_google_play_services_unsupported_date_text) in Lcom/google/android/gms/R$string;\r\n[WARN] dalvikvm: VFY: unable to resolve static field 1619 (common_google_play_services_unknown_issue) in Lcom/google/android/gms/R$string;\r\n[ERROR] GooglePlayServicesUtil: The Google Play services resources were not found. Check your project configuration to ensure that the resources are included.\r\n[INFO] I/Google Maps Android API: Google Play services client version: 4132500\r\n[INFO] I/Google Maps Android API: Google Play services package version: 4452032\r\n[INFO] fpp: Making Creator dynamically\r\n[INFO] I/Google Maps Android API: Google Play services client version: 4452000\r\n[DEBUG] dalvikvm: GC_CONCURRENT freed 1928K, 25% free 8152K/10755K, paused 29ms+18ms, total 129ms\r\n[INFO] Choreographer: Skipped 79 frames! The application may be doing too much work on its main thread.\r\n[INFO] I/Adreno200-EGL: : EGL 1.4 QUALCOMM build: AU_LINUX_ANDROID_JB_REL_RB1.04.01.01.06.042_msm7627a_JB_REL_RB1.2_Merge_release_AU (Merge)\r\n[INFO] I/Adreno200-EGL: Build Date: 11/06/12 Tue\r\n[INFO] I/Adreno200-EGL: Local Branch:\r\n[INFO] I/Adreno200-EGL: Remote Branch: m/jb_rel_rb1.2\r\n[INFO] I/Adreno200-EGL: Local Patches: NONE\r\n[INFO] I/Adreno200-EGL: Reconstruct Branch: AU_LINUX_ANDROID_JB_REL_RB1.04.01.01.06.042 + NOTHING\r\n[ERROR] TiDrawableReference: (main) [2960,2960] Problem opening stream with url /images/infoicon.png: Resources/images/infoicon.png\r\n[ERROR] TiDrawableReference: java.io.FileNotFoundException: Resources/images/infoicon.png\r\n[ERROR] TiDrawableReference: at android.content.res.AssetManager.openAsset(Native Method)\r\n[ERROR] TiDrawableReference: at android.content.res.AssetManager.open(AssetManager.java:315)\r\n[ERROR] TiDrawableReference: at android.content.res.AssetManager.open(AssetManager.java:289)\r\n[ERROR] TiDrawableReference: at org.appcelerator.titanium.util.TiFileHelper.openInputStream(TiFileHelper.java:220)\r\n[ERROR] TiDrawableReference: at org.appcelerator.titanium.view.TiDrawableReference.getInputStream(TiDrawableReference.java:791)\r\n[ERROR] TiDrawableReference: at org.appcelerator.titanium.view.TiDrawableReference.getBitmap(TiDrawableReference.java:300)\r\n[ERROR] TiDrawableReference: at org.appcelerator.titanium.view.TiDrawableReference.getBitmap(TiDrawableReference.java:284)\r\n[ERROR] TiDrawableReference: at ti.map.TiMapInfoWindow.setLeftOrRightPane(TiMapInfoWindow.java:171)\r\n[ERROR] TiDrawableReference: at ti.map.AnnotationProxy.processOptions(AnnotationProxy.java:168)\r\n[ERROR] TiDrawableReference: at ti.map.TiUIMapView.addAnnotation(TiUIMapView.java:327)\r\n[ERROR] TiDrawableReference: at ti.map.TiUIMapView.addAnnotations(TiUIMapView.java:341)\r\n[ERROR] TiDrawableReference: at ti.map.TiUIMapView.processMapProperties(TiUIMapView.java:157)\r\n[ERROR] TiDrawableReference: at ti.map.TiUIMapView.onViewCreated(TiUIMapView.java:111)\r\n[ERROR] TiDrawableReference: at org.appcelerator.titanium.view.TiUIFragment.handleMessage(TiUIFragment.java:65)\r\n[ERROR] TiDrawableReference: at android.os.Handler.dispatchMessage(Handler.java:95)\r\n[ERROR] TiDrawableReference: at android.os.Looper.loop(Looper.java:137)\r\n[ERROR] TiDrawableReference: at android.app.ActivityThread.main(ActivityThread.java:4795)\r\n[ERROR] TiDrawableReference: at java.lang.reflect.Method.invokeNative(Native Method)\r\n[ERROR] TiDrawableReference: at java.lang.reflect.Method.invoke(Method.java:511)\r\n[ERROR] TiDrawableReference: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)\r\n[ERROR] TiDrawableReference: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:556)\r\n[ERROR] TiDrawableReference: at dalvik.system.NativeStart.main(Native Method)\r\n{code}\r\n\r\n\r\nh3.Testing Environment:\r\nTitanium SDK: 3.2.3.GA 3.3.0.RC,\r\nTitanium CLI: 3.3.0 –rc,\r\nAndroid SDK: 4.2.2,4.4.2,\r\nOS X Version: 10.9.3,\r\nAppcelerator Studio: 3.2.3\r\n\r\nh3.Steps to reproduce the issue:\r\n 1.Create a Alloy project.\r\n 2.Paste this code in index.xml,index.js file and Alloy.js file.\r\n 3.configure your tiapp.xml file with Google API key.\r\n 4. Paste some density-independent image in Android>images>> folders\r\n 5.Run this code with testing environment.\r\n\r\n{code: title=index.xml}\r\n\r\n\t\r\n\t\t\r\n\t\t\r\n\t\t\r\n\t\r\n\r\n{code}\r\n\r\n{code: title=index.js}\r\n$.map.setAnnotations([Alloy.Globals.Map.createAnnotation({\r\n\tlatitude : 35.8667,\r\n\tlongitude : 6.2333,\r\n\ttitle : 'A title',\r\n\tsubtitle:'test',\r\n\trightButton : \"/images/infoicon.png\"\r\n}), Alloy.Globals.Map.createAnnotation({\r\n\tlatitude : 44.8667,\r\n\tlongitude : 10.2333,\r\n\ttitle : 'Another title',\r\n\tsubtitle:'test',\r\n\tleftButton : \"/images/infoicon.png\"\r\n})]);\r\n\r\n$.index.open();\r\n\r\n{code}\r\n{code: title=alloy.js}\r\nAlloy.Globals.Map = require('ti.map');\r\n{code}\r\n\r\n", "attachment": [ { "id": "50247", "filename": "ALOY1083_classic.zip", "author": { "name": "fmiao", "key": "fmiao", "displayName": "Feon Sua Xin Miao", "active": true, "timeZone": "America/Vancouver" }, "created": "2014-08-05T18:33:45.000+0000", "size": 82705, "mimeType": "application/zip" }, { "id": "50246", "filename": "classic.png", "author": { "name": "fmiao", "key": "fmiao", "displayName": "Feon Sua Xin Miao", "active": true, "timeZone": "America/Vancouver" }, "created": "2014-08-05T18:33:45.000+0000", "size": 1163253, "mimeType": "image/png" }, { "id": "49364", "filename": "rightbutton.tgz", "author": { "name": "landimatte", "key": "landimatte", "displayName": "Matteo Landi", "active": true, "timeZone": "Europe/Berlin" }, "created": "2014-06-28T17:04:51.000+0000", "size": 25284, "mimeType": "application/x-compressed-tar" } ], "flagged": false, "summary": "Can't use density-independent image as map annotation rightButton", "creator": { "name": "landimatte", "key": "landimatte", "displayName": "Matteo Landi", "active": true, "timeZone": "Europe/Berlin" }, "subtasks": [], "reporter": { "name": "landimatte", "key": "landimatte", "displayName": "Matteo Landi", "active": true, "timeZone": "Europe/Berlin" }, "environment": "- os: ubuntu 14.04\r\n- ti-sdk: 3.2.3.GA", "comment": { "comments": [ { "id": "313857", "author": { "name": "mpmiranda", "key": "mpmiranda", "displayName": "Mauro Parra-Miranda", "active": true, "timeZone": "America/Mexico_City" }, "body": "Reported by [~landimatte]", "updateAuthor": { "name": "mpmiranda", "key": "mpmiranda", "displayName": "Mauro Parra-Miranda", "active": true, "timeZone": "America/Mexico_City" }, "created": "2014-07-14T16:26:20.000+0000", "updated": "2014-07-14T16:26:20.000+0000" }, { "id": "317138", "author": { "name": "fmiao", "key": "fmiao", "displayName": "Feon Sua Xin Miao", "active": true, "timeZone": "America/Vancouver" }, "body": "This doesn't seem like an Alloy issue.\r\nTested using the attached Classic project, ALOY1083_classic.zip, {{leftButton}} and {{rightButton}} properties are not working, use the same value on {{image}} property, the image shows. \r\n\r\nHere is the error log when trying to load the image:\r\n{code}\r\n[ERROR] : TiDrawableReference: (main) [555,555] Problem opening stream with url /images/infoicon.png: Resources/images/infoicon.png\r\n[ERROR] : TiDrawableReference: java.io.FileNotFoundException: Resources/images/infoicon.png\r\n{code}\r\n\r\nHere's the code snippet:\r\n{code}\r\nvar opera = MapModule.createAnnotation({\r\n latitude: -33.8569,\r\n longitude: 151.2153,\r\n image: '/images/infoicon.png',\r\n leftButton: '/images/infoicon.png', \r\n title: 'Sydney Opera House',\r\n subtitle: 'Sydney, New South Wales, Australia'\r\n});\r\n\r\nvar bridge = MapModule.createAnnotation({\r\n latitude: -33.852222,\r\n longitude: 151.210556,\r\n image: '/images/infoicon.png',\r\n rightButton: '/images/infoicon.png', \r\n title: 'Sydney Harbour Bridge',\r\n subtitle: 'Port Jackson'\r\n});\r\n{code}", "updateAuthor": { "name": "fmiao", "key": "fmiao", "displayName": "Feon Sua Xin Miao", "active": true, "timeZone": "America/Vancouver" }, "created": "2014-08-05T18:33:45.000+0000", "updated": "2014-08-06T09:31:55.000+0000" }, { "id": "317248", "author": { "name": "jfalcone", "key": "jfalcone", "displayName": "Joe Falcone", "active": true, "timeZone": "America/Los_Angeles" }, "body": "We've had this same problem for quite some time - I can't recall when it worked properly. And its a problem for Alloy and direct programming.\r\n\r\nWe have had to implement the code below to get the leftButton or rightButton images to size properly on different platforms. This particular example is scaling an (i) for info button to be the right size for different densities. When we try to do this by putting the different sizes in the Android images folders (either under platform/Android or Resources/Android), the correct image is not selected.\r\n\r\n{code}\r\n switch (density) {\r\n case 'low' :\r\n infoGraphic = '/images/info-32.png';\r\n break;\r\n case 'medium' :\r\n infoGraphic = '/images/info-48.png';\r\n break;\r\n case 'high' :\r\n infoGraphic = '/images/info-64.png';\r\n break;\r\n case 'xhigh' :\r\n infoGraphic = '/images/info-72.png';\r\n break;\r\n case 'xxhigh' :\r\n infoGraphic = '/images/info-96.png';\r\n break;\r\n default:\r\n infoGraphic = '/images/info-64.png';\r\n break;\r\n }\r\n{code}\r\n\r\nThen we use the \"infoGraphic\" in the annotation - and because we've assigned the correct size to the variable, it displays an appropriate scaled leftButton.\r\n\r\n{code}\r\nvar annot = TiMap.createAnnotation({\r\n latitude : entry.latitude,\r\n longitude : entry.longitude,\r\n title : entry.name,\r\n subtitle : subtitle,\r\n leftButton : infoGraphic ,\r\n image : entry.icon,\r\n });\r\n{code}", "updateAuthor": { "name": "jfalcone", "key": "jfalcone", "displayName": "Joe Falcone", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-08-06T09:12:48.000+0000", "updated": "2014-08-06T09:19:47.000+0000" }, { "id": "317258", "author": { "name": "jfalcone", "key": "jfalcone", "displayName": "Joe Falcone", "active": true, "timeZone": "America/Los_Angeles" }, "body": "The point is that if you put your leftButton or rightButton graphic into the density-specific directories (e.g. drawable-hdpi under platform/android/res or res-hdpi under Resources/android/images) the code DOES NOT pick up the appropriate graphic for the density.\r\n\r\nYes, it has nothing to do with using or not using Alloy.", "updateAuthor": { "name": "jfalcone", "key": "jfalcone", "displayName": "Joe Falcone", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-08-06T09:37:24.000+0000", "updated": "2014-08-06T09:37:24.000+0000" }, { "id": "317263", "author": { "name": "jfalcone", "key": "jfalcone", "displayName": "Joe Falcone", "active": true, "timeZone": "America/Los_Angeles" }, "body": "If you want a test case, just look at the MapView on Kitchen Sink 3.3.0 with the leftButton image that is supposed to be of the Atlanta Braves Baseball Stadium - but it is so small on a high-density device like an HTC One or Samsung Galaxy S4 or 5 that you can't even make the picture out. \r\n\r\nSo if you then try to create density specify images in the Resources/android/images directory under high, xhigh or xxhigh, they aren't picked up for the leftButton or rightButton - the same image in Resources/images is used.", "updateAuthor": { "name": "jfalcone", "key": "jfalcone", "displayName": "Joe Falcone", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-08-06T10:02:13.000+0000", "updated": "2014-08-06T10:02:13.000+0000" }, { "id": "374442", "author": { "name": "buder", "key": "buder", "displayName": "Jörgen Buder", "active": true, "timeZone": "Europe/Berlin" }, "body": "Isn´t this a quite critical bug? I use SDK 5.0.2 today and the latest API 21/23 for Android and still we cannot use density specific image for the annotation? It becomes almost impossible to use annotation in the map without being able to adapt the image. Joe how did you define the \"density\" variable that you use? ", "updateAuthor": { "name": "buder", "key": "buder", "displayName": "Jörgen Buder", "active": true, "timeZone": "Europe/Berlin" }, "created": "2016-01-13T20:22:43.000+0000", "updated": "2016-01-13T20:22:43.000+0000" }, { "id": "374532", "author": { "name": "jfalcone", "key": "jfalcone", "displayName": "Joe Falcone", "active": true, "timeZone": "America/Los_Angeles" }, "body": "var density = Ti.Platform.displayCaps.density;\r\n\r\nIt's the persistence of bugs like these plus the availability of so many APIs and SDKs from Apple, Android & 3rd Parties that are not supported by Titanium that is driving us (quite unwillingly) into native code on projects. Having good looking map annotations is kind of basic and we've had this work-around code in place for over 1.5 years now!", "updateAuthor": { "name": "jfalcone", "key": "jfalcone", "displayName": "Joe Falcone", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2016-01-14T05:54:44.000+0000", "updated": "2016-01-14T05:54:44.000+0000" }, { "id": "374546", "author": { "name": "buder", "key": "buder", "displayName": "Jörgen Buder", "active": true, "timeZone": "Europe/Berlin" }, "body": "Thanks Joe for the fast answer, \r\n\r\nIt is indeed too bad this is not fixed, but I will have a go on support side and ask, how ever I do not completely agree with you there, it is WAY more expensive to make 3 - 4 native apps then one that covers 80% of code cross platform, not to mention the overhead in maintenance and new feature implementation. We use native modules when needed which is just sometimes and it works well. Looking forward to using hyperloop now in Windows Phone which kind of makes it easier. (slightly off topic I guess) but thanks for the info...\r\n\r\n/J", "updateAuthor": { "name": "buder", "key": "buder", "displayName": "Jörgen Buder", "active": true, "timeZone": "Europe/Berlin" }, "created": "2016-01-14T07:56:30.000+0000", "updated": "2016-01-14T07:56:30.000+0000" }, { "id": "431057", "author": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "body": "We would need to change our map code here...\r\nhttps://github.com/appcelerator-modules/ti.map/blob/master/android/src/ti/map/AnnotationProxy.java#L265\r\n\r\n...to load an Android \"BitmapDrawable\" similar to how I did it in the Aisle411 module here...\r\nhttps://github.com/hansemannn/titanium-aisle411/blob/329fe441e7ffce522d0432a205f32c5f6bd18088/android/src/ti/aisle411/MapViewProxy.java#L421\r\n\r\nWith the only aspect that I don't like about this now is that TiDrawableReferece.getDensityScaledDrawable() will actually scale the bitmap pixels if loaded from the APK's \"assets\" folder, instead of loading the image as-is and then scale the drawable (ie: the OpenGL accelerated polygon) the bitmap is applied as a texture to. Not a big deal for small annotation images, but it is a giant performance/memory issue for large images.", "updateAuthor": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2017-11-20T21:13:08.000+0000", "updated": "2018-07-27T23:21:50.000+0000" } ], "maxResults": 13, "total": 13, "startAt": 0 } } }