Titanium JIRA Archive
Appcelerator Community (AC)

[AC-1834] Google Maps Android API v2 doesn't work when I build the app with new CLI

GitHub Issuen/a
TypeBug
Priorityn/a
StatusClosed
ResolutionFixed
Resolution Date2013-06-13T19:07:44.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsAppcelerator CLI, Titanium SDK & CLI
Labelsandroid, cli, mapv2
ReporterRomain Salles
AssigneeDaniel Sefton
Created2013-05-08T09:53:55.000+0000
Updated2016-03-08T07:40:44.000+0000

Description

I'm trying to integrate the module for *Google Maps Android API v2* in my android app.

Description

I have done every steps explained in these 2 pages : - [Titanium Map API](http://docs.appcelerator.com/titanium/3.0/#!/api/Modules.Map) - [Getting Started Google Maps Android API v2](https://developers.google.com/maps/documentation/android/start#the_google_maps_api_key) And I have implemented a minimal app :
var win = Titanium.UI.createWindow();
 
var MapModule = require('ti.map');
var mapView = MapModule.createView({
    mapType: MapModule.NORMAL_TYPE,
    region: {latitude:33.74511, longitude:-84.38993,
            latitudeDelta:0.01, longitudeDelta:0.01},
    animate:true,
    regionFit:true,
    userLocation:true
});
win.add(mapView);
 
win.open();
Until here, everything is ok... The next logic step is to test this code by building it and installing it on my device (and not in the emulator, since this module is not supported on it : cf. Titanium Map API) Thus, I build my app with the CLI :
titanium build \
  --platform android \
  --target device \
  -s 3.1.0.GA \
  --deploy-type test \
  --android-sdk /Users/romainsalles/android-sdk/ \
  --project-dir /Users/romainsalles/Dev/mapv2 \
  --keystore /Users/romainsalles/Dev/mapv2/mapv2-test.keystore \
  --password AWESOME_PASSWORD \
  --alias KEYSTORE_ALIAS \
  --output-dir /Users/romainsalles/Dev/mapv2/build/android \
  --avd-id 4

Errors

The *app opens but I don't have any map*. Nevertheless, I have the map buttons (cf. *mapv2_empty.png*) The errors obtained are these ones :
05-07 18:46:12.332: E/Google Maps Android API(28174): Authorization failure.
05-07 18:46:12.572: E/Google Maps Android API(28174): Failed to load map.  Could not contact Google servers.
I think these errors are due the fact that the app is signed with the Titanium keystore instead of mine. Indeed, the logs of the CLI return :
[DEBUG] keytool -v -list -keystore "/Users/romainsalles/Library/Application Support/Titanium/mobilesdk/osx/3.1.0.GA/android/dev_keystore" -storepass ******* -alias tidev
[DEBUG] jarsigner -sigalg MD5withRSA -digestalg SHA1 -storepass ******* -keystore "/Users/romainsalles/Library/Application Support/Titanium/mobilesdk/osx/3.1.0.GA/android/dev_keystore" -signedjar /Users/romainsalles/Dev/mapv2/build/android/bin/app.apk /Users/romainsalles/Dev/mapv2/build/android/bin/app-unsigned.apk tidev

A (not satisfying) solution

Then, I have tried to build the app with the plain old titanium commands :
/Users/romainsalles/Library/Application\ Support/Titanium/mobilesdk/osx/3.1.0.GA/android/builder.py distribute \
  Mapv2 \
  /Users/romainsalles/android-sdk/ \
  /Users/romainsalles/Dev/mapv2 \
  com.mapv2 \
  /Users/romainsalles/Dev/mapv2/mapv2-test.keystore \
  AWESOME_PASSWORD \
  KEYSTORE_ALIAS \
  /Users/romainsalles/Dev/mapv2/build/android \
  4 \
  8
Then, I download the app on my android and install it (note : the android ask me if accept the different permissions). Then, the *app opens and I can see the map* (cf. *mapv2_ok.png*)

The issue

I have worked on this problem a lot, but I didn't found any solution... Did I miss something or is it really impossible to build an app using the * Google Maps Android API v2* with the CLI ?

Attachments

FileDateSize
app.js2013-05-08T09:53:55.000+0000349
mapv2_empty.png2013-05-08T09:53:55.000+000015784
mapv2_ok.png2013-05-08T09:53:55.000+0000123033

Comments

  1. Romain Salles 2013-06-13

    I see this Jira has been re-assigned. I have solved my issue since the creation of this post. It was an issue with the keystore. I hadn't used yours for my build and, of course, it couldn't work. Thus, you can close this Jira. Sorry for forgetting to update the Jira.
  2. Daniel Sefton 2013-06-13

    Thanks - closing.

JSON Source