Reputation: 2201
I am trying to get google maps to work in my android project. I have already got the md5 key and signed up with google to get the api key, but now when i am trying to display the map, I get an error when importing it. "com.google" has the sqiqly red line under it.
Can anyone help? Thanks
this is my xml file: (note: i replaced the key with 'my_key' since i didnt want to make it public)
<com.google.android.maps.MapView
android:id="my_map"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:enabled="true"
android:clickable="true"
android:apiKey="my_key"/>
and for the java file:
package com.escortme.basic;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import com.google.android.maps.MapActivity; // ERROR
import com.google.android.maps.MapView; // ERROR
import android.os.Bundle;
public class Police_ViewActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.pol_view);
}
public void quit_button_action(View view){
finish();
}
}
Upvotes: 2
Views: 14318
Reputation: 5789
It sounds like you don't have the Google APIs referenced by your project. Assuming you're using Eclipse, view the properties of your project and select Android and check that Google APIs is checked rather than simply an Android version.
You may need to download the Google APIs if you haven't already. You can do this through the Android SDK Manager.
Upvotes: 11