Forum Xamarin.Android
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

Android build fails "package androidx.recyclerview.widget does not exists" in msbuild, works in IDE

Hi There!

Project using targetFrameworkVersion 10, aapt2 and also uses some androidx packages.

It compiles well from the VS 2019 IDE in debug & release.

But on CI and also on my local machine when using msbuild(with the correct parameters, it works on earlier commits) am getting the following error roughly 2000x with a lot different sdk views:
obj\Release\100\android\src\crc643f46942d9dd1fff9\ScrollLayoutManager.java(5,38): javac.exe error JAVAC0000: error: package androidx.recyclerview.widget does not exist

Although the xamarin.androidx.recyclerview nuget package has been added to the project.

Disabled proguard but have not changed anything.
Added every piece of androidx packages for testing, did not work.

Is it a bug in msbuild or the IDE is buggy or something else is going on i missed?

I hope someone has an idea :)

Cheeers

Versions:
Microsoft Visual Studio Professional 2019
Version 16.7.6
VisualStudio.16.Release/16.7.6+30611.23
Microsoft .NET Framework
Version 4.8.04084

Installed Version: Professional

Xamarin 16.7.000.456 (d[email protected])
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin Designer 16.7.0.495 (remotes/origin/[email protected])
Visual Studio extension to enable Xamarin Designer tools in Visual Studio.

Xamarin Templates 16.7.85 (1bcbbdf)
Templates for building iOS, Android, and Windows apps with Xamarin and Xamarin.Forms.

Xamarin.Android SDK 11.0.2.0 (d16-7/025fde9)
Xamarin.Android Reference Assemblies and MSBuild support.
Mono: 83105ba
Java.Interop: xamarin/java.interop/[email protected]
ProGuard: Guardsquare/proguard/[email protected]
SQLite: xamarin/sqlite/[email protected]
Xamarin.Android Tools: xamarin/xamarin-android-tools/[email protected]

Xamarin.iOS and Xamarin.Mac SDK 14.0.0.0 (7ec3751a1)
Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.

Answers

  • LeonLuLeonLu Member, Xamarin Team Xamurai

    Please check the Linking option, when you set the linking to None like following screenshot, if you have this issue.

  • William.4025William.4025 USMember ✭✭

    Thank you for your response!

    It was on SDK only, after changing it to None i got other errors:

    C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1768,3): error XA4215: The Java type mono.android.support.v4.media.session.MediaSessionCompat_OnActiveChangeListenerImplementor is generated
    by more than one managed type. Please change the [Register] attribute so that the same Java type is not emitted.

    I assume it has something to do with : https://github.com/xamarin/AndroidX/issues/62 ?

  • LeonLuLeonLu Member, Xamarin Team Xamurai

    after changing it to None i got other errors:

    That is wired, if you set it to none, all of the nuget packages will not be moved. it is the same as you debug the application. When you debug your application, is that work?

  • William.4025William.4025 USMember ✭✭

    No, i am getting the error above in every configuration when linking is turned : .. mono.android.support.v4.media.session.MediaSessionCompat_OnActiveChangeListenerImplementor ..
    I dont use any xamarin.androidx or older xamarin.android packages directly.

    But as i see this is a very old issue that has not been fixed yet of course :D

Sign In or Register to comment.