Uploaded image for project: 'Appcelerator - INBOX'
  1. Appcelerator - INBOX
  2. AC-1834

Google Maps Android API v2 doesn't work when I build the app with new CLI

    Details

    • Type: Bug
    • Status: Closed
    • Resolution: Fixed
    • Affects Version/s: None
    • Labels:
    • Environment:

      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 :

      And I have implemented a minimal app :

      app.js

      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

        1. app.js
          0.3 kB
        2. mapv2_empty.png
          mapv2_empty.png
          15 kB
        3. mapv2_ok.png
          mapv2_ok.png
          120 kB

          Activity

            People

            • Assignee:
              dsefton Daniel Sefton
              Reporter:
              romain.salles Romain Salles
            • Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Git Source Code