"Error inflating class com.androidplot.xy.XYPlot" 当我尝试膨胀我的图形片段时

"Error inflating class com.androidplot.xy.XYPlot" when I try to inflate my graph Fragment

当我调试 android 应用程序并尝试打开图形片段时,我的应用程序崩溃了。我将 "androidplot-core-1.5.7.aar" 库放在我的 "libs" 项目文件夹中,并在我的 "build.gradle" 依赖项中实现它。

"androidplot-core-1.2.1.aar" 库没有这个问题。

这里是图表片段xml代码:

<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:ap="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <com.androidplot.xy.XYPlot
        android:id="@+id/imuPlot"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        style="@style/APDefacto.Light"/>

</LinearLayout>

这是当我想显示图形片段并调试崩溃时显示的内容:

--------- beginning of crash
E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.poc2.irisa.plugandpos.poc2, PID: 5048
    android.view.InflateException: Binary XML file line #8: Binary XML file line #8: Error inflating class com.androidplot.xy.XYPlot
    Caused by: android.view.InflateException: Binary XML file line #8: Error inflating class com.androidplot.xy.XYPlot
    Caused by: java.lang.reflect.InvocationTargetException
        at java.lang.reflect.Constructor.newInstance0(Native Method)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:430)
        at android.view.LayoutInflater.createView(LayoutInflater.java:645)
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:787)
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:727)
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:858)
        at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:518)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:426)
        at com.poc2.irisa.plugandpos.poc2.o.a(:52)
        at android.support.v4.app.m.b(:2346)
        at android.support.v4.app.z.a(:1428)
        at android.support.v4.app.z.h(:1759)
        at android.support.v4.app.z.a(:1827)
        at android.support.v4.app.d.c(:797)
        at android.support.v4.app.z.a(:2596)
        at android.support.v4.app.z.b(:2383)
        at android.support.v4.app.z.c(:2338)
        at android.support.v4.app.z.p(:2245)
        at android.support.v4.app.t.run(:703)
        at android.os.Handler.handleCallback(Handler.java:751)
        at android.os.Handler.dispatchMessage(Handler.java:95)
        at android.os.Looper.loop(Looper.java:154)
        at android.app.ActivityThread.main(ActivityThread.java:6120)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
     Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/halfhp/fig/Fig;
        at com.androidplot.Plot.a(:561)
        at com.androidplot.Plot.a(:403)
        at com.androidplot.Plot.<init>(:324)
        at com.androidplot.xy.XYPlot.<init>(:143)
        at java.lang.reflect.Constructor.newInstance0(Native Method) 
        at java.lang.reflect.Constructor.newInstance(Constructor.java:430) 
        at android.view.LayoutInflater.createView(LayoutInflater.java:645) 
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:787) 
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:727) 
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:858) 
        at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821) 
        at android.view.LayoutInflater.inflate(LayoutInflater.java:518) 
        at android.view.LayoutInflater.inflate(LayoutInflater.java:426) 
        at com.poc2.irisa.plugandpos.poc2.o.a(:52) 
        at android.support.v4.app.m.b(:2346) 
        at android.support.v4.app.z.a(:1428) 
        at android.support.v4.app.z.h(:1759) 
        at android.support.v4.app.z.a(:1827) 
        at android.support.v4.app.d.c(:797) 
        at android.support.v4.app.z.a(:2596) 
        at android.support.v4.app.z.b(:2383) 
        at android.support.v4.app.z.c(:2338) 
        at android.support.v4.app.z.p(:2245) 
        at android.support.v4.app.t.run(:703) 
        at android.os.Handler.handleCallback(Handler.java:751) 
        at android.os.Handler.dispatchMessage(Handler.java:95) 
        at android.os.Looper.loop(Looper.java:154) 
        at android.app.ActivityThread.main(ActivityThread.java:6120) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755) 
     Caused by: java.lang.ClassNotFoundException: Didn't find class "com.halfhp.fig.Fig" on path: DexPathList[[zip file "/data/app/com.poc2.irisa.plugandpos.poc2-1/base.apk"],nativeLibraryDirectories=[/data/app/com.poc2.irisa.plugandpos.poc2-1/lib/arm, /system/lib, /vendor/lib]]
        at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:380)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
        at com.androidplot.Plot.a(:561) 
        at com.androidplot.Plot.a(:403) 
        at com.androidplot.Plot.<init>(:324) 
        at com.androidplot.xy.XYPlot.<init>(:143) 
        at java.lang.reflect.Constructor.newInstance0(Native Method) 
        at java.lang.reflect.Constructor.newInstance(Constructor.java:430) 
        at android.view.LayoutInflater.createView(LayoutInflater.java:645) 
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:787) 
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:727) 
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:858) 
        at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821) 
        at android.view.LayoutInflater.inflate(LayoutInflater.java:518) 
        at android.view.LayoutInflater.inflate(LayoutInflater.java:426) 
        at com.poc2.irisa.plugandpos.poc2.o.a(:52) 
        at android.support.v4.app.m.b(:2346) 
        at android.support.v4.app.z.a(:1428) 
        at android.support.v4.app.z.h(:1759) 
        at android.support.v4.app.z.a(:1827) 
        at android.support.v4.app.d.c(:797) 
        at android.support.v4.app.z.a(:2596) 
        at android.support.v4.app.z.b(:2383) 
        at android.support.v4.app.z.c(:2338) 
        at android.support.v4.app.z.p(:2245) 
        at android.support.v4.app.t.run(:703) 
        at android.os.Handler.handleCallback(Handler.java:751) 
        at android.os.Handler.dispatchMessage(Handler.java:95) 
        at android.os.Looper.loop(Looper.java:154) 
        at android.app.ActivityThread.main(ActivityThread.java:6120) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755) 
Disconnected from the target VM, address: 'localhost:8600', transport: 'socket'

提前致谢。

此致,

马洛

发现问题有相同问题后自己回答。

我必须将以下内容添加到我的 "build.gradle" 依赖项中。

implementation "com.halfhp.fig:figlib:1.0.7"