2012-04-15 71 views
10

我只是試圖用achartengine演示,但我每次點擊的東西顯示在圖表上會出現一個錯誤,說「AChartengine意外停止的應用程序,請重試」。有人知道告訴我,我該怎麼辦?我跟着http://www.achartengine.org/content/goodies.html此頁面上提示的說明,我用API 7級仿真器的標準我有這些錯誤:應用程序AChartengine意外停止。請重試

04-15 09:08:43.285: E/dalvikvm(333): Could not find class '[Lorg.achartengine.chart.PointStyle;', referenced from method org.achartengine.chartdemo.demo.chart.AverageTemperatureChart.execute 
    04-15 09:08:43.325: E/dalvikvm(333): Could not find class 'org.achartengine.model.XYSeries', referenced from method org.achartengine.chartdemo.demo.chart.AbstractDemoChart.addXYSeries 
    04-15 09:08:43.345: E/dalvikvm(333): Could not find class 'org.achartengine.model.XYMultipleSeriesDataset', referenced from method org.achartengine.chartdemo.demo.chart.AbstractDemoChart.buildBarDataset 
    04-15 09:08:43.387: E/dalvikvm(333): Could not find class 'org.achartengine.renderer.XYMultipleSeriesRenderer', referenced from method org.achartengine.chartdemo.demo.chart.AbstractDemoChart.buildBarRenderer 
    04-15 09:08:43.395: E/dalvikvm(333): Could not find class 'org.achartengine.model.CategorySeries', referenced from method org.achartengine.chartdemo.demo.chart.AbstractDemoChart.buildCategoryDataset 
    04-15 09:08:43.425: E/dalvikvm(333): Could not find class 'org.achartengine.renderer.DefaultRenderer', referenced from method org.achartengine.chartdemo.demo.chart.AbstractDemoChart.buildCategoryRenderer 
    04-15 09:08:43.425: E/dalvikvm(333): Could not find class 'org.achartengine.model.XYMultipleSeriesDataset', referenced from method org.achartengine.chartdemo.demo.chart.AbstractDemoChart.buildDataset 
    04-15 09:08:43.445: E/dalvikvm(333): Could not find class 'org.achartengine.model.XYMultipleSeriesDataset', referenced from method org.achartengine.chartdemo.demo.chart.AbstractDemoChart.buildDateDataset 
    04-15 09:08:43.445: E/dalvikvm(333): Could not find class 'org.achartengine.model.MultipleCategorySeries', referenced from method org.achartengine.chartdemo.demo.chart.AbstractDemoChart.buildMultipleCategoryDataset 
    04-15 09:08:43.485: E/dalvikvm(333): Could not find class 'org.achartengine.renderer.XYMultipleSeriesRenderer', referenced from method org.achartengine.chartdemo.demo.chart.AbstractDemoChart.buildRenderer 
    04-15 09:08:43.525: E/dalvikvm(333): Could not find class '[Lorg.achartengine.chart.PointStyle;', referenced from method org.achartengine.chartdemo.demo.chart.AverageCubicTemperatureChart.execute 
    04-15 09:08:43.545: E/dalvikvm(333): Could not find class '[Lorg.achartengine.chart.PointStyle;', referenced from method org.achartengine.chartdemo.demo.chart.TrigonometricFunctionsChart.execute 
    04-15 09:08:43.555: E/dalvikvm(333): Could not find class '[Lorg.achartengine.chart.PointStyle;', referenced from method org.achartengine.chartdemo.demo.chart.ScatterChart.execute 
    04-15 09:08:43.555: E/dalvikvm(333): Could not find class '[Lorg.achartengine.chart.PointStyle;', referenced from method org.achartengine.chartdemo.demo.chart.SalesComparisonChart.execute 
    04-15 09:08:43.565: E/dalvikvm(333): Could not find class '[Lorg.achartengine.chart.PointStyle;', referenced from method org.achartengine.chartdemo.demo.chart.ProjectStatusChart.execute 
    04-15 09:08:43.576: E/dalvikvm(333): Could not find class '[Lorg.achartengine.chart.PointStyle;', referenced from method org.achartengine.chartdemo.demo.chart.SalesGrowthChart.execute 
    04-15 09:08:43.595: E/dalvikvm(333): Could not find class 'org.achartengine.model.XYMultipleSeriesDataset', referenced from method org.achartengine.chartdemo.demo.chart.ProjectStatusBubbleChart.execute 
    04-15 09:08:43.606: E/dalvikvm(333): Could not find class 'org.achartengine.model.XYMultipleSeriesDataset', referenced from method org.achartengine.chartdemo.demo.chart.TemperatureChart.execute 
    04-15 09:08:43.606: E/dalvikvm(333): Could not find class 'org.achartengine.model.CategorySeries', referenced from method org.achartengine.chartdemo.demo.chart.WeightDialChart.execute 
    04-15 09:08:43.615: E/dalvikvm(333): Could not find class '[Lorg.achartengine.chart.PointStyle;', referenced from method org.achartengine.chartdemo.demo.chart.SensorValuesChart.execute 
    04-15 09:08:43.615: E/dalvikvm(333): Could not find class '[Lorg.achartengine.chart.PointStyle;', referenced from method org.achartengine.chartdemo.demo.chart.CombinedTemperatureChart.execute 
    04-15 09:08:43.626: E/dalvikvm(333): Could not find class '[Lorg.achartengine.chart.PointStyle;', referenced from method org.achartengine.chartdemo.demo.chart.MultipleTemperatureChart.execute 
    04-15 09:13:51.145: E/AndroidRuntime(333): Uncaught handler: thread main exiting due to uncaught exception 
    04-15 09:13:51.155: E/AndroidRuntime(333): java.lang.NoClassDefFoundError: [Lorg.achartengine.chart.PointStyle; 
    04-15 09:13:51.155: E/AndroidRuntime(333): at org.achartengine.chartdemo.demo.chart.AverageTemperatureChart.execute(AverageTemperatureChart.java:72) 
    04-15 09:13:51.155: E/AndroidRuntime(333): at org.achartengine.chartdemo.demo.ChartDemo.onListItemClick(ChartDemo.java:102) 
    04-15 09:13:51.155: E/AndroidRuntime(333): at android.app.ListActivity$2.onItemClick(ListActivity.java:312) 
    04-15 09:13:51.155: E/AndroidRuntime(333): at android.widget.AdapterView.performItemClick(AdapterView.java:284) 
    04-15 09:13:51.155: E/AndroidRuntime(333): at android.widget.ListView.performItemClick(ListView.java:3285) 
    04-15 09:13:51.155: E/AndroidRuntime(333): at android.widget.AbsListView$PerformClick.run(AbsListView.java:1640) 
    04-15 09:13:51.155: E/AndroidRuntime(333): at android.os.Handler.handleCallback(Handler.java:587) 
    04-15 09:13:51.155: E/AndroidRuntime(333): at android.os.Handler.dispatchMessage(Handler.java:92) 
    04-15 09:13:51.155: E/AndroidRuntime(333): at android.os.Looper.loop(Looper.java:123) 
    04-15 09:13:51.155: E/AndroidRuntime(333): at android.app.ActivityThread.main(ActivityThread.java:4363) 
    04-15 09:13:51.155: E/AndroidRuntime(333): at java.lang.reflect.Method.invokeNative(Native Method) 
    04-15 09:13:51.155: E/AndroidRuntime(333): at java.lang.reflect.Method.invoke(Method.java:521) 
    04-15 09:13:51.155: E/AndroidRuntime(333): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860) 
    04-15 09:13:51.155: E/AndroidRuntime(333): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618) 
    04-15 09:13:51.155: E/AndroidRuntime(333): at dalvik.system.NativeStart.main(Native Method) 
    04-15 09:13:51.175: E/dalvikvm(333): Unable to open stack trace file '/data/anr/traces.txt': Permission denied 
