I am trying to create a graph in android using achartengine library. After getting run of an emulator its just showing "sorry your app unexpectedly closed.try again.force close"
I have a doubt only on Manifest.xml file, is my manifest file wight?if not please make me clear.
Please find my sources,manifest.xml and logcat for reference
LOGCAT
08-22 11:47:05.763: D/AndroidRuntime(537): Shutting down VM
08-22 11:47:05.775: W/dalvikvm(537): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
08-22 11:47:05.783: E/AndroidRuntime(537): FATAL EXCEPTION: main
08-22 11:47:05.783: E/AndroidRuntime(537): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.graphs_test/com.example.graphs_test.MainActivity}: android.content.ActivityNotFoundException: Unable to find explicit activity class {com.example.graphs_test/org.achartengine.GraphicalActivity}; have you declared this activity in your AndroidManifest.xml?
08-22 11:47:05.783: E/AndroidRuntime(537): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
08-22 11:47:05.783: E/AndroidRuntime(537): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
08-22 11:47:05.783: E/AndroidRuntime(537): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
08-22 11:47:05.783: E/AndroidRuntime(537): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
08-22 11:47:05.783: E/AndroidRuntime(537): at android.os.Handler.dispatchMessage(Handler.java:99)
08-22 11:47:05.783: E/AndroidRuntime(537): at android.os.Looper.loop(Looper.java:123)
08-22 11:47:05.783: E/AndroidRuntime(537): at android.app.ActivityThread.main(ActivityThread.java:4627)
08-22 11:47:05.783: E/AndroidRuntime(537): at java.lang.reflect.Method.invokeNative(Native Method)
08-22 11:47:05.783: E/AndroidRuntime(537): at java.lang.reflect.Method.invoke(Method.java:521)
08-22 11:47:05.783: E/AndroidRuntime(537): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
08-22 11:47:05.783: E/AndroidRuntime(537): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
08-22 11:47:05.783: E/AndroidRuntime(537): at dalvik.system.NativeStart.main(Native Method)
08-22 11:47:05.783: E/AndroidRuntime(537): Caused by: android.content.ActivityNotFoundException: Unable to find explicit activity class {com.example.graphs_test/org.achartengine.GraphicalActivity}; have you declared this activity in your AndroidManifest.xml?
08-22 11:47:05.783: E/AndroidRuntime(537): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1404)
08-22 11:47:05.783: E/AndroidRuntime(537): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1378)
08-22 11:47:05.783: E/AndroidRuntime(537): at android.app.Activity.startActivityForResult(Activity.java:2817)
08-22 11:47:05.783: E/AndroidRuntime(537): at android.app.Activity.startActivity(Activity.java:2923)
08-22 11:47:05.783: E/AndroidRuntime(537): at com.example.graphs_test.MainActivity.onCreate(MainActivity.java:21)
08-22 11:47:05.783: E/AndroidRuntime(537): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
08-22 11:47:05.783: E/AndroidRuntime(537): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
08-22 11:47:05.783: E/AndroidRuntime(537): ... 11 more
Manifest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.graphs_test"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="15" />
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="@string/title_activity_main" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
MainActivity.java
public class MainActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Intent intent = buildIntent();
startActivity(intent);
}
public Intent buildIntent() {
int[] values = new int[] { 5, 15, 25, 50, 75 };
String[] bars = new String[] {"Francesca's", "King of Clubs",
"Zen Lounge", "Tied House", "Molly Magees"};
int[] colors = new int[] { Color.BLUE, Color.GREEN, Color.MAGENTA,
Color.YELLOW, Color.CYAN };
CategorySeries series = new CategorySeries("Pie Chart");
DefaultRenderer dr = new DefaultRenderer();
for (int v=0; v<5; v++){
series.add(bars[v], values[v]);
SimpleSeriesRenderer r = new SimpleSeriesRenderer();
r.setColor(colors[v]);
dr.addSeriesRenderer(r);
}
dr.setZoomButtonsVisible(true);
dr.setZoomEnabled(true);
dr.setChartTitleTextSize(20);
return ChartFactory.getPieChartIntent(
this, series, dr, "Pie of bars");
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.activity_main, menu);
return true;
}
}
Thanks for your precious time!..
org.achartengine.GraphicalActivity
wasn't found in your manifest because it is part of the library.Add the following line to your project.properties file to enable automatic merging of manifests.
Edit:
I thought achartengine was a library project. Turns out it's a JAR.
You need to add the activity to your manifest:
You need to add the activity to AndroidManifest.xml like this :