We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Error inflating class SfChart - Didn't find class

I'm trying to create a chart in Xamarin.Android using XAML. I created the namespace in the XAML file as shown:

<RelativeLayout xmlns:p1="http://schemas.android.com/apk/res/android"
       xmlns:syncfusion="clr-namespace:Syncfusion.SfChart.Android;assembly:Syncfusion.SfChart.Android"
    p1:orientation="vertical"
    p1:layout_width="match_parent" etc. etc.

and later in the XAML layout I created the chart as follows:

    <syncfusion:SfChart
        p1:id="@+id/applianceGraph"
        p1:layout_width="match_parent"
        p1:layout_height="match_parent"
        p1:layout_weight="1"
        p1:layout_below="@id/priorityBar"
        p1:layout_above="@id/APNavigationButtons" >
    </syncfusion:SfChart>

But I end up getting the following error at runtime:

Unable to start activity ComponentInfo{com.companyname.wattsapp_android/md5efa703fe96fd0fe248cc39ed8e34e902.AppliancePageActivity}: android.view.InflateException: Binary XML file line #1: Error inflating class SfChart

Caused by: java.lang.ClassNotFoundException: Didn't find class "android.view.SfChart" on path: DexPathList[[zip file "/data/app/com.companyname.wattsapp_android-2.apk"],nativeLibraryDirectories=[/data/app-lib/com.companyname.wattsapp_android-2, /vendor/lib, /system/lib]]


How do you get the program to look in the Syncfusion library? I've added the assembly reference Syncfusion.SfChart.Android.dll as described in the Getting Started page. Is there an additional step I've missed?

3 Replies

YP Yuvaraj Palanisamy Syncfusion Team August 14, 2015 07:15 AM UTC

Hi Cathryn,


Thanks for using Syncfusion products,


We request you to use the below code example to initialize the chart in xml layout.

 [XML]


<com.syncfusion.charts.SfChart


        p1:id="@+id/applianceGraph"

        p1:layout_width="match_parent"

        p1:layout_height="match_parent"

        p1:layout_weight="1"

        p1:layout_below="@id/priorityBar"

        p1:layout_above="@id/APNavigationButtons">


</com.syncfusion.charts.SfChart>      




Please let us know if you require further assistance, we are happy to assist you.


Thanks,
Yuvaraj



CM Cathryn McDonald August 16, 2015 07:22 AM UTC

Thanks! </com.syncfusion.charts.SfChart> didn't work, but I tried </com.syncfusion.widget.chart.SfChart> and that worked perfectly


YP Yuvaraj Palanisamy Syncfusion Team August 17, 2015 05:13 AM UTC

Hi Cathryn,

Thanks for the update.

Please let us know if you require further assistance on this.

Thanks,
Yuvaraj

Loader.
Up arrow icon