Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-20410] Android: Adding view as a customView to an annotation in maps crashes the app

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionFixed
Resolution Date2016-02-17T04:24:38.000+0000
Affected Version/sRelease 5.2.0
Fix Version/sRelease 5.2.0
ComponentsAndroid
Labelsqe-5.2.0, regression
ReporterLokesh Choudhary
AssigneeHieu Pham
Created2016-02-16T20:29:20.000+0000
Updated2016-05-27T22:46:44.000+0000

Description

*NOTE: This is a regression. Not seen in 5.1.2.GA.*

Steps to reproduce:

1. Use the below code in your app.js & make sure you are setup for android maps before running this:
var MapModule = require('ti.map');

var win = Ti.UI.createWindow({
		fullscreen : false
	});
	
var myView1 = Ti.UI.createView({
	width : 100,
	height : 100,
	backgroundColor : 'red'
});

var anno = MapModule.createAnnotation({
	latitude : -33.87365,
	customView : myView1,
	longitude : 151.20689,
	title : "Drag Me",
	subtitle : "Sydney is quite chill",
	draggable : true
});

var map = MapModule.createView({
	userLocation : true,
	mapType : MapModule.NORMAL_TYPE,
	animate : true,
	annotations : [anno],
	region : {
		latitude : -33.87365,
		longitude : 151.20689,
		latitudeDelta : 0.1,
		longitudeDelta : 0.1
	}, //Sydney
	// top : '30%'
});

win.add(map);
win.open();
2. Let the app launch on device.

Actual Results:

1. App crashes with logs:
*[ERROR] :  TiApplication: (main) [582,959] Sending event: exception on thread: main msg:java.lang.NoSuchMethodError: No virtual method toImage()Lorg/appcelerator/titanium/TiBlob; in class Lorg/appcelerator/titanium/proxy/TiViewProxy; or its super classes (declaration of 'org.appcelerator.titanium.proxy.TiViewProxy' appears in /data/app/com.appcelerator.mapmod-1/base.apk); Titanium 5.2.0,2016/02/16 09:13,e72b2b5
[ERROR] :  TiApplication: java.lang.NoSuchMethodError: No virtual method toImage()Lorg/appcelerator/titanium/TiBlob; in class Lorg/appcelerator/titanium/proxy/TiViewProxy; or its super classes (declaration of 'org.appcelerator.titanium.proxy.TiViewProxy' appears in /data/app/com.appcelerator.mapmod-1/base.apk)
[ERROR] :  TiApplication: 	at ti.map.AnnotationProxy.handleCustomView(AnnotationProxy.java:206)
[ERROR] :  TiApplication: 	at ti.map.AnnotationProxy.processOptions(AnnotationProxy.java:192)
[ERROR] :  TiApplication: 	at ti.map.TiUIMapView.addAnnotation(TiUIMapView.java:393)
[ERROR] :  TiApplication: 	at ti.map.TiUIMapView.addAnnotations(TiUIMapView.java:406)
[ERROR] :  TiApplication: 	at ti.map.TiUIMapView.processMapProperties(TiUIMapView.java:211)
[ERROR] :  TiApplication: 	at ti.map.TiUIMapView.onMapReady(TiUIMapView.java:162)
[ERROR] :  TiApplication: 	at com.google.android.gms.maps.SupportMapFragment$zza$1.zza(Unknown Source)
[ERROR] :  TiApplication: 	at com.google.android.gms.maps.internal.zzm$zza.onTransact(Unknown Source)
[ERROR] :  TiApplication: 	at android.os.Binder.transact(Binder.java:387)
[ERROR] :  TiApplication: 	at com.google.android.gms.maps.internal.be.a(SourceFile:82)
[ERROR] :  TiApplication: 	at com.google.maps.api.android.lib6.e.fb.run(Unknown Source)
[ERROR] :  TiApplication: 	at android.os.Handler.handleCallback(Handler.java:739)
[ERROR] :  TiApplication: 	at android.os.Handler.dispatchMessage(Handler.java:95)
[ERROR] :  TiApplication: 	at android.os.Looper.loop(Looper.java:148)
[ERROR] :  TiApplication: 	at android.app.ActivityThread.main(ActivityThread.java:5417)
[ERROR] :  TiApplication: 	at java.lang.reflect.Method.invoke(Native Method)
[ERROR] :  TiApplication: 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
[ERROR] :  TiApplication: 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

Expected Results:

1. App should not crash & view should be visible on the annotation.

Comments

  1. Hieu Pham 2016-02-17

    master PR: https://github.com/appcelerator/titanium_mobile/pull/7743 5_2_X PR: https://github.com/appcelerator/titanium_mobile/pull/7744
  2. Ashraf Abu 2016-02-17

    Master and 5_2_X PR merged.
  3. Harry Bryant 2016-02-17

    Verified as fixed, Using latest components, Running the sample code on Android no longer crashes on launch, and a view is visible on the annotation. Tested on: Android NEXUS 6P device (6.0) Mac OSX El Capitan 10.11.3 (15D21) Ti SDK: 5.2.0.v20160216202526 Appc Studio: 4.5.0.201602170254 Appc NPM: 4.2.3-2 App CLI: 5.2.0-265 Xcode 7.2 Node v4.2.6 production *Closing ticket.*

JSON Source