Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-23488

Closing a window with a map view added crashes the app (android)

    Details

    • Type: Bug
    • Status: Closed
    • Priority: High
    • Resolution: Invalid
    • Affects Version/s: Release 5.3.0
    • Fix Version/s: None
    • Component/s: Android
    • Environment:

      Android 4.1, 4.3, 6
      Titanium 5.3.0.GA
      Ti.Map (tested versions from 2.2.5 to 2.3.4)

    • Sprint:
      2016 Sprint 13 SDK

      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
      

        Attachments

          Activity

            People

            • Assignee:
              emerriman Eric Merriman
              Reporter:
              jaraen Javier Rayon
            • Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Backbone Issue Sync

                • Titanium SDK/CLI <> Titanium Mobile
                  Synced with:
                  TIMOB-9807
                  Sync status:
                  ERROR
                  Last received:
                  Last sent:

                  Git Source Code