• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Simple show mapp app issue

valy18

Lurker
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:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="local.Hello.Android"
      android:versionCode="1"
      android:versionName="1.0">
      
    <uses-sdk android:minSdkVersion="7" />
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
	<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"></uses-permission>
  
 
 
     	<application android:icon="@drawable/icon" android:label="@string/app_name">
        <activity android:name=".HelloAndroidActivity"
                  android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

    </application>
</manifest>


The Layout main.xml

Code:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:orientation="vertical"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent">
   <com.google.android.maps.MapView
		android:id="@+id/mapView" android:layout_width="fill_parent"
		android:layout_height="fill_parent" android:enabled="true"
		android:clickable="true" android:apiKey="0C-yhfAeNcxQceQI6CFZVWlfmp1lWD7jHn-H7oQ" android:layout_alignParentRight="true">
	</com.google.android.maps.MapView>
</RelativeLayout>
</manifest>


And the Activity class
Code:
package local.Hello.Android;

import android.app.Activity;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.View;
import android.widget.*;
import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import com.google.android.maps.MapActivity;
import com.google.android.maps.MapView;;

public class HelloAndroidActivity extends MapActivity
{
	

	//user information
	private String fullName = ""; //change it to "" after test //user full name
	private long user_id = 0; //change it to 0 after test //user id
	MapView map;
    /** Called when the activity is first created. */
    public void onCreate(Bundle savedInstanceState)
    {
     	
        //create
        super.onCreate(savedInstanceState);
        Log.w("start","oncreate start");
        setContentView(R.layout.main);
        Log.w("start","Homeview");
        map = (MapView) findViewById(R.id.mapView);
		//map.setBuiltInZoomControls(true);
        map.setClickable(true);
    
    }
	protected boolean isRouteDisplayed() {
		// TODO Auto-generated method stub
		return false;
	}
}

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 !
 
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!
 
Problem Solved
Needed to add this right after <application....> in AndroidManifest
<uses-library android:name="com.google.android.maps" />
 
Back
Top Bottom