1

I recevied error like cannot be resolved to a type. I'm a beginner at java and i'm attempting to develop an android application. I put a commend sign at the place where i received the cannot be resolved to a type error.

       package com.example.majorproject;

       import com.vogella.android.locationapi.maps.R;

       import android.os.Bundle;
       import android.app.Activity;
       import android.view.Menu;

       public class MajorProject extends Activity {
   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.activity_main);
    //map = ((MapFragment) getFragmentManager().findFragmentById(R.id.map))
        .getMap();

    if (//map!==null){
      //Marker hamburg = map.addMarker(new //MarkerOptions().position(//HAMBURG)
          .title("Hamburg"));
      //Marker kiel = map.addMarker(new MarkerOptions()
          .position(//KIEL)
          .title("Kiel")
          .snippet("Kiel is cool")
          .icon(//BitmapDescriptorFactory
              .fromResource(R.drawable.ic_launcher)));
    }

  } 
Emil Adz
  • 40,709
  • 36
  • 140
  • 187
Bryan
  • 8,488
  • 14
  • 52
  • 78

2 Answers2

7

If you are getting error on the MapFragment and Marker, then you have some problem with the way you are referencing the google-play-services library. Take a look at this blog post I wrote, the 3 first steps will explain to you how to do it properly:

Google Maps API V2

Emil Adz
  • 40,709
  • 36
  • 140
  • 187
1

if you are having problem while referencing google-play-service in eclipse, then place the Google play service lib and your project in same workspace. It works.... and don't forget to add support library.

RQube
  • 954
  • 3
  • 13
  • 28
  • This is vague. Can you provide details of how to include Google Play Service lib? I assume there is a download or update required. – mobibob Jan 03 '14 at 22:26
  • 1
    @mobibob I just wanted to bring in notice that you need to copy the the library in same workspace while importing the lib for proper work. you can find the details here http://stackoverflow.com/questions/14371725/add-google-play-services-to-eclipse-project on how to setup. :) – RQube Feb 06 '14 at 12:23