我需要在片段中使用AndroidPlot库,但它给了我一个错误。也许android 4.x中的片段不支持它?
也许有人知道最好用什么来绘制简单的图表?
09-13 16:54:19.098: E/AndroidRuntime(5114): FATAL EXCEPTION: main
09-13 16:54:19.098: E/AndroidRuntime(5114): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.plotfragment/com.example.plotfragment.MainActivity}: android.view.InflateException: Binary XML file line #14: Error inflating class com.androidplot.xy.XYPlot
09-13 16:54:19.098: E/AndroidRuntime(5114): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1955)
09-13 16:54:19.098: E/AndroidRuntime(5114): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1980)
09-13 16:54:19.098: E/AndroidRuntime(5114): at android.app.ActivityThread.access$600(ActivityThread.java:122)
09-13 16:54:19.098: E/AndroidRuntime(5114): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1146)
09-13 16:54:19.098: E/AndroidRuntime(5114): at android.os.Handler.dispatchMessage(Handler.java:99)
09-13 16:54:19.098: E/AndroidRuntime(5114): at android.os.Looper.loop(Looper.java:137)
09-13 16:54:19.098: E/AndroidRuntime(5114): at android.app.ActivityThread.main(ActivityThread.java:4340)
09-13 16:54:19.098: E/AndroidRuntime(5114): at java.lang.reflect.Method.invokeNative(Native Method)
09-13 16:54:19.098: E/AndroidRuntime(5114): at java.lang.reflect.Method.invoke(Method.java:511)
09-13 16:54:19.098: E/AndroidRuntime(5114): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
09-13 16:54:19.098: E/AndroidRuntime(5114): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
09-13 16:54:19.098: E/AndroidRuntime(5114): at dalvik.system.NativeStart.main(Native Method)
09-13 16:54:19.098: E/AndroidRuntime(5114): Caused by: android.view.InflateException: Binary XML file line #14: Error inflating class com.androidplot.xy.XYPlot
09-13 16:54:19.098: E/AndroidRuntime(5114): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:691)
09-13 16:54:19.098: E/AndroidRuntime(5114): at android.view.LayoutInflater.rInflate(LayoutInflater.java:739)
09-13 16:54:19.098: E/AndroidRuntime(5114): at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
09-13 16:54:19.098: E/AndroidRuntime(5114): at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
09-13 16:54:19.098: E/AndroidRuntime(5114): at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
09-13 16:54:19.098: E/AndroidRuntime(5114): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:251)
09-13 16:54:19.098: E/AndroidRuntime(5114): at android.app.Activity.setContentView(Activity.java:1835)
09-13 16:54:19.098: E/AndroidRuntime(5114): at com.example.plotfragment.MainActivity.onCreate(MainActivity.java:11)
09-13 16:54:19.098: E/AndroidRuntime(5114): at android.app.Activity.performCreate(Activity.java:4465)
09-13 16:54:19.098: E/AndroidRuntime(5114): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
09-13 16:54:19.098: E/AndroidRuntime(5114): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1919)
09-13 16:54:19.098: E/AndroidRuntime(5114): ... 11 more
09-13 16:54:19.098: E/AndroidRuntime(5114): Caused by: java.lang.ClassNotFoundException: com.androidplot.xy.XYPlot
09-13 16:54:19.098: E/AndroidRuntime(5114): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
09-13 16:54:19.098: E/AndroidRuntime(5114): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
09-13 16:54:19.098: E/AndroidRuntime(5114): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
09-13 16:54:19.098: E/AndroidRuntime(5114): at android.view.LayoutInflater.createView(LayoutInflater.java:552)
09-13 16:54:19.098: E/AndroidRuntime(5114): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:680)
答案 0 :(得分:-1)
Androidplot适用于支持Fragments(API 11+)的所有平台上的片段。鉴于上述错误,我的猜测是您可能没有将Androidplot核心库复制到libs目录中。