Error even after installing android v4 support lib

2020-03-04 07:13发布

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 while developing android app

enter image description here

3条回答
Ridiculous、
2楼-- · 2020-03-04 07:25

Your screenshot is too small and I can barely read the code and error messages. But it appears that you have Java code in Xamarin Studio and it's generating compile errors. That would be expected since Xamarin Studio only compiles C#, and not Java. You'll have to take your current Java code and convert it to C#.

查看更多
狗以群分
3楼-- · 2020-03-04 07:28

I didn’t have an issue with that component using xamarin version 3.11.586 and v4 support lib version 22.2.0.0. Would you be able to try this?

查看更多
该账号已被封号
4楼-- · 2020-03-04 07:45

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\

查看更多
登录 后发表回答