1. Download our Official Android App: Forums for Android!

Apps Simple show mapp app issue

Discussion in 'Android Development' started by valy18, Aug 9, 2011.

  1. valy18

    valy18 Lurker
    Thread Starter
    Rank:
    None
    Points:
    5
    Posts:
    2
    Joined:
    Aug 9, 2011

    Aug 9, 2011
    2
    0
    5
    Hy guys!
    I am Android novice and I am trying to build a simple app that shows the map . I have an issue witch i cannot solve I checked and double everything . I have the Google api 10 installed and I am using the emulator for it .

    My code files are :

    AndroidManifest

    Code (Text):
    1.  
    2. <?xml version="1.0" encoding="utf-8"?>
    3. <manifest xmlns:android="http://schemas.android.com/apk/res/android"
    4.       package="local.Hello.Android"
    5.       android:versionCode="1"
    6.       android:versionName="1.0">
    7.      
    8.     <uses-sdk android:minSdkVersion="7" />
    9. <uses-permission android:name="android.permission.INTERNET"></uses-permission>
    10.     <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"></uses-permission>
    11.  
    12.  
    13.  
    14.         <application android:icon="@drawable/icon" android:label="@string/app_name">
    15.         <activity android:name=".HelloAndroidActivity"
    16.                   android:label="@string/app_name">
    17.             <intent-filter>
    18.                 <action android:name="android.intent.action.MAIN" />
    19.                 <category android:name="android.intent.category.LAUNCHER" />
    20.             </intent-filter>
    21.         </activity>
    22.  
    23.     </application>
    24. </manifest>

    The Layout main.xml

    Code (Text):
    1. <?xml version="1.0" encoding="utf-8"?>
    2. <RelativeLayout
    3.   xmlns:android="http://schemas.android.com/apk/res/android"
    4.   android:orientation="vertical"
    5.   android:layout_width="fill_parent"
    6.   android:layout_height="fill_parent">
    7.    <com.google.android.maps.MapView
    8.         android:id="@+id/mapView" android:layout_width="fill_parent"
    9.         android:layout_height="fill_parent" android:enabled="true"
    10.         android:clickable="true" android:apiKey="0C-yhfAeNcxQceQI6CFZVWlfmp1lWD7jHn-H7oQ" android:layout_alignParentRight="true">
    11.     </com.google.android.maps.MapView>
    12. </RelativeLayout>
    13. </manifest>

    And the Activity class
    Code (Text):
    1. package local.Hello.Android;
    2.  
    3. import android.app.Activity;
    4. import android.os.Bundle;
    5. import android.view.MotionEvent;
    6. import android.view.View;
    7. import android.widget.*;
    8. import android.app.Activity;
    9. import android.os.Bundle;
    10. import android.util.Log;
    11. import com.google.android.maps.MapActivity;
    12. import com.google.android.maps.MapView;;
    13.  
    14. public class HelloAndroidActivity extends MapActivity
    15. {
    16.    
    17.  
    18.     //user information
    19.     private String fullName = ""; //change it to "" after test //user full name
    20.     private long user_id = 0; //change it to 0 after test //user id
    21.     MapView map;
    22.     /** Called when the activity is first created. */
    23.     public void onCreate(Bundle savedInstanceState)
    24.     {
    25.        
    26.         //create
    27.         super.onCreate(savedInstanceState);
    28.         Log.w("start","oncreate start");
    29.         setContentView(R.layout.main);
    30.         Log.w("start","Homeview");
    31.         map = (MapView) findViewById(R.id.mapView);
    32.         //map.setBuiltInZoomControls(true);
    33.         map.setClickable(true);
    34.    
    35.     }
    36.     protected boolean isRouteDisplayed() {
    37.         // TODO Auto-generated method stub
    38.         return false;
    39.     }
    40. }
    The app shuts only shows the title bar and crashes in a couple of seconds .

    In the Log I get :
    unable to instantiate activity ComponentInfo{local.....} ClassNotFoundException in local.... in loader dalvik.system...

    Thanks for you're help !
     

    Advertisement

  2. JamTheMan

    JamTheMan Well-Known Member
    Rank:
    None
    Points:
    38
    Posts:
    136
    Joined:
    Dec 16, 2010

    Think we need to see more of that print...

    And there is a difference in having Android SDK 10 with Google API's installed and actually using them! Did you make sure that the project you are working on is set up so it uses an emulator that runs Android 10 + API's ? And that you actually have an emulator that runs with the API? - It will not automatically detect what you need and set it up in an emulator - it will instead start the emulator that best fits the minimum SDK requirement, Google API's or not.!

    Dobbel Check all this, and post mosre info if it still doesn't work!
     
  3. valy18

    valy18 Lurker
    Thread Starter
    Rank:
    None
    Points:
    5
    Posts:
    2
    Joined:
    Aug 9, 2011

    Aug 9, 2011
    2
    0
    5
    Problem Solved
    Needed to add this right after <application....> in AndroidManifest
    <uses-library android:name="com.google.android.maps" />
     

Share This Page

Loading...