androidandroid-layoutandroid-fragmentsgoogle-maps-android-api-2supportmapfragment

Google Maps : Fragment and Layout inflator error


I get the following error stating that the class definition was not found. I do not understand this error and do not even know how this error is generating. I'm sharing my layout and activity here

Map Activity:

public class Maps extends FragmentActivity {
private GoogleMap myMap;
LocationManager lm;
LocationListener locationListener;
Location mLoc;
int code;
boolean zoomb = true;
ArrayList<String> ambulances = new ArrayList<String>();
boolean directioncheck = false;


ListView listview;
ArrayList<String> itemlist = new ArrayList<String>();
ArrayAdapter<String> adapter;
ArrayList<Marker> markerlist;

Direction direction = new Direction();
ArrayList<LatLng> pline = new ArrayList<LatLng>();
LatLng currentmarker;
Integer cid;

String provider = "";

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


    /*
     * Check if any of the radios (Mobile Data or Wi-Fi) are on. 
     */
    final WifiManager wifiManager = (WifiManager) this.getSystemService(Context.WIFI_SERVICE);
    TelephonyManager telephonyManager = (TelephonyManager) this.getSystemService(Context.TELEPHONY_SERVICE);
    LocationManager manager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
    if(telephonyManager.getDataState() == 0 && wifiManager.isWifiEnabled() == false && manager.isProviderEnabled(LocationManager.GPS_PROVIDER) == false) {
        AlertDialog.Builder ad = new AlertDialog.Builder(Maps.this);
        ad.setTitle("First-Responder");
        ad.setMessage("Your network and gps providers are off. Please enable one of them.");
        ad.setPositiveButton("Network", new DialogInterface.OnClickListener() {

            @Override
            public void onClick(DialogInterface dialog, int which) {
                // TODO Auto-generated method stub
                AlertDialog.Builder network = new AlertDialog.Builder(Maps.this);
                network.setTitle("First-Responder");
                network.setMessage("Please choose between Wi-Fi and Mobile Data");
                network.setPositiveButton("Wi-Fi", new DialogInterface.OnClickListener() {

                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        // TODO Auto-generated method stub
                        Intent intent = new Intent(android.provider.Settings.ACTION_WIFI_SETTINGS);
                        startActivity(intent);
                        provider = "network";
                    }
                });
                network.setNegativeButton("Mobile Data", new DialogInterface.OnClickListener() {

                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        // TODO Auto-generated method stub
                        Intent intent = new Intent (android.provider.Settings.ACTION_DATA_ROAMING_SETTINGS);
                        startActivity(intent);
                        provider = "network";
                    }
                });
                network.show();
            }
        });
        ad.setNegativeButton("GPS", new DialogInterface.OnClickListener() {

            @Override
            public void onClick(DialogInterface dialog, int which) {
                // TODO Auto-generated method stub
                Intent intent = new Intent(android.provider.Settings.ACTION_LOCATION_SOURCE_SETTINGS);
                startActivity(intent);
                provider = "gps";
            }
        });
        ad.show();
    }

    if(telephonyManager.getDataState() == TelephonyManager.DATA_CONNECTED) {
        provider = "network";
    } else if (wifiManager.isWifiEnabled()) {
        provider = "network";
    } else if (manager.isProviderEnabled(LocationManager.GPS_PROVIDER)) {
        provider = "gps";
    }

    listview = (ListView)findViewById(R.id.listView);
    adapter = new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1,itemlist);
    listview.setAdapter(adapter);
    markerlist = new ArrayList<Marker>();

    FragmentManager myFragmentManager = getSupportFragmentManager();
    SupportMapFragment mySupportMapFragment = (SupportMapFragment) myFragmentManager.findFragmentById(R.id.map);
    myMap = mySupportMapFragment.getMap();
    myMap.setMyLocationEnabled(true);
    myMap.setMapType(GoogleMap.MAP_TYPE_NORMAL);
    lm = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
    locationListener = new MyLocationListener();
    Intent intent = getIntent();
    code = intent.getIntExtra("key", 0);

    if (provider != null) {
        mLoc = lm.getLastKnownLocation(provider);
    }

    if (mLoc != null) {
        query(mLoc);
    }

    listview.setOnItemClickListener(new OnItemClickListener(){
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position,
                long id) {
            //Toast.makeText(getApplicationContext(), Integer.toString(markerlist.size()), Toast.LENGTH_LONG).show();
            LatLng point = markerlist.get(position).getPosition();
            CameraUpdate center = CameraUpdateFactory.newLatLng(point);
            myMap.animateCamera(center, 2000, null);
        }
    });
    myMap.setOnInfoWindowClickListener(new OnInfoWindowClickListener() {
        @Override
        public void onInfoWindowClick(final Marker marker) {
            // TODO Auto-generated method stub
            AlertDialog.Builder ad = new AlertDialog.Builder(Maps.this);
            ad.setTitle("First-Responder");
            ad.setMessage("Would you like directions?");
            ad.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
                @Override
                public void onClick( DialogInterface dialog, int arg1) {
                    myMap.clear();
                    query(mLoc);
                    currentmarker = marker.getPosition();
                    LatLng pt = marker.getPosition();
                    direction.getmapsinfo(myMap, pt, mLoc, itemlist, adapter);
                    listview.setClickable(false);
                }
            });
            ad.setNegativeButton("No", new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    // TODO Auto-generated method stub
                    //ok, do nothing
                    dialog.cancel();
                }
            });
            ad.show();
        }
    });
}


