1. Are you ready for the Galaxy S20? Here is everything we know so far!

can not run location-based s/w

Discussion in 'Android Development' started by gracy, Sep 12, 2011.

  1. gracy

    gracy Newbie
    Thread Starter

    Hello all,

    I copied the map program that display a map from a book and tried to run .
    But the program just shows the title and forced to close the s/w.

    I just copy the program from the book. So there is no error in that.
    I have also changed the api key with my own key.
    the book instruct to set the SDK Target to Google APIs. So when I create the project, I choose Google APIs as the SDK target.
    But since there is no emulator for the Google APIs, I created a new one.
    I created that just choosing window->Android SDK and AVD Manager
    and chose new button
    and I gave name , then chose Target as Google API(Google Inc.)API level 3 from the pop up box.
    is that enough?

    But the program does not work. What is the problem?

    Thank you very much.

    1. Download the Forums for Android™ app!


  2. jonbonazza

    jonbonazza Android Expert

    What is "not working?" Is it displaying a blank grid? Is it force closing? What?
  3. gracy

    gracy Newbie
    Thread Starter

    sorry. I have found the error.
    I didn't add this line before.
    <uses-library android:name="com.google.android.maps" />
    in the AndroidMainfest.xml.

    So there is an error and I have to close the program.

    Now there is not error anymore.
    But the program does not display the map.
    It just show only the plain grid.
    Can be because of the api key?
    I used the old api key I have created one month ago.
    do I have to generate a new api key whenever I want to run the map program on the emulator?
    or do I need to change the setting of the emulator?
  4. gracy

    gracy Newbie
    Thread Starter

    Here is my AndroiodManifest.xml
    Code (Text):
    2. <uses-permission android:name="android.permission.INTERNET" />
    3.       <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    4.     <application android:icon="@drawable/icon" android:label="@string/app_name">
    5.      <uses-library android:name="com.google.android.maps" />
    7.         <activity android:name=".MapViewDemoActivity"
    8.                   android:label="@string/app_name">
    9.             <intent-filter>
    10.                 <action android:name="android.intent.action.MAIN" />
    11.                 <category android:name="android.intent.category.LAUNCHER" />
    12.             </intent-filter>
    13.         </activity>
    15.     </application>
    To generate the api key, I go under the bin of the jdk in the commnd prompt, and type this command
    keytool -list -alias androiddebugkey -keystore "C:\Users\student\.android\debug.keystore" -storepass android -keypass android

    then I get this key CF:70:3F:F6:A9:60:83:1E:5E:B7:0C:DC:82:CC:85:B1

    then I paste that certificate
  5. gracy

    gracy Newbie
    Thread Starter

    I am using android-sdk-windows-1.5_r3. I still have not fetched available packages from the Android sdk and ADK manager.
    Can that be a reason of now showing the map.

    I tried to fetch the avaialble package.
    But whenever I try, this message appear
    Failed to fetch URL https://dl-ssl.google.com/android/repository/repository.xml, reason: Connection timed out: connect

    How to do that? I have off the firewall and also tried with http. But it does not work.

    And why u all do not reply to me.
    If there is any problem with me ( for example, you don't understand my question ) please let me know.

Share This Page