Skip to content Skip to sidebar Skip to footer

Fatal Exception: Main Java.lang.runtimeexception: Unable To Start Activity Componentinfo

I am working on Map view using android API v2, I am following this tutorial, I have followed what he explained in tutorial, but still I am getting Fatal exception. here is my xml c

Solution 1:

You are trying to import existing project into library. You should be importing the library using following method.

  1. Right click package explorer. Import -> Expand Android -> Existing Android Code Into Workspace.
  2. Select the google-play-services library. And check the copy to workspace checkbox.

Once this is done. Reference the library project

Right click on the project. Select Android in the left pane. In the right pane bottom you would see a frame with label Library. Click on add and add the imported library.

To add support library to your project: Right click on the project Androids Tools -> Add Support library.

If you decide to use support libraries you will have to replace the code

<fragment
        android:id="@+id/map"
        android:layout_width="match_parent"
        android:layout_height="match_parent"class="com.google.android.gms.maps.MapFragment" />

with

<fragment
        android:id="@+id/map"
        android:layout_width="match_parent"
        android:layout_height="match_parent"class="com.google.android.gms.maps.SupportMapFragment" />

also in your java file you will have to use SupportMapFragment.

mMap = ((SupportMapFragment) getSupportFragmentManager()
                    .findFragmentById(R.id.map)).getMap();

Solution 2:

Solution 3:

Are you using the correct API (GOOGLE API) in Eclipse? Make sure to use the GOOGLE APIs if you want to use google maps in android!

Solution 4:

You are probably having an import problem. Just check in right click on project -> properties -> Java build path you have imported the libs. See this link for clarity

Solution 5:

This error is usually derived from incorrect referencing of google-play-services library.

To do it correctly please follow the first 3 steps of this blog post guide I wrote on integrating Google Maps API V2 in your application:

Google Maps API V2

Post a Comment for "Fatal Exception: Main Java.lang.runtimeexception: Unable To Start Activity Componentinfo"