1

I have trouble getting my graph app to start on the Android emulator. "Unfortunately graph stopped" keeps on popping up. Can somebody help me fix this?

Here is the Java file:

package graphs.com.graphs;

import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;


public class MainActivityG extends ActionBarActivity {

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


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

    @Override
     public boolean onOptionsItemSelected(MenuItem item) {
        // Handle action bar item clicks here. The action bar will
        // automatically handle clicks on the Home/Up button, so long
        // as you specify a parent activity in AndroidManifest.xml.
        int id = item.getItemId();

        //noinspection SimplifiableIfStatement
        if (id == R.id.action_settings) {
            return true;
        }

        return super.onOptionsItemSelected(item);
    }
}

Here is my XML file:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/lib/graphs.com.graphs"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    android:paddingBottom="@dimen/activity_vertical_margin"
    tools:context=".MainActivityG">

    <com.jjoe64.graphview.helper.GraphViewXML
        android:layout_width="match_parent"
        android:layout_height="100dip"
        app:seriesData="0=5;2=5;3=0;4=2" />

</RelativeLayout>
alexwlchan
  • 5,699
  • 7
  • 38
  • 49
Job Collins
  • 138
  • 2
  • 11
  • In your project "properties" > "java build path" > "order and export", is the jar file for your library "ticked"? – ChinLoong May 04 '15 at 08:14
  • how do you get to that in Android Studio? – Job Collins May 05 '15 at 06:25
  • I took a look here http://stackoverflow.com/questions/16608135/android-studio-add-jar-as-library . Did you "Ensure that 'compile files('libs/gson-2.2.4.jar')' is in your build.gradle file". gson-2.2.4.jar should be replaced with your graphview library – ChinLoong May 05 '15 at 12:14
  • I have done that but still no change at all.The emulator still throws "Unfortunately graphs stopped" – Job Collins May 05 '15 at 12:32
  • can you see any exception/stack trace in logcat? you should see able to open DDMS and see. https://developer.android.com/tools/debugging/debugging-studio.html – ChinLoong May 05 '15 at 12:33

1 Answers1

0

did you try to replace

xmlns:app="http://schemas.android.com/apk/lib/graphs.com.graphs"

by

xmlns:app="http://schemas.android.com/apk/res-auto"

don't know if it will fix

  • I had it like that before but the program wouldn't run so I changed it to xmlns:app="http://schemas.android.com/apk/lib/graphs.com.graphs" – Job Collins May 05 '15 at 06:45