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
close icon

SfChart did not work when build app with Android SDK Build-Tools 26.0.2 or higher

I use Syncfusion Sfchart feature in my app.

When I build my app with Android SDK Build-Tools 25.0.3, Sfchart is work properly.

But it doesn't work when build app with Android SDK Build-Tools 26.0.2 or higher.

When I check log file about this error, log was writted with error about XML, Com.Syncfusion.Charts.ChartRootLayout.

This is log file about this problem.



------------------------------------


Java.Lang.RuntimeException: Binary XML file line #1: Binary XML file line #1: Error inflating class Com.Syncfusion.Charts.ChartRootLayout ---> Java.Lang.RuntimeException: Binary XML file line #1: Error inflating class Com.Syncfusion.Charts.ChartRootLayout ---> Java.Lang.ClassNotFoundException: Didn't find class "Com.Syncfusion.Charts.ChartRootLayout" on path: DexPathList[[zip file "/data/app/com.gfl.dic-CKDR8f1jId1mHU4T_6UTQA==/base.apk"],nativeLibraryDirectories=[/data/app/com.gfl.dic-CKDR8f1jId1mHU4T_6UTQA==/lib/arm, /data/app/com.gfl.dic-CKDR8f1jId1mHU4T_6UTQA==/base.apk!/lib/armeabi-v7a, /system/lib, /system/vendor/lib]]
   --- End of inner exception stack trace ---
   --- End of inner exception stack trace ---
  at Java.Interop.JniEnvironment+InstanceMethods.CallObjectMethod (Java.Interop.JniObjectReference instance, Java.Interop.JniMethodInfo method, Java.Interop.JniArgumentValue* args) [0x00069] in <990c6eebc341428e8373321ab221ccd7>:0
  at Java.Interop.JniPeerMembers+JniInstanceMethods.InvokeVirtualObjectMethod (System.String encodedMember, Java.Interop.IJavaPeerable self, Java.Interop.JniArgumentValue* parameters) [0x0002a] in <990c6eebc341428e8373321ab221ccd7>:0
  at Android.Views.LayoutInflater.Inflate (System.Int32 resource, Android.Views.ViewGroup root, System.Boolean attachToRoot) [0x0005a] in <1e0390f80d0d43c4bbc9623961eb9b15>:0
  at Com.Syncfusion.Charts.SfChart.BaseInitialize () [0x00038] in <a765272609314f0a864ff0c206da3414>:0
  at Com.Syncfusion.Charts.ChartBase.Initialize () [0x00000] in <a765272609314f0a864ff0c206da3414>:0
  at Com.Syncfusion.Charts.ChartBase..ctor (Android.Content.Context context) [0x0002b] in <a765272609314f0a864ff0c206da3414>:0
  at Com.Syncfusion.Charts.SfChart..ctor (Android.Content.Context context) [0x00020] in <a765272609314f0a864ff0c206da3414>:0
  at GFI_with_GFS_A.DollDBDetailActivity+<OnCreate>d__39.MoveNext () [0x005c5] in <6906e6b96ac547e2a43a029330542e44>:0
  --- End of managed Java.Lang.RuntimeException stack trace ---
android.view.InflateException: Binary XML file line #1: Binary XML file line #1: Error inflating class Com.Syncfusion.Charts.ChartRootLayout
Caused by: android.view.InflateException: Binary XML file line #1: Error inflating class Com.Syncfusion.Charts.ChartRootLayout
Caused by: java.lang.ClassNotFoundException: Didn't find class "Com.Syncfusion.Charts.ChartRootLayout" on path: DexPathList[[zip file "/data/app/com.gfl.dic-CKDR8f1jId1mHU4T_6UTQA==/base.apk"],nativeLibraryDirectories=[/data/app/com.gfl.dic-CKDR8f1jId1mHU4T_6UTQA==/lib/arm, /data/app/com.gfl.dic-CKDR8f1jId1mHU4T_6UTQA==/base.apk!/lib/armeabi-v7a, /system/lib, /system/vendor/lib]]
 at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:125)
 at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
 at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
 at android.view.LayoutInflater.createView(LayoutInflater.java:606)
 at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:790)
 at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730)
 at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
 at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
 at mono.java.lang.RunnableImplementor.n_run(Native Method)
 at mono.java.lang.RunnableImplementor.run(RunnableImplementor.java:30)
 at android.os.Handler.handleCallback(Handler.java:790)
 at android.os.Handler.dispatchMessage(Handler.java:99)
 at android.os.Looper.loop(Looper.java:175)
 at android.app.ActivityThread.main(ActivityThread.java:6724)
 at java.lang.reflect.Method.invoke(Native Method)
 at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
 at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:810)


13 Replies

BK Bharathiraja K Syncfusion Team April 3, 2019 12:14 PM UTC

Hi, 
 
Greetings form Syncfusion,  
 
We have prepared a sample to replicate the issue, but we are afraid, that we are not able to reproduce the issue.  
 
We suspect that this issue might cause due to caching problem or referring more than one NuGet packages in your application for Chart such as Syncfusion.Xamarin.SfChartNuGet and Syncfusion.Xamarin.SfChart.Android NuGet packages.   
  
So, we suggest you uninstall all the NuGet packages related Chart control from your application and clear cache, bin, obj folder and open application again and reinstall the Nuget as you see in the below UG link.  
  
 
If you face any issues, please revert back to us by modifying the below sample based on your application scenario.  
 
 
Regards, 
Bharathi. 



MI Michal April 4, 2019 11:53 AM UTC

Hi, 

i have similar problem, not only related to chart but other syncfusion views like datagrid etc.

Android.Views.InflateException: Binary XML file line #1: Binary XML file line #1: Error inflating class Com.Syncfusion.Charts.ChartRootLayout

Xamarin.Forms 3.6, VS2019, sf17

I found that problem appears only when "Use incremental Android packaging system (aapt2)" build configuration is enabled. Changing Linking settings doesn't change result. Aapt2 must be disabled to app work properly. Is there way to get it working or this is a bug?




UR URK April 4, 2019 03:08 PM UTC

Oh, it works. This problem is caused by aapt2....i got it.

Thanks for solution of this problem :)


BK Bharathiraja K Syncfusion Team April 4, 2019 05:46 PM UTC

Hi, 
 
We are glad that the reported problem resolved at your end. Please let us know if you have any other queries. 
 
Regards, 
Bharathi. 



MI Michal April 4, 2019 05:52 PM UTC

Hi,
it is not resolved. Disabling aapt2 is only workaround. Aapt2 allows for faster project rebuilds when an Android Resource or Android Asset changes. 
Could you please investigate if it is problem with syncfusion or xamarin/android ?
Thanks


MS Manojkiran Sudhakar Syncfusion Team April 10, 2019 01:30 PM UTC

Hi, 
Currently we are investigating this. We need more time to analyze AAPT2. We will update you the status on or before April 12, 2019. We appreciate your patience until then. 
Regards, 
Manoj S 



MS Mohamed Samsudeen K S Syncfusion Team April 12, 2019 03:58 PM UTC

Hi,

 

Currently there is a framework issue in inflating the classes when aapt2 is enabled. We will report this to the Xamarin team.

 

As of now, you can overcome this issue by setting aapt2 to false like below.

 

<AndroidUseAapt2>False</AndroidUseAapt2>

 

Regards,

Samsudeen



MB Marco Bellini May 22, 2019 09:11 AM UTC

Same here, please let us know when the error is fixed


BK Bharathiraja K Syncfusion Team May 28, 2019 05:25 AM UTC

Hi Marco, 
 
Since the reported issue reproduced in normal Xamarin.Android sample itself, it is framework level issue and not related to Syncfusion Chart. So, we have logged bug report for this in GitHub. Please find the bug report below here. 
 
 
Regards, 
Bharathi. 



SM Steven Marcus July 12, 2020 04:54 AM UTC

I get the same issue. I have aapt2 turned off and have already updated the target framework to Android 9.0

Android.Views.InflateException: 'Binary XML file line #1: Binary XML file line #1: Error inflating class androidx.appcompat.widget.Toolbar'


SS Sridevi Sivakumar Syncfusion Team July 13, 2020 12:25 PM UTC

Hi  Steven Marcus, 
 
We have found the similar issue update with using of SfListView. Can you please share the used syncfusion controls to address this further and provide a possible solution.  Better to reopen the GitHub issue link again to have a requested solution.  
 
Regards, 
Sridevi S. 



TR Terje Reinertsen December 10, 2020 04:56 AM UTC

Same Error inflating class Com.Syncfusion.Charts.ChartRootLayout occurs to me with latest packages. The problem that you need create constructor 

public ChartRootLayout(IntPtr javaReference, JniHandleOwnership transfer) : base(javaReference, transfer)
{
}

in class Com.Syncfusion.Charts.ChartRootLayout to fix it.


YP Yuvaraj Palanisamy Syncfusion Team December 11, 2020 03:12 PM UTC

Hi Terje Reinertsen, 
 
Still you are facing this issue then, please share us with issue reproducing sample to ensure sine we ensured this which has been worked fine at our end. Based on the reproducing case, we can check with this provided suggestion and let you know. 
 
Regards, 
Yuvaraj. 


Loader.
Live Chat Icon For mobile
Up arrow icon