Titanium JIRA Archive
Appcelerator Community (AC)

[AC-4635] Android: Ti.Map 3.0.1 crashing on 6.0.0.GA

GitHub Issuen/a
TypeBug
Priorityn/a
StatusClosed
ResolutionCannot Reproduce
Resolution Date2016-11-30T15:03:06.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsAppcelerator Modules
LabelsTi.Map, module
ReporterUriel Lizama
AssigneeShak Hossain
Created2016-11-21T21:19:08.000+0000
Updated2016-11-30T15:03:06.000+0000

Description

When using the following code:
var Map = require("ti.map");
var win = Ti.UI.createWindow();

var anno = Map.createAnnotation({
    latitude: "38.7334226",
    longitude: "-77.7719012",
    title: "Location Title",
    subtitle: "Location Subtitle"
});

var map = Map.createView({
    width: Ti.UI.FILL,
    height: 120,
    mapType: Map.NORMAL_TYPE,
    regionFit: true,
    userLocation: true,
    annotations: [anno],
    region: {
        latitude: "38.7334226",
        latitudeDelta: 0.05,
        longitude: "-77.7719012",
        longitudeDelta: 0.05
    }
});

win.add(map);
win.open()
The app crashes with the following error:
[ERROR] AndroidRuntime: FATAL EXCEPTION: main
[ERROR] AndroidRuntime: Process: APP, PID: 13920
[ERROR] AndroidRuntime: java.lang.NoClassDefFoundError: com.google.android.gms.maps.GoogleMapOptions
[ERROR] AndroidRuntime: 	at ti.map.TiUIMapView.createFragment(TiUIMapView.java:108)
[ERROR] AndroidRuntime: 	at org.appcelerator.titanium.view.TiUIFragment.<init>(TiUIFragment.java:50)
[ERROR] AndroidRuntime: 	at ti.map.TiUIMapView.<init>(TiUIMapView.java:69)
[ERROR] AndroidRuntime: 	at ti.map.ViewProxy.createView(ViewProxy.java:80)
[ERROR] AndroidRuntime: 	at org.appcelerator.titanium.proxy.TiViewProxy.handleGetView(TiViewProxy.java:490)
[ERROR] AndroidRuntime: 	at org.appcelerator.titanium.proxy.TiViewProxy.getOrCreateView(TiViewProxy.java:476)
[ERROR] AndroidRuntime: 	at org.appcelerator.titanium.proxy.TiViewProxy.realizeViews(TiViewProxy.java:514)
[ERROR] AndroidRuntime: 	at org.appcelerator.titanium.proxy.TiViewProxy.handleGetView(TiViewProxy.java:498)
[ERROR] AndroidRuntime: 	at org.appcelerator.titanium.proxy.TiViewProxy.getOrCreateView(TiViewProxy.java:476)
[ERROR] AndroidRuntime: 	at org.appcelerator.titanium.proxy.TiViewProxy.realizeViews(TiViewProxy.java:514)
[ERROR] AndroidRuntime: 	at org.appcelerator.titanium.proxy.TiViewProxy.handleGetView(TiViewProxy.java:498)
[ERROR] AndroidRuntime: 	at org.appcelerator.titanium.proxy.TiViewProxy.getOrCreateView(TiViewProxy.java:476)
[ERROR] AndroidRuntime: 	at org.appcelerator.titanium.proxy.TiViewProxy.handleAdd(TiViewProxy.java:677)
[ERROR] AndroidRuntime: 	at org.appcelerator.titanium.proxy.TiViewProxy.add(TiViewProxy.java:571)
[ERROR] AndroidRuntime: 	at ti.modules.titanium.ui.WindowProxy.windowCreated(WindowProxy.java:262)
[ERROR] AndroidRuntime: 	at org.appcelerator.titanium.TiActivityWindows.windowCreated(TiActivityWindows.java:33)
[ERROR] AndroidRuntime: 	at org.appcelerator.titanium.TiBaseActivity.windowCreated(TiBaseActivity.java:559)
[ERROR] AndroidRuntime: 	at org.appcelerator.titanium.TiBaseActivity.onCreate(TiBaseActivity.java:673)
[ERROR] AndroidRuntime: 	at org.appcelerator.titanium.TiActivity.onCreate(TiActivity.java:18)
[ERROR] AndroidRuntime: 	at android.app.Activity.performCreate(Activity.java:5966)
[ERROR] AndroidRuntime: 	at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106)
[ERROR] AndroidRuntime: 	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2408)
[ERROR] AndroidRuntime: 	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2521)
[ERROR] AndroidRuntime: 	at android.app.ActivityThread.access$800(ActivityThread.java:162)
[ERROR] AndroidRuntime: 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1412)
[ERROR] AndroidRuntime: 	at android.os.Handler.dispatchMessage(Handler.java:106)
[ERROR] AndroidRuntime: 	at android.os.Looper.loop(Looper.java:189)
[ERROR] AndroidRuntime: 	at android.app.ActivityThread.main(ActivityThread.java:5535)
[ERROR] AndroidRuntime: 	at java.lang.reflect.Method.invoke(Native Method)
[ERROR] AndroidRuntime: 	at java.lang.reflect.Method.invoke(Method.java:372)
[ERROR] AndroidRuntime: 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:950)
[ERROR] AndroidRuntime: 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:745)

Comments

  1. Sharif AbuDarda 2016-11-28

    Hello, Try using the below code. Android permissing for location access has changed from Android 6 and up http://stackoverflow.com/questions/32936011/access-fine-location-permission, See guide: http://docs.appcelerator.com/platform/latest/#!/api/Titanium.Android-method-requestPermissions
       var Map = require("ti.map");
       var win = Ti.UI.createWindow();
       var locationPermission = "android.permission.ACCESS_FINE_LOCATION";
       var hasLocationPermission = Ti.Android.hasPermission(locationPermission);
       var permissionsToRequest = [];
       
       if (!hasLocationPermission) {
           permissionsToRequest.push(locationPermission);
       }
       if (permissionsToRequest.length > 0) {
           Ti.Android.requestPermissions(permissionsToRequest, function(e) {
               if (e.success) {
                   Ti.API.info("SUCCESS");
                   win.open();
               } else {
                   Ti.API.info("ERROR: " + e.error);
               }
           });
       }
       
       var anno = Map.createAnnotation({
           latitude : "38.7334226",
           longitude : "-77.7719012",
           title : "Location Title",
           subtitle : "Location Subtitle"
       });
       
       var map = Map.createView({
           width : Ti.UI.FILL,
           height : 120,
           mapType : Map.NORMAL_TYPE,
           regionFit : true,
           userLocation : true,
           annotations : [anno],
           region : {
               latitude : "38.7334226",
               latitudeDelta : 0.05,
               longitude : "-77.7719012",
               longitudeDelta : 0.05
           }
       });
       
       win.add(map);
       
    Thanks.

JSON Source