[solved] Maps in SDK1.0

Put problem concerning MapActivities, MapViews, Overlays and GPS in this forum.

[solved] Maps in SDK1.0

Postby cassianotartari » Thu Nov 13, 2008 7:05 pm

Hi !

I'd like to know what I'm doing wrong. I can't display a map, just a gray window.

In attach the logcat.

System:
Code: Select all
Linux
java-6-sun-1.6.0.07
eclipse europa 3.3.2
android sdk 1.0


To generate the key to use in the maps I just do this:
Code: Select all
cd /usr/lib/jvm/java-6-sun-1.6.0.07/bin/
sudo ./keytool -genkey -v -keystore debug.keystore -alias android -keyalg RSA -validity 10000

Copy the generate file debug.keystore to ~./android

and
Code: Select all
sudo ./keytool -list -alias android -keystore ~/.android/debug.keystore -storepass android -keypass android


Then I go to http://code.google.com/android/maps-api-signup.html , put the MD5 generate and get the apiKey.


My Code:


Map.java
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. package br.cassianotartari;
  2.  
  3. import com.google.android.maps.MapActivity;
  4.  
  5. import android.os.Bundle;
  6.  
  7. public class Map extends MapActivity {
  8.     /** Called when the activity is first created. */
  9.     @Override
  10.     public void onCreate(Bundle savedInstanceState) {
  11.         super.onCreate(savedInstanceState);
  12.         setContentView(R.layout.main);
  13.     }
  14.  
  15.         @Override
  16.         protected boolean isRouteDisplayed() {
  17.                 // TODO Auto-generated method stub
  18.                 return false;
  19.         }
  20. }
Parsed in 0.032 seconds, using GeSHi 1.0.8.4


AndroidManifest.xml
Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <manifest xmlns:android="http://schemas.android.com/apk/res/android"
  3.      package="br.cassianotartari"
  4.      android:versionCode="1"
  5.      android:versionName="1.0.0">
  6.  
  7.     <!-- Permissions -->
  8.     <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
  9.     <uses-permission android:name="android.permission.INTERNET" />
  10.  
  11.     <application android:icon="@drawable/icon" android:label="@string/app_name">
  12.  
  13.     <!-- Libraries -->
  14.         <uses-library android:name="com.google.android.maps" />
  15.  
  16.         <!-- Activities -->
  17.         <activity android:name=".Map"
  18.                  android:label="@string/app_name">
  19.             <intent-filter>
  20.                 <action android:name="android.intent.action.MAIN" />
  21.                 <category android:name="android.intent.category.LAUNCHER" />
  22.             </intent-filter>
  23.         </activity>
  24.  
  25.     </application>
  26. </manifest>
Parsed in 0.003 seconds, using GeSHi 1.0.8.4


main.xml
Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  3.        android:layout_width="fill_parent"
  4.        android:layout_height="fill_parent">
  5.         <com.google.android.maps.MapView android:id="@+id/map"
  6.                android:layout_width="fill_parent"
  7.                android:layout_height="fill_parent"
  8.                android:apiKey="my_generate_apiKey"
  9.                android:clickable="true" />
  10. </RelativeLayout>
Parsed in 0.002 seconds, using GeSHi 1.0.8.4
Attachments
log.txt
LogCat
(30.97 KiB) Downloaded 54 times
non_map.png
non_map.png (14.08 KiB) Viewed 303 times
Last edited by cassianotartari on Thu Nov 13, 2008 11:50 pm, edited 1 time in total.
public class pessoa {
private String nome = "Cassiano Tartari";
private String url = "www.cassianotartari.eng.br"
}
User avatar
cassianotartari
Developer
Developer
 
Posts: 28
Joined: Thu Aug 28, 2008 3:42 pm

Top

Postby Quetzalcoatl » Thu Nov 13, 2008 9:32 pm

Code: Select all
android:apiKey="my_generate_apiKey"


I take it that in your actual code you do replace my_generate_apiKey with the generated key from Google's webby?
Image
Quetzalcoatl
Senior Developer
Senior Developer
 
Posts: 129
Joined: Sat Oct 18, 2008 8:21 pm
Location: near Manchester, UK

Postby cassianotartari » Thu Nov 13, 2008 10:13 pm

Quetzalcoatl wrote:
Code: Select all
android:apiKey="my_generate_apiKey"


I take it that in your actual code you do replace my_generate_apiKey with the generated key from Google's webby?


Yes, I put the generate code in the place of "my_generate_apiKey"
public class pessoa {
private String nome = "Cassiano Tartari";
private String url = "www.cassianotartari.eng.br"
}
User avatar
cassianotartari
Developer
Developer
 
Posts: 28
Joined: Thu Aug 28, 2008 3:42 pm

Postby GasBot » Thu Nov 13, 2008 10:34 pm

That's what happens when you don't have the correct api key. I think what you did was build out a new key and get the md5 for that one, but when you're just hitting Play in Eclipse to use the emulator, it's not using that key. You don't need to do the first part (creating a new key) until you're ready to release the app. Look around I think there are directions here how to get the development key's md5.
GasBot
Experienced Developer
Experienced Developer
 
Posts: 50
Joined: Fri Oct 17, 2008 7:19 am

Postby cassianotartari » Thu Nov 13, 2008 11:43 pm

I got it! :D

I delete the ~./android/debug.keystore

And the eclipse show me this mensage that he can't generate the debug.keystore and sad to me execute:
Code: Select all
./keytool -genkey -alias AndroidDebugKey -keyalg RSA -dname "CN=Android Debug, O=Android, C=US" -validity 365 -keypass android -keystore /home/cassiano/.android/debug.keystore -storepass android


After this I got the debug.kestore and ran:
Code: Select all
./keytool -list -alias AndroidDebugKey -keystore ~/.android/debug.keystore -storepass android -keypass android


Everythink in the folder of java.

Than with the MD5 generated I got the apikey in the google site.

And finaly I add this permission:
Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1. <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
Parsed in 0.000 seconds, using GeSHi 1.0.8.4


And... And...

Shazam !
Attachments
device.png
I won!
device.png (24.27 KiB) Viewed 272 times
public class pessoa {
private String nome = "Cassiano Tartari";
private String url = "www.cassianotartari.eng.br"
}
User avatar
cassianotartari
Developer
Developer
 
Posts: 28
Joined: Thu Aug 28, 2008 3:42 pm

Top

Return to Map Problems

Who is online

Users browsing this forum: Yahoo [Bot] and 6 guests