public void query(Location loc) {
    switch (code) {
    case 1:
        new GetHospitals()
                .execute("https://maps.googleapis.com/maps/api/place/nearbysearch/json?location="
                        + Double.toString(mLoc.getLatitude())
                        + ","
                        + Double.toString(mLoc.getLongitude())
                        + "&rankby=distance&types=hospital&sensor=false&key=AIzaSyAPrOxAoTKUdaXtktg4B2QrdPZO5SpM0VQ");
        break;
    case 2:
        new GetHospitals()
                .execute("https://maps.googleapis.com/maps/api/place/nearbysearch/json?location="
                        + Double.toString(mLoc.getLatitude())
                        + ","
                        + Double.toString(mLoc.getLongitude())
                        + "&rankby=distance&types=police&sensor=false&key=AIzaSyAPrOxAoTKUdaXtktg4B2QrdPZO5SpM0VQ");
        break;
    case 3:
        new GetHospitals()
                .execute("https://maps.googleapis.com/maps/api/place/nearbysearch/json?location="
                        + Double.toString(mLoc.getLatitude())
                        + ","
                        + Double.toString(mLoc.getLongitude())
                        + "&rankby=distance&types=fire_station&sensor=false&key=AIzaSyAPrOxAoTKUdaXtktg4B2QrdPZO5SpM0VQ");
        break;
    case 4:
        Database db = new Database(Maps.this);
        LatLng point = new LatLng(mLoc.getLatitude(), mLoc.getLongitude());
        ambulances = db.sort(point);
        placemarkers(ambulances);
        db.close();
        break;
    }
}


/**
 * Assigns a number according to distance the nearest ambulance.
 * @param ambulances
 */
private void placemarkers(ArrayList<String> ambulances){
    Bitmap myWrittenBitmap;     
    for(int i = 0; i < ambulances.size(); i++){
        String item = ambulances.get(i);
        Marker m;
        myWrittenBitmap = customImage(i+1, R.drawable.ambulance_launcher);

        String[] values = item.split(",");
        String name = values[0];
        String number = values[1];
        String itemlat = values[2];
        String itemlong = values[3];

        LatLng point = new LatLng(Double.parseDouble(itemlat), Double.parseDouble(itemlong));
        m = myMap.addMarker(new MarkerOptions().position(point).title(name).snippet(number).icon(BitmapDescriptorFactory.fromBitmap(myWrittenBitmap)));
        markerlist.add(m);
        if(!directioncheck){
            itemlist.add(Integer.toString(i+1)+"  "+ name);
            adapter.notifyDataSetChanged();
        }
    }
    LatLng point = new LatLng(mLoc.getLatitude(), mLoc.getLongitude());
    CameraUpdate center = CameraUpdateFactory.newLatLng(point);
    CameraUpdate zoom = CameraUpdateFactory.zoomTo(12);
    myMap.moveCamera(center);
    myMap.animateCamera(zoom);
}



