Issue in achartengine jar file

2020-03-26 08:14发布

Actually i have created an app in which i have used achartengine to contruct graph. It was running ok, but today i saw an update for android SDK to r17.

Once i upadated the sdk the app i had build started crash. In the logcat i show the following error report. Why this happen, is it because the jar file i have used is deprecated.

03-27 14:44:26.320: E/AndroidRuntime(4360): java.lang.NoClassDefFoundError: [Lorg.achartengine.chart.PointStyle;
03-27 14:44:26.320: E/AndroidRuntime(4360):     at   in.com.example.ChartEngineActivity.onCreate(ChartEngineActivity.java:58)
03-27 14:44:26.320: E/AndroidRuntime(4360):     at  android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
03-27 14:44:26.320: E/AndroidRuntime(4360):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
03-27 14:44:26.320: E/AndroidRuntime(4360):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
03-27 14:44:26.320: E/AndroidRuntime(4360):     at android.app.ActivityThread.access$1500(ActivityThread.java:117)
03-27 14:44:26.320: E/AndroidRuntime(4360):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
03-27 14:44:26.320: E/AndroidRuntime(4360):     at android.os.Handler.dispatchMessage(Handler.java:99)
03-27 14:44:26.320: E/AndroidRuntime(4360):     at android.os.Looper.loop(Looper.java:130)
03-27 14:44:26.320: E/AndroidRuntime(4360):     at android.app.ActivityThread.main(ActivityThread.java:3683)
03-27 14:44:26.320: E/AndroidRuntime(4360):     at java.lang.reflect.Method.invokeNative(Native Method)
03-27 14:44:26.320: E/AndroidRuntime(4360):     at java.lang.reflect.Method.invoke(Method.java:507)
03-27 14:44:26.320: E/AndroidRuntime(4360):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
03-27 14:44:26.320: E/AndroidRuntime(4360):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
03-27 14:44:26.320: E/AndroidRuntime(4360):     at dalvik.system.NativeStart.main(Native Method)

3条回答
爱情/是我丢掉的垃圾
2楼-- · 2020-03-26 08:23

In ADT version 18: - Right click on project and go to "Build Path" -> "Configure Build Path". In tab "Order and Export" simply select all, but deselect only android.jar. Click OK and your project is ready to go.

查看更多
甜甜的少女心
3楼-- · 2020-03-26 08:25

I just had a similar issue with ADT version 20 in Eclipse.

Why the error?

The demo project source and project are meant to be used with an earlier version of the ADT plugin.

Starting in either ADT 19 or 20, ADT began automatically setting up all of the JAR files that you place in the libs/ folder (note libs/, not lib/) as "Android Dependencies", rather than "Reference Libraries" (which you get when you right-click on a jar file and "Add to build path...".

Because of this change, the project file included with the AChartEngine sample project is outdated.

To use the sample code with ADT 20, take the following steps:

  1. Download and unzip the achartengine-1.0.0-demo-source.zip from the AChartEngine website. (Which is back up after suffering a catastrophic server breakdown, so kudos to them)
  2. Delete the .project and .classpath from the achartengine-1.0.0-demo
  3. In Eclipse, go to File>New...>Project...>Android Project from Existing Code
  4. Select "Browse..", and navigate to the directory that you unzipped the demo code to.
  5. Select "Copy project into workspace" (not strictly necessary, but the easiest)
  6. Select Finish.

Now, plug in your device, boot up your emulator, and run it!

Also, if you select the green "Run" button on the toolbar, and it throws an error similar to "Could not find a previous configuration" (something like that, though the wording was more cryptic),

  1. Click on the project in the package explorer
  2. Click the black down arrow next to the "Run" button
  3. Mouse over to "Run as", and select "Android Application"

Enjoy the charts!

查看更多
Emotional °昔
4楼-- · 2020-03-26 08:39

Here is your solution, just follow the steps from How to fix the “NoClassDefFoundError” with ADT 17 and you will be able to make it working.

查看更多
登录 后发表回答