Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-23488] Closing a window with a map view added crashes the app (android)

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionInvalid
Resolution Date2016-06-20T03:32:18.000+0000
Affected Version/sRelease 5.3.0
Fix Version/sn/a
ComponentsAndroid
Labels5.3.0.GA, android, bug, crash, mapView, ti.map
ReporterJavier Rayon
AssigneeEric Merriman
Created2016-06-09T15:36:13.000+0000
Updated2017-03-24T18:01:43.000+0000

Description

When a window containing a map view is closed on android, it crashes with the exception included below. This used to work fine in 5.1.2. To close the window just use the device back button (closing the window programatically, i.e. using the action bar home button causes the same effect). Below I include a test case. Please note that you will have to configure some valid API KEY in your tiapp.xml file in order to test it
var Map = require('ti.map');

// Build main window

var win = Ti.UI.createWindow({});
var openMapButton = Ti.UI.createButton({title: 'open map'});
win.add(openMapButton);

openMapButton.addEventListener('click', function() {
	var mapWin = createMapWin();

	mapWin.addEventListener('close', function() {
		// This code never runs. Using sdk 5.1.2.GA runs fine.
		alert('this wont trigger');
	});
	mapWin.open();
});


// Build map window

function createMapWin() {
	var mapWin = Ti.UI.createWindow();
	var resultsMapview = Map.createView({
		mapType: Map.NORMAL_TYPE
	});

	mapWin.add(resultsMapview);

	return mapWin;
}

win.open();

Here is the exception rised.
[ERROR] TiApplication: (main) [125332,131828] Sending event: exception on thread: main msg:java.lang.RuntimeException: Unable to destroy activity {com.teamwire.messenger/org.appcelerator.titanium.TiActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void com.google.android.gms.maps.GoogleMap.clear()' on a null object reference; Titanium 5.3.0,2016/06/01 10:18,94fa8af
[ERROR] TiApplication: java.lang.RuntimeException: Unable to destroy activity {com.teamwire.messenger/org.appcelerator.titanium.TiActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void com.google.android.gms.maps.GoogleMap.clear()' on a null object reference

Comments

  1. Javier Rayon 2016-06-13

    seems that problem is solved with Ti.Map 2.3.6, I didn't realized that there was a newer version than 2.3.4 till now.
  2. Lee Morris 2017-03-24

    Closing ticket as invalid with reference to the above comments.

JSON Source