// adding custom images to markers.
private Bitmap customImage(int index, int resource ){
    Bitmap bm;
    Bitmap myWrittenBitmap;
    Canvas canvas;
    Paint txtPaint;

    bm = BitmapFactory.decodeResource(getResources(), resource);
    myWrittenBitmap = Bitmap.createBitmap(bm.getWidth(), bm.getHeight(), Bitmap.Config.ARGB_4444);
    // create a Canvas on which to draw and a Paint to write text.
    canvas = new Canvas(myWrittenBitmap);
    txtPaint = new Paint();
    txtPaint.setColor(Color.RED);
    txtPaint.setTextSize(12);
    txtPaint.setFlags(Paint.ANTI_ALIAS_FLAG);
    txtPaint.setTypeface(Typeface.DEFAULT_BOLD);
    //draw ref bitmap then text on our canvas
    canvas.drawBitmap(bm, 0, 0, null);
    canvas.drawText(Integer.toString(index), 10,10 , txtPaint);
    return myWrittenBitmap;

}

private class MyLocationListener implements LocationListener {

    @Override
    public void onLocationChanged(Location loc) {
        if (loc != null) {
            mLoc = new Location(loc);
            //query(mLoc);
        }
    }

    @Override
    public void onProviderDisabled(String provider) {
        Context context = Maps.this;
        AlertDialog.Builder ad = new AlertDialog.Builder(context);
        ad.setTitle("Warning!");
        ad.setMessage("Provider: " + provider + " disabled");
        if(provider.equals("network")) {
            String button1String = "Enable network";
            ad.setPositiveButton(button1String, new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int arg1) {
                    Intent intent = new Intent(android.provider.Settings.ACTION_LOCATION_SOURCE_SETTINGS);
                    startActivity(intent);
                }
            });
        }
        ad.show();
    }

    @Override
    public void onProviderEnabled(String provider) {
    }

    @Override
    public void onStatusChanged(String provider, int status, Bundle extras) {
    }
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    getMenuInflater().inflate(R.menu.maps, menu);
    return true;
}

public String readConnectionString(String URL) {
    StringBuilder stringBuilder = new StringBuilder();
    HttpClient httpClient = new DefaultHttpClient();
    HttpGet httpGet = new HttpGet(URL);
    try {
        HttpResponse response = httpClient.execute(httpGet);
        StatusLine statusLine = response.getStatusLine();
        int statusCode = statusLine.getStatusCode();
        if (statusCode == 200) {
            HttpEntity entity = response.getEntity();
            InputStream inputStream = entity.getContent();
            BufferedReader reader = new BufferedReader(
                    new InputStreamReader(inputStream));
            String line;
            while ((line = reader.readLine()) != null) {
                stringBuilder.append(line);
            }
            inputStream.close();
        } else {
            Log.d("ConnectionString", "Failed to connect");
        }
    } catch (Exception e) {
        Log.d("ConnectionString", e.getLocalizedMessage());
    }
    return stringBuilder.toString();
}

private class GetHospitals extends AsyncTask<String, Void, String> {
    protected String doInBackground(String... urls) {
        return readConnectionString(urls[0]);
    }

    protected void onPostExecute(String JSONString) {
        try {
            JSONObject jsonObject = new JSONObject(JSONString);
            JSONArray EmergencyItems = new JSONArray(
                    jsonObject.getString("results"));
            for (int i = 0; i < EmergencyItems.length(); i++) {
                JSONObject EmergencyItem = EmergencyItems.getJSONObject(i);
                Double lat = Double.parseDouble(EmergencyItem
                        .getJSONObject("geometry")
                        .getJSONObject("location").getString("lat"));
                Double lng = Double.parseDouble(EmergencyItem
                        .getJSONObject("geometry")
                        .getJSONObject("location").getString("lng"));
                LatLng point = new LatLng(lat,lng);
                Bitmap myWrittenBitmap;
                Marker m;
                switch (code) {
                case 1:
                    myWrittenBitmap = customImage(i+1, R.drawable.hsp_launcher);
                     m = myMap.addMarker(new MarkerOptions().position(point).title(EmergencyItem.getString("name")).snippet(EmergencyItem.getString("vicinity")).icon(BitmapDescriptorFactory.fromBitmap(myWrittenBitmap)));
                    if(directioncheck == false){
                        itemlist.add(Integer.toString(i+1)+"  "+ EmergencyItem.getString("name"));
                        adapter.notifyDataSetChanged();
                    }
                    markerlist.add(m);
                    break;
                case 2:
                    myWrittenBitmap = customImage(i+1, R.drawable.pol_launcher);
                    m = myMap.addMarker(new MarkerOptions().position(point).title(EmergencyItem.getString("name")).snippet(EmergencyItem.getString("vicinity")).icon(BitmapDescriptorFactory.fromBitmap(myWrittenBitmap)));
                    if(directioncheck == false){
                        itemlist.add(Integer.toString(i+1)+"  "+ EmergencyItem.getString("name"));
                        adapter.notifyDataSetChanged();
                    }
                    markerlist.add(m);
                    break;
                case 3:                     
                    myWrittenBitmap = customImage(i+1, R.drawable.fire_launcher);
                    m = myMap.addMarker(new MarkerOptions().position(point).title(EmergencyItem.getString("name")).snippet(EmergencyItem.getString("vicinity")).icon(BitmapDescriptorFactory.fromBitmap(myWrittenBitmap)));
                    if(directioncheck == false){
                        itemlist.add(Integer.toString(i+1)+"  "+ EmergencyItem.getString("name"));
                        adapter.notifyDataSetChanged();
                    }
                    markerlist.add(m);
                    break;
                }
            }
            if(zoomb) {
                LatLng point = new LatLng(mLoc.getLatitude(), mLoc.getLongitude());
                CameraUpdate center = CameraUpdateFactory.newLatLng(point);
                CameraUpdate zoom = CameraUpdateFactory.zoomTo(12);
                myMap.moveCamera(center);
                myMap.animateCamera(zoom);
                zoomb=false;
            }
        } catch (Exception e) {
            Log.d("EmergencyItem", e.getLocalizedMessage());
        }
    }
}