+0

是這個完整的日誌貓,或者我認爲從logcat錯誤日誌中遺漏了一些東西 – 2012-04-15 09:12:37

+0

你是對的,整個日誌是我剛剛重新發布的日誌。 – Shilaghae 2012-04-15 09:15:12

+0

你可以告訴你如何使用它,你寫的,並已在你libs文件夾添加achartengine jar文件的一些代碼。 – 2012-04-15 09:18:15

回答

41

爲解決這一看到這個: http://groups.google.com/group/achartengine/browse_thread/thread/4cb1efddad3c19d0/2b59e5164e05c469#2b59e5164e05c469

報價:

在Eclipse: - >右鍵單擊您的項目 - 去構建路徑 - 選擇配置構建路徑 - >進入「排序和導出」選項卡 - >檢查「achartengine-1.0.0的.jar框,然後只需點擊一下,它的名字 - >動它,以便其Android的依賴關係右下(有時這 可以有所作爲,如果你有多個JAR)

單擊確定,然後清理項目。 (項目 - >清除...)

嘗試再次運行一下,看看有沒有什麼幫助。

+0

謝謝,我剛剛使用了你的報價並修復了這個問題 - 爲了簡潔起見,積分獎勵:) – fuzzyanalysis 2012-12-26 03:06:51

