-1
 Thread [<1> main] (Suspended (exception RuntimeException)) 
<VM does not provide monitor information>   
ActivityThread.performLaunchActivity(ActivityThread$ActivityClientRecord, Intent) line: 2180    
ActivityThread.handleLaunchActivity(ActivityThread$ActivityClientRecord, Intent) line: 2230 
ActivityThread.access$600(ActivityThread, ActivityThread$ActivityClientRecord, Intent) line: 141    
ActivityThread$H.handleMessage(Message) line: 1234  
ActivityThread$H(Handler).dispatchMessage(Message) line: 99 
Looper.loop() line: 137 
ActivityThread.main(String[]) line: 5041    
Method.invokeNative(Object, Object[], Class, Class[], Class, int, boolean) line: not available [native method]  
Method.invoke(Object, Object...) line: 511  
ZygoteInit$MethodAndArgsCaller.run() line: 793  
ZygoteInit.main(String[]) line: 560 
NativeStart.main(String[]) line: not available [native method]  

I have no idea why it can't even launch the activity.

This is the activity that is being launched

import android.app.Activity;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.view.Menu;
import android.view.View;
import android.widget.Toast;

import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.GooglePlayServicesUtil;
import com.google.android.gms.maps.CameraUpdate;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.MapFragment;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.MarkerOptions;

 public class GymFind extends FragmentActivity {

private final LatLng LOCATION_BURNABY = new LatLng(49.27645, -122.917587);
private final LatLng LOCATION_SURRREY = new LatLng(49.187500, -122.849000);
private GoogleMap map;

@Override
protected void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);
    setContentView(R.layout.gmaps);


      map  = ((MapFragment) getFragmentManager().findFragmentById(R.id.map)).getMap();

      map.addMarker(new MarkerOptions().position(LOCATION_BURNABY).title("Find us here!"));
      map.addMarker(new MarkerOptions().position(LOCATION_SURREY).title("Find us here!"));
      map.addMarker(new 

final int RQS_GooglePlayServices = 1;
@Override
 protected void onResume() {
  // TODO Auto-generated method stub
  super.onResume();

  int resultCode = GooglePlayServicesUtil.isGooglePlayServicesAvailable(getApplicationContext());

  if (resultCode == ConnectionResult.SUCCESS){
   Toast.makeText(getApplicationContext(), 
     "isGooglePlayServicesAvailable SUCCESS", 
     Toast.LENGTH_LONG).show();
  }else{
   GooglePlayServicesUtil.getErrorDialog(resultCode, this, RQS_GooglePlayServices);
  }

 }


@Override
public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.main, menu);
    return true;
}

 }

This is where the activity is being launched from

  import android.app.Activity;
  import android.os.Bundle;
  import android.widget.Button;
  import android.view.View;
  import android.view.View.OnClickListener;
  import android.content.Intent;


   public class Home extends Activity {

@Override
public void onCreate(Bundle savedInstanceState) {
     super.onCreate(savedInstanceState);

     setContentView(R.layout.homie);

     Button button1 = (Button) findViewById(R.id.button1);

     Button button2 = (Button) findViewById(R.id.button2);

     button1.setOnClickListener(new OnClickListener() {
         public void onClick(View v) {

             Intent i = new Intent(Home.this,GymFind.class);
             Home.this.startActivity(i);

         }
     });
     button2.setOnClickListener(new OnClickListener() {
         public void onClick(View v) {

             Intent i = new Intent(Home.this,EmailUs.class);
             Home.this.startActivity(i);


         }
     });
 }
   }

I highly doubt I will ever get this working but if you guys would like to help I'd be really happy.

1 Answers1

0

The stack trace should include a "Caused by" at the bottom... or if you're viewing this in a debugger, there should be a "cause" variable or something like that. I recommend just letting it crash and then checking the android log - it'll definitely print the "Caused by" under the stack trace in the log.

The problem is that Android is failing to launch your activity. The most common reasons are: 1. You haven't declared the activity in your AndroidManifest.xml 2. Your code in onCreate (or another overriden method) is throwing an exception Check your "Caused by" and you'll find the exact reason.

Todor K.
  • 653
  • 6
  • 12
  • Caused by: java.lang.ClassCastException: com.google.android.gms.maps.MapFragment cannot be cast to android.support.v4.app.Fragment what does this mean? – Ivan Razimov Jul 22 '13 at 22:27
  • Ah, this is because there are two versions of the Fragment class: one from the Android SDK (android.app.Fragment) and one from the Android Support Library (android.support.v4.app.Fragment). See http://developer.android.com/tools/extras/support-library.html#Using I guess the Maps SDK doesn't work with the support library? Or maybe there's a different version of that fragment that does? I've never used it, so I don't know. The ultimate reason is that you're using FragmentActivity, which expects its fragments to be the support-library version. – Todor K. Jul 22 '13 at 22:35
  • Thank you so much for your help so far but once I fixed that I get a nullpointer exception Caused by: java.lang.NullPointerException at GymFind.onCreate(GymFind.java:35) at android.app.Activity.performCreate(Activity.java:5104) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144) – Ivan Razimov Jul 22 '13 at 23:02