/** used upon resuming the application. 
 *
 */
@Override
public void onResume(){
    super.onResume();

    lm.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, locationListener);

    Log.v(null, "Maps's onResume Method !!!");      
}
/**
 * Android onPause method. Clears any stored location in location manager.
 */
@Override
public void onPause(){
    super.onPause();
    lm.removeUpdates(locationListener);
    zoomb = true;
    Log.v(null, "Maps's onPause Method !!!");
}


@Override
protected void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    if(direction.getDirections() != null){
        Log.v("!NullDirection", "!NULL");
        outState.putStringArrayList("DIRECTIONS", direction.getDirections());
        Preferences.writeLatLng(this, Preferences.MLAT, currentmarker);
    } else {
        Log.v("NullDirection", "NULL");
    }
}

/**
 * 
 */
@Override
protected void onRestoreInstanceState(Bundle inputState){
    Log.v("INRESTORE", "onRestoreInstanceState");
    if(inputState != null){
        if(inputState.containsKey("DIRECTIONS")){
            itemlist.clear();
            //adapter.clear();
            adapter = new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1,itemlist);
            ArrayList<String> tempitemlist = inputState.getStringArrayList("DIRECTIONS");
            Log.v("FIRST DIRECTION", Integer.toString(itemlist.size()));
            for(int i = 0; i < tempitemlist.size(); i++){
                itemlist.add(tempitemlist.get(i));
                adapter.notifyDataSetChanged();
            }
            directioncheck = true;
        }
        if(Preferences.readMarker(this, Preferences.MLAT) != null){
            LatLng pts = Preferences.readMarker(this, Preferences.MLAT);
            currentmarker = pts;
            direction.getmapsinfo(myMap, pts, mLoc, itemlist, adapter);
        }
    }
}
}

Layout:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/fare_check_frame"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >

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

<ListView
    android:id="@+id/listView"
    android:layout_width="match_parent"
    android:layout_height="wrap_content" >
</ListView>

LOgcat:

04-26 17:31:48.426: W/ActivityThread(338): Application emergency.contact is waiting for the debugger on port 8100...
04-26 17:31:48.445: I/System.out(338): Sending WAIT chunk
04-26 17:31:48.465: I/dalvikvm(338): Debugger is active
04-26 17:31:48.645: I/System.out(338): Debugger has connected
04-26 17:31:48.645: I/System.out(338): waiting for debugger to settle...
04-26 17:31:48.845: I/System.out(338): waiting for debugger to settle...
04-26 17:31:49.045: I/System.out(338): waiting for debugger to settle...
04-26 17:31:49.245: I/System.out(338): waiting for debugger to settle...
04-26 17:31:49.455: I/System.out(338): waiting for debugger to settle...
04-26 17:31:49.655: I/System.out(338): waiting for debugger to settle...
04-26 17:31:49.855: I/System.out(338): waiting for debugger to settle...
04-26 17:31:50.055: I/System.out(338): waiting for debugger to settle...
04-26 17:31:50.261: I/System.out(338): waiting for debugger to settle...
04-26 17:31:50.462: I/System.out(338): waiting for debugger to settle...
04-26 17:31:50.664: I/System.out(338): waiting for debugger to settle...
04-26 17:31:50.865: I/System.out(338): debugger has settled (1490)
04-26 17:31:51.655: V/(338): MainActivity's onResume Method !!!
04-26 17:31:56.235: V/(338): MainActivity's onPause Method !!!
04-26 17:31:59.945: W/dalvikvm(338): VFY: unable to resolve static field 863 (MapAttrs) in Lcom/google/android/gms/R$styleable;
04-26 17:31:59.945: D/dalvikvm(338): VFY: replacing opcode 0x62 at 0x000e
04-26 17:31:59.955: D/dalvikvm(338): VFY: dead code 0x0010-00ae in Lcom/google/android/gms/maps/GoogleMapOptions;.createFromAttributes (Landroid/content/Context;Landroid/util/AttributeSet;)Lcom/google/android/gms/maps/GoogleMapOptions;
04-26 17:32:32.257: D/AndroidRuntime(338): Shutting down VM
04-26 17:32:32.257: W/dalvikvm(338): threadid=1: thread exiting with uncaught exception (group=0x40015560)
04-26 17:32:32.355: E/AndroidRuntime(338): FATAL EXCEPTION: main
04-26 17:32:32.355: E/AndroidRuntime(338): java.lang.NoClassDefFoundError: com.google.android.gms.R$styleable
04-26 17:32:32.355: E/AndroidRuntime(338):  at com.google.android.gms.maps.GoogleMapOptions.createFromAttributes(Unknown Source)
04-26 17:32:32.355: E/AndroidRuntime(338):  at com.google.android.gms.maps.SupportMapFragment.onInflate(Unknown Source)
04-26 17:32:32.355: E/AndroidRuntime(338):  at android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:279)
04-26 17:32:32.355: E/AndroidRuntime(338):  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:563)
04-26 17:32:32.355: E/AndroidRuntime(338):  at android.view.LayoutInflater.rInflate(LayoutInflater.java:623)
04-26 17:32:32.355: E/AndroidRuntime(338):  at android.view.LayoutInflater.inflate(LayoutInflater.java:408)
04-26 17:32:32.355: E/AndroidRuntime(338):  at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
04-26 17:32:32.355: E/AndroidRuntime(338):  at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
04-26 17:32:32.355: E/AndroidRuntime(338):  at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:207)
04-26 17:32:32.355: E/AndroidRuntime(338):  at android.app.Activity.setContentView(Activity.java:1657)
04-26 17:32:32.355: E/AndroidRuntime(338):  at emergency.contact.Maps.onCreate(Maps.java:84)
04-26 17:32:32.355: E/AndroidRuntime(338):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
04-26 17:32:32.355: E/AndroidRuntime(338):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
04-26 17:32:32.355: E/AndroidRuntime(338):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
04-26 17:32:32.355: E/AndroidRuntime(338):  at android.app.ActivityThread.access$1500(ActivityThread.java:117)
04-26 17:32:32.355: E/AndroidRuntime(338):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
04-26 17:32:32.355: E/AndroidRuntime(338):  at android.os.Handler.dispatchMessage(Handler.java:99)
04-26 17:32:32.355: E/AndroidRuntime(338):  at android.os.Looper.loop(Looper.java:123)
04-26 17:32:32.355: E/AndroidRuntime(338):  at android.app.ActivityThread.main(ActivityThread.java:3683)
04-26 17:32:32.355: E/AndroidRuntime(338):  at java.lang.reflect.Method.invokeNative(Native Method)
04-26 17:32:32.355: E/AndroidRuntime(338):  at java.lang.reflect.Method.invoke(Method.java:507)
04-26 17:32:32.355: E/AndroidRuntime(338):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
04-26 17:32:32.355: E/AndroidRuntime(338):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
04-26 17:32:32.355: E/AndroidRuntime(338):  at dalvik.system.NativeStart.main(Native Method)
04-26 17:33:21.955: I/Process(338): Sending signal. PID: 338 SIG: 9
04-26 17:34:35.256: W/ActivityThread(367): Application emergency.contact is waiting for the debugger on port 8100...
04-26 17:34:35.265: I/System.out(367): Sending WAIT chunk
04-26 17:34:35.285: I/dalvikvm(367): Debugger is active
04-26 17:34:35.475: I/System.out(367): Debugger has connected
04-26 17:34:35.475: I/System.out(367): waiting for debugger to settle...
04-26 17:34:35.675: I/System.out(367): waiting for debugger to settle...
04-26 17:34:35.875: I/System.out(367): waiting for debugger to settle...
04-26 17:34:36.075: I/System.out(367): waiting for debugger to settle...
04-26 17:34:36.285: I/System.out(367): waiting for debugger to settle...
04-26 17:34:36.496: I/System.out(367): waiting for debugger to settle...
04-26 17:34:36.705: I/System.out(367): waiting for debugger to settle...
04-26 17:34:36.905: I/System.out(367): waiting for debugger to settle...
04-26 17:34:37.105: I/System.out(367): waiting for debugger to settle...
04-26 17:34:37.305: I/System.out(367): debugger has settled (1496)
04-26 17:34:38.215: V/(367): MainActivity's onResume Method !!!
04-26 17:34:41.395: V/(367): MainActivity's onPause Method !!!
04-26 17:34:41.546: W/dalvikvm(367): VFY: unable to resolve static field 863 (MapAttrs) in Lcom/google/android/gms/R$styleable;
04-26 17:34:41.546: D/dalvikvm(367): VFY: replacing opcode 0x62 at 0x000e
04-26 17:34:41.546: D/dalvikvm(367): VFY: dead code 0x0010-00ae in Lcom/google/android/gms/maps/GoogleMapOptions;.createFromAttributes (Landroid/content/Context;Landroid/util/AttributeSet;)Lcom/google/android/gms/maps/GoogleMapOptions;
04-26 17:34:53.168: D/AndroidRuntime(367): Shutting down VM
04-26 17:34:53.168: W/dalvikvm(367): threadid=1: thread exiting with uncaught exception (group=0x40015560)
04-26 17:34:53.265: E/AndroidRuntime(367): FATAL EXCEPTION: main
04-26 17:34:53.265: E/AndroidRuntime(367): java.lang.NoClassDefFoundError: com.google.android.gms.R$styleable
04-26 17:34:53.265: E/AndroidRuntime(367):  at com.google.android.gms.maps.GoogleMapOptions.createFromAttributes(Unknown Source)
04-26 17:34:53.265: E/AndroidRuntime(367):  at com.google.android.gms.maps.SupportMapFragment.onInflate(Unknown Source)
04-26 17:34:53.265: E/AndroidRuntime(367):  at android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:279)
04-26 17:34:53.265: E/AndroidRuntime(367):  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:563)
04-26 17:34:53.265: E/AndroidRuntime(367):  at android.view.LayoutInflater.rInflate(LayoutInflater.java:623)
04-26 17:34:53.265: E/AndroidRuntime(367):  at android.view.LayoutInflater.inflate(LayoutInflater.java:408)
04-26 17:34:53.265: E/AndroidRuntime(367):  at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
04-26 17:34:53.265: E/AndroidRuntime(367):  at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
04-26 17:34:53.265: E/AndroidRuntime(367):  at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:207)
04-26 17:34:53.265: E/AndroidRuntime(367):  at android.app.Activity.setContentView(Activity.java:1657)
04-26 17:34:53.265: E/AndroidRuntime(367):  at emergency.contact.Maps.onCreate(Maps.java:84)
04-26 17:34:53.265: E/AndroidRuntime(367):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
04-26 17:34:53.265: E/AndroidRuntime(367):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
04-26 17:34:53.265: E/AndroidRuntime(367):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
04-26 17:34:53.265: E/AndroidRuntime(367):  at android.app.ActivityThread.access$1500(ActivityThread.java:117)
04-26 17:34:53.265: E/AndroidRuntime(367):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
04-26 17:34:53.265: E/AndroidRuntime(367):  at android.os.Handler.dispatchMessage(Handler.java:99)
04-26 17:34:53.265: E/AndroidRuntime(367):  at android.os.Looper.loop(Looper.java:123)
04-26 17:34:53.265: E/AndroidRuntime(367):  at android.app.ActivityThread.main(ActivityThread.java:3683)
04-26 17:34:53.265: E/AndroidRuntime(367):  at java.lang.reflect.Method.invokeNative(Native Method)
04-26 17:34:53.265: E/AndroidRuntime(367):  at java.lang.reflect.Method.invoke(Method.java:507)
04-26 17:34:53.265: E/AndroidRuntime(367):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
04-26 17:34:53.265: E/AndroidRuntime(367):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
04-26 17:34:53.265: E/AndroidRuntime(367):  at dalvik.system.NativeStart.main(Native Method)

EDIT: had to set the target Api to google api.


Solution

  • Did you import the google library correctly? It seems like it can't see its own resources.