简体   繁体   中英

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);


        }

}

确保您已在属性选项卡下将Google Play服务和google util库添加为项目的libs。

When you Select Android on the left selection which adding he library. See the above table and check the Android xx not Google API. Once you do you should add the Google Play Services Library and then run the project. It wont throw that error anymore.

看到这张照片

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 !

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM