Runtime error after adding Chart-references

4 posts, 0 answers
  1. Sami
    Sami avatar
    2 posts
    Member since:
    Dec 2013

    Posted 13 Dec 2016 Link to this post

    I just started to implement charting but run into an issue only after adding the required references as guided on page: http://docs.telerik.com/devtools/xamarin/controls/chart/getting-started/chart-getting-started-required-assemblies

    When starting my application, OnCreate method in my MainActivity throws the following exception: Java.Lang.NullPointerException: Attempt to invoke virtual method 'void android.support.v7.widget.ContentFrameLayout.setId(int)' on a null object reference

    I got DataForm controls up and running, but Chart control throws, even without writing a single line of code, only adding the references break my app. If I remove the references it will start to work again.

    Any ideas what may be wrong?

  2. Vladislav
    Admin
    Vladislav avatar
    277 posts

    Posted 15 Dec 2016 Link to this post

    Hello Sami,

    Thank you for contacting us.
    The most probable reason for getting this error is incorrect (old) version of the Xamarin.Forms NuGet package used. The default project template for Xamarin project uses quite outdated version of this NuGet (2.2.0.45), while our controls target the latest available version (2.3.3.175). So updating Xamarin.Forms NuGet should fix the problem. Please note that you need to update ONLY Xamarin.Forms and NOT the other (Xamarin.Android.Support.xxx) NuGets.


    Also you may need to increase the "Java Max Heap Size" property for the Android project if you receive the "java.lang.OutOfMemoryError" during the build of the project.



    Regards,
    Vladislav
    Telerik by Progress
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. Sami
    Sami avatar
    2 posts
    Member since:
    Dec 2013

    Posted 16 Dec 2016 in reply to Vladislav Link to this post

    Thanks Vladislav,

    That indeed fixed the problem. I was following the guidance here: http://docs.telerik.com/devtools/xamarin/installation-and-deployment/required-android-support-libraries . So you may need to update that page?

  4. Lance | Tech Support Engineer, Sr.
    Admin
    Lance | Tech Support Engineer, Sr. avatar
    255 posts

    Posted 16 Dec 2016 Link to this post

    Hello Sami,

    Thank you for letting us know about the outdated documentation page. We will update it as soon as the next documentation push goes out.

    In case you encounter this again in the future, here's a trick I use to see exactly what each project requires by using our Visual Studio project creation wizard.

    The Wizard will automatically create, in just a few seconds, all the of target platform projects and adds all the required parts (i.e. required dependencies/references, namespace attributes for the renderers on all platforms, instantiates the renderers where needed (iOS) and finally all the individual TelerikForms.Init() calls)

    Here's all you have to do to get a working app on all the platforms

    1 - In Visual Studio, choose File > New > TelerikXFApp app template (use the filter box to find it quickly)
    2- In the wizard, check off all the platforms you want and click OK, this will create all the projects.
    3 - Rebuild solution (this will pull in all the missing Nuget packages)

    That's it, you can now explore the different project's configuration/dependencies or deploy to emulator/device. 

    Regards,
    Lance | Tech Support Engineer, Sr.
    Telerik by Progress
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top