+1

+1。 **從線程:**,如果它在'lib'的目錄下,將其重命名爲'libs'或其他任何東西,然後重新添加構建路徑。 – 2012-12-27 15:14:26

+1

我將它移到了src下面的頂部。工作..謝謝 – Supun 2014-09-10 04:29:44

1

,如果你想知道如何achartengine工作那麼achartengine 0.7.0 jar添加到庫文件夾並將其與您的項目鏈接也有以下活動。

public class GeneratedChartDemo extends ListActivity { 
    private static final int SERIES_NR = 2; 

    private String[] mMenuText; 

    /** Called when the activity is first created. */ 
    @Override 
    public void onCreate(Bundle savedInstanceState) { 
    super.onCreate(savedInstanceState); 
    // I know, I know, this should go into strings.xml and accessed using 
    // getString(R.string....) 
    mMenuText = new String[] { "Line chart", "Scatter chart", "Time chart", "Bar chart" }; 
    setListAdapter(new SimpleAdapter(this, getListValues(), android.R.layout.simple_list_item_1, 
     new String[] { "name"}, new int[] { android.R.id.text1 })); 
    } 

    private List<Map<String, String>> getListValues() { 
    List<Map<String, String>> values = new ArrayList<Map<String, String>>(); 
    int length = mMenuText.length; 
    for (int i = 0; i < length; i++) { 
     Map<String, String> v = new HashMap<String, String>(); 
     v.put("name", mMenuText[i]); 
     values.add(v); 
    } 
    return values; 
    } 

    private XYMultipleSeriesDataset getDemoDataset() { 
    XYMultipleSeriesDataset dataset = new XYMultipleSeriesDataset(); 
    final int nr = 10; 
    Random r = new Random(); 
    for (int i = 0; i < SERIES_NR; i++) { 
     XYSeries series = new XYSeries("Demo series " + (i + 1)); 
     for (int k = 0; k < nr; k++) { 
     series.add(k, 20 + r.nextInt() % 100); 
     } 
     dataset.addSeries(series); 
    } 
    return dataset; 
    } 

    private XYMultipleSeriesDataset getDateDemoDataset() { 
    XYMultipleSeriesDataset dataset = new XYMultipleSeriesDataset(); 
    final int nr = 10; 
    long value = new Date().getTime() - 3 * TimeChart.DAY; 
    Random r = new Random(); 
    for (int i = 0; i < SERIES_NR; i++) { 
     TimeSeries series = new TimeSeries("Demo series " + (i + 1)); 
     for (int k = 0; k < nr; k++) { 
     series.add(new Date(value + k * TimeChart.DAY/4), 20 + r.nextInt() % 100); 
     } 
     dataset.addSeries(series); 
    } 
    return dataset; 
    } 

    private XYMultipleSeriesDataset getBarDemoDataset() { 
    XYMultipleSeriesDataset dataset = new XYMultipleSeriesDataset(); 
    final int nr = 10; 
    Random r = new Random(); 
    for (int i = 0; i < SERIES_NR; i++) { 
     CategorySeries series = new CategorySeries("Demo series " + (i + 1)); 
     for (int k = 0; k < nr; k++) { 
     series.add(100 + r.nextInt() % 100); 
     } 
     dataset.addSeries(series.toXYSeries()); 
    } 
    return dataset; 
    } 

    private XYMultipleSeriesRenderer getDemoRenderer() { 
    XYMultipleSeriesRenderer renderer = new XYMultipleSeriesRenderer(); 
    renderer.setAxisTitleTextSize(16); 
    renderer.setChartTitleTextSize(20); 
    renderer.setLabelsTextSize(15); 
    renderer.setLegendTextSize(15); 
    renderer.setPointSize(5f);  
    renderer.setMargins(new int[] {20, 30, 15, 0}); 
    XYSeriesRenderer r = new XYSeriesRenderer(); 
    r.setColor(Color.BLUE); 
    r.setPointStyle(PointStyle.SQUARE); 
    r.setFillBelowLine(true); 
    r.setFillBelowLineColor(Color.WHITE); 
    r.setFillPoints(true); 
    renderer.addSeriesRenderer(r); 
    r = new XYSeriesRenderer(); 
    r.setPointStyle(PointStyle.CIRCLE); 
    r.setColor(Color.GREEN); 
    r.setFillPoints(true); 
    renderer.setXLabels(0); 
    renderer.addXTextLabel(1, "aga"); 
    renderer.addXTextLabel(2, "agar"); 
    renderer.addSeriesRenderer(r); 
    renderer.setAxesColor(Color.DKGRAY); 
    renderer.setLabelsColor(Color.LTGRAY); 
    return renderer; 
    } 

    public XYMultipleSeriesRenderer getBarDemoRenderer() { 
    XYMultipleSeriesRenderer renderer = new XYMultipleSeriesRenderer(); 
    renderer.setAxisTitleTextSize(16); 
    renderer.setChartTitleTextSize(20); 
    renderer.setLabelsTextSize(15); 
    renderer.setLegendTextSize(15); 
    renderer.setMargins(new int[] {20, 30, 15, 0}); 
    SimpleSeriesRenderer r = new SimpleSeriesRenderer(); 
    r.setColor(Color.BLUE); 
    renderer.addSeriesRenderer(r); 
    r = new SimpleSeriesRenderer(); 
    r.setColor(Color.GREEN); 
    renderer.addSeriesRenderer(r); 
    return renderer; 
    } 

    private void setChartSettings(XYMultipleSeriesRenderer renderer) { 
    renderer.setChartTitle("Chart demo"); 
    renderer.setXTitle("x values"); 
    renderer.setYTitle("y values"); 
    renderer.setXAxisMin(0); 
    renderer.setXAxisMax(5); 
    renderer.setYAxisMin(0); 
    renderer.setYAxisMax(250); 
    } 

    @Override 
    protected void onListItemClick(ListView l, View v, int position, long id) { 
    super.onListItemClick(l, v, position, id); 
    switch (position) { 
    case 0: 
     Intent intent = ChartFactory.getLineChartIntent(this, getDemoDataset(), getDemoRenderer()); 
     startActivity(intent); 
     break; 
    case 1: 
     intent = ChartFactory.getScatterChartIntent(this, getDemoDataset(), getDemoRenderer()); 
     startActivity(intent); 
     break; 
    case 2: 
     intent = ChartFactory.getTimeChartIntent(this, getDateDemoDataset(), getDemoRenderer(), null); 
     startActivity(intent); 
     break; 
    case 3: 
     XYMultipleSeriesRenderer renderer = getBarDemoRenderer(); 
     setChartSettings(renderer); 
     intent = ChartFactory.getBarChartIntent(this, getBarDemoDataset(), renderer, Type.DEFAULT); 
     startActivity(intent); 
     break; 
    } 
    } 
} 
相關問題