Search code examples
androideclipsegoogle-mapsgoogle-maps-api-2importerror

Google Map V2 Android, "error import com.google.android.gms.maps.model.LatLng"


I tried so hard to solve a problem.

I am using the Google Map V2 API and I followed all the steps from the google tutorial but there is a problem I don't understand :

  1. I imported the "google-play-services_lib" in my workspace
  2. I defined this project such as a "referencing library"
  3. I added this library to my main project

I took care to define the same version for both of them (Google API 5.0.1)

The check is now green but in my main Activity from my main project, Eclipse can't import any class from "com.google.android.gms.maps"

Is there someone who have a solution please ?

import android.os.Bundle;
import android.support.v4.app.FragmentActivity;

import com.example.moodwalk.R;


import com.google.android.gms.maps.model.LatLng;




public class GoogleResult extends FragmentActivity {

    static final LatLng HAMBURG = new LatLng(53.558, 9.927);
    static final LatLng KIEL = new LatLng(53.551, 9.993);
    private GoogleMap map;

      @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.login_accueil);


        }

}

Solution

  • Ok, I found my error. For them who have the same problem, check if you don't have a different path for your androi-support-v4 in your project and library project.

    I deleted the both jar and then added one in each libs project with the same path. It worked for me !