hansemannn / titanium-googlemaps

🗺 Use the Google Maps SDK in Titanium
Other
87 stars 26 forks source link

Crashes at startup when using "use-app-thinning" #83

Closed AndreaVitale closed 7 years ago

AndreaVitale commented 7 years ago

Hi @hansemannn, first of all thank for your amazing work! I'm trying to use this module with Alloy on an app with Ti SDK 5.5.1.GA, but it crashes at startup with this stacktrace:

[DEBUG] Mar 14 08:59:56  google-maps[12602] <Error>: CGContextSetFillColorWithColor: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
[DEBUG] Mar 14 08:59:56  google-maps[12602] <Error>: CGContextSetStrokeColorWithColor: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
[DEBUG] Mar 14 08:59:56  google-maps[12602] <Error>: CGContextGetCompositeOperation: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
[DEBUG] Mar 14 08:59:56  google-maps[12602] <Error>: CGContextSetCompositeOperation: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
[DEBUG] Mar 14 08:59:56  google-maps[12602] <Error>: CGContextFillRects: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
[DEBUG] Mar 14 08:59:56  google-maps[12602] <Error>: CGContextSetCompositeOperation: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
[DEBUG] Mar 14 08:59:56  google-maps[12602] <Error>: CGContextSetFillColorWithColor: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
[DEBUG] Mar 14 08:59:56  google-maps[12602] <Error>: CGContextSetStrokeColorWithColor: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
[DEBUG] Mar 14 08:59:56  google-maps[12602] <Error>: CGContextGetBlendMode: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
[DEBUG] Mar 14 08:59:56  google-maps[12602] <Error>: CGContextSetBlendMode: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
[DEBUG] Mar 14 08:59:56  google-maps[12602] <Error>: CGContextFillRects: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
[DEBUG] Mar 14 08:59:56  google-maps[12602] <Error>: CGContextSetBlendMode: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
[DEBUG] Mar 14 08:59:56  google-maps[12602] <Error>: CGContextSetFillColorWithColor: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
[DEBUG] Mar 14 08:59:56  google-maps[12602] <Error>: CGContextSetStrokeColorWithColor: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
[DEBUG] Mar 14 08:59:56  google-maps[12602] <Error>: CGContextGetBlendMode: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
[DEBUG] Mar 14 08:59:56  google-maps[12602] <Error>: CGContextSetBlendMode: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
[DEBUG] Mar 14 08:59:56  google-maps[12602] <Error>: CGContextFillRects: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
[DEBUG] Mar 14 08:59:56  google-maps[12602] <Error>: CGContextSetBlendMode: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
[INFO]  appcelerator: Appcelerator (San Jose, CA)
[INFO]  apple: Apple (Cupertino, CA)
[INFO]  facebook: Facebook (Menlo Park, CA)
[INFO]  microsoft: Microsoft (Redmond, WA)
[INFO]  2017-03-14 08:59:56.886 google-maps[12602:44354739] ((null)) was false: Cannot find image GMSSprites-0-2x
[INFO]  2017-03-14 08:59:56.887 google-maps[12602:44354739] ((null)) was false: Image data can't be NULL.
[INFO]  2017-03-14 08:59:56.887 google-maps[12602:44354739] ((null)) was false: Cannot find image GMSNavSprites-0-2x
[INFO]  2017-03-14 08:59:56.887 google-maps[12602:44354739] ((null)) was false: Image data can't be NULL.
[INFO]  2017-03-14 08:59:56.887 google-maps[12602:44354739] ((null)) was false: Cannot find image GMSNavNightModeSprites-0-2x
[INFO]  2017-03-14 08:59:56.888 google-maps[12602:44354739] ((null)) was false: Image data can't be NULL.
[INFO]  2017-03-14 08:59:56.888 google-maps[12602:44354739] ((null)) was false: Cannot find image polyline_colors_texture
[INFO]  2017-03-14 08:59:56.889 google-maps[12602:44354739] ((null)) was false: Image data can't be NULL.
[INFO]  2017-03-14 08:59:56.889 google-maps[12602:44354739] ((null)) was false: Invalid texture state for routesTextureState.
[INFO]  2017-03-14 08:59:56.889 google-maps[12602:44354739] ((null)) was false: Cannot find image polyline_colors_texture_dim
[INFO]  2017-03-14 08:59:56.889 google-maps[12602:44354739] ((null)) was false: Image data can't be NULL.
[INFO]  2017-03-14 08:59:56.890 google-maps[12602:44354739] ((null)) was false: Invalid texture state for routesDimTextureState.

I have a reference to the module inside alloy.js:

Alloy.Globals.GoogleMaps = require('ti.googlemaps');
Alloy.Globals.GoogleMaps.setAPIKey('API_KEY');

and inside my index.js I have:

var companies = {
    appcelerator: {
        title: "Appcelerator",
        city: "San Jose, CA",
        latitude: 37.368122,
        longitude: -121.913653
    },
    apple: {
        title: "Apple",
        city: "Cupertino, CA",
        latitude: 37.331711,
        longitude: -122.030184
    },
    facebook: {
        title: "Facebook",
        city: "Menlo Park, CA",
        latitude: 37.4748624,
        longitude: -122.1490817
    },
    microsoft: {
        title: "Microsoft",
        city: "Redmond, WA",
        latitude: 47.641959,
        longitude: -122.130588
    }
};

$.Map.region = {
    latitude: companies.appcelerator.latitude,
    longitude: companies.appcelerator.longitude,
    zoom: 10
};

addMarkers(companies);

$.index.open();

function addMarkers(companies) {
    for (var key in companies)
        if (companies.hasOwnProperty(key)) {
            var company = companies[key];

            var annotation = Alloy.Globals.GoogleMaps.createAnnotation({
                latitude: company.latitude,
                longitude: company.longitude,
                title: company.title,
                subtitle: company.city
            });

            $.Map.addAnnotation(annotation);

            Ti.API.info(key + ": " + company.title + " (" + company.city + ")");
        }
}

How can I solve? Thank you.

hansemannn commented 7 years ago

We has this report many times now, it was always one of the above issues on the devs side.

AndreaVitale commented 7 years ago

Previously I had an unrestricted API Key. Now I create an iOS App API Key with the same bundle id but I got the same error.

EDIT: Removing all annotations the app doesn't crash. So the annotation seems to be the problem.

hansemannn commented 7 years ago

Mhhh..the error looks like something different. Would you be able to provide a sample project or tiapp.xml?

AndreaVitale commented 7 years ago

Here is the sample app. I attach also the screenshot from google developer console. google-maps.zip

schermata 2017-03-14 alle 10 04 19 schermata 2017-03-14 alle 10 05 23
hansemannn commented 7 years ago

That's the bad boy:

<use-app-thinning>true</use-app-thinning>

Seems like there is an SDK issue with app-thinning & modules bundles. I'll file a ticket for that. Removing that lines fixes it for me.

Topener commented 7 years ago

Can confirm this also fixes it for me!

AndreaVitale commented 7 years ago

I confirm that it works also for me, thank you :)

hansemannn commented 7 years ago
hansemannn commented 7 years ago

Core-PR available here, try it out!

hansemannn commented 7 years ago

Will be resolved in 6.1.0. Grab the PR from above if you'r experiencing the issue. I'll keep this ticket open for now, so other people can refer to the fix.

hansemannn commented 7 years ago

PR was merged, available in 6.1.0.