Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xamarin Forms error: Java.Lang.NoClassDefFoundError: android.support.graphics.drawable.VectorDrawableCompat

When starting debugging of my project on the Android emulator I receive this error:

Java.Lang.NoClassDefFoundError: android.support.graphics.drawable.VectorDrawableCompat

At this code:

public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
{
    protected override void OnCreate(Bundle bundle)
    {
        //SQLitePCL.Batteries.Init();
        TabLayoutResource = Resource.Layout.Tabbar;
        ToolbarResource = Resource.Layout.Toolbar;

        base.OnCreate(bundle);

        string dbPath = FileAccessHelper.GetLocalFilePath("clocker.db3");

        global::Xamarin.Forms.Forms.Init(this, bundle);
        LoadApplication(new Clocker.App(dbPath));
    }
}

The error occurs on this row:

base.OnCreate(bundle);

I have tried looking online at the other suggestions but the answers seem related to specific Xamarin studio files which are non-existant in my project (i.g. the gradle file).

I have checked the contents of 'bundle' and it seems to be null at the time of the error but I'm unsure if this is causing the error.

I'm using Xamarin forms PCL.

like image 836
connersz Avatar asked Oct 26 '16 14:10

connersz


1 Answers

This error may occurs with several class if the project path is too long, because it go through the limit of Operational System character length.

Example of Long path:

C:\Users\Username\Documents\Visual Studio xxxx\Projects\Project Name

Example of Good path:

C:\Projects\ProjectName

EDIT - Added how the packages should look:

Packages Pic

like image 186
Anderson Oki Avatar answered Oct 23 '22 15:10

Anderson Oki