Error even after installing android v4 support library in Xamarin

前端 未结 3 1175
无人及你
无人及你 2021-01-06 05:17

Even after installing v4 support library from Xamarin Component Store,I get this error.I tried googling for these problems but I always get the same error in Xamarin Studio

3条回答
  •  自闭症患者
    2021-01-06 05:35

    This is Xamarin Bug 32498

    The problem starts when you are normally installing one of Xamarin.Android.Support.* nuget packages.

    Then IDE (VS2015 for me) hangs and nothing goes well, so you're forced to shutdown the IDE. After re-openning the IDE and forcing a link to the assemblies and when it comes to build the project, it says :

    package android.support.* doesn't exist

    Here's what happens in the background:

    First You Must Know That:

    Xamarin.Android.Support.* are actually C# bindings of google support libraries (THAT ARE WRITTEN IN JAVA), so they are not completely native and they wrappers of google support libraries (for more about Xamarin C# bindings read : Binding A Java Library).

    Bug Scenario:

    The time the IDE hangs is the time when it starts downloading Google Support Library Sources (about 96 MB) from the internet for each of the Xamarin.Android.Support.* packages then extracting it to

    C:\Users\%username%\AppData\Local\Xamarin 
    

    Solutions:

    I propose 2 solutions:

    1. A friend told me that using a version other than 22.2.1 would solve the problem ( I didn't try it)

    2. Manual Extracting of the package (e.g. Xamarin.Android.Support.v4):

      1. Go to C:\Users\%username%\AppData\Local\Xamarin, delete the folder with the desired library name if it exists e.g. Android.Support.v4
      2. Create a path with the desired library name C:\Users\%username%\AppData\Local\Xamarin\{LibraryName}\22.2.1 e.g. C:\Users\%username%\AppData\Local\Xamarin\Android.Support.v4\22.2.1
      3. Download Google Support Library Source from here (v16).
      4. Copy it and extract its content into C:\Users\%username%\AppData\Local\Xamarin\Android.Support.v4\22.2.10\content
      5. Open the pre-downloaded archive android_m2repository_r16, navigate to m2repository\com\android\support and go to libraryname\22.2.1 (e.g. support-v4\22.2.1. Search for and open libraryName-22.2.1.aar (e.g. support-v4-22.2.1.aar (it opens directly with WinRAR) extract the content of the file to C:\Users\%username%\AppData\Local\Xamarin\{LibraryName}\22.2.10\embedded e.g. C:\Users\%username%\AppData\Local\Xamarin\Android.Support.v4\22.2.10\embedded

      6. Run the package installation nuget command

    Edit

    you have to keep a copy of android_m2repository_r16.zip inside C:\Users\%username%\AppData\Local\Xamarin\Android.Support.v4\22.2.10\

提交回复
热议问题