Skip to content

New bunch of warnings using Xamarin.AndroidX.Annotations 1.6.0 #727

Closed

Description

@gmck

Android application type

.NET Android (net7.0-android, etc.)

Affected platform version

VS 2022 17.6.0 Prev 6.0

Description

I get a new bunch of warnings since moving to Prev 6 from 5. However, can also observe the same warnings if using 17.5.0. They are all JAVAC warnings

JAVAC : warning : unknown enum constant Scope.LIBRARY_GROUP_PREFIX etc.

Steps to Reproduce

Test project at https://github.com/gmck/NavigationGraph7Net7

Did you find any workaround?

No

Relevant log output

See test project

Activity

  1. jonathanpeppers commented on May 8, 2023

    @jonathanpeppers
    Member

    new bunch of warnings since moving to Prev 6 from 5

    There are no Android workload changes between these two builds of Visual Studio.

    One error message, I see when I build this project is:

      reason: class file for androidx.annotation.RestrictTo$Scope not found
    

    Are we sure it wasn't the latest AndroidX packages that caused this?

    There are 102 Warning(s) like this, but no other information:

    JAVAC unknown enum constant Scope.LIBRARY_GROUP_PREFIX
    JAVAC unknown enum constant Scope.LIBRARY
    
  2. jpobst commented on May 8, 2023

    @jpobst
    Contributor
  3. changed the title [-]New bunch of warnings using VS 2022 17.6.0 Prev 6.0[/-] [+]New bunch of warnings using Xamarin.AndroidX.Annotations 1.6.0[/+] on May 8, 2023
  4. jpobst commented on May 8, 2023

    @jpobst
    Contributor

    It looks like the code was moved to:
    https://maven.google.com/web/index.html#androidx.annotation:annotation-jvm:1.6.0

    Unfortunately this appears to use some new system that is not POM files or anything else we have built support for.

    The easiest fix would probably be to bind this as a new package and manually add it as a dependency of the Xamarin.AndroidX.Annotation package.

  5. transferred this issue fromdotnet/androidon May 8, 2023
  6. moljac commented on May 16, 2023

    @moljac
    Contributor
  7. gmck commented on May 17, 2023

    @gmck
    Author

    @moljac
    Can you explain how this update works? I don't see any updates when I click on updates in the NuGet package manager.
    Were you able to build the supplied test app without all those warnings?

  8. moljac commented on May 20, 2023

    @moljac
    Contributor

    @moljac Can you explain how this update works?

    No, I cannot explain. Trying to find some clues.

    I don't see any updates when I click on updates in the NuGet package manager.

    Not published yet.

    PR: #724

    Were you able to build the supplied test app without all those warnings?

    No. I get the same warnings with all samples.

  9. gmck commented on May 23, 2023

    @gmck
    Author

    @moljac

    Thanks for your reply. I didn't realize that it had not been published. I thought that your comment above "Added new bindings" meant that it had been published.

    While you are here can you comment on the missing methods OnPrepareMenu, OnMenuClosed in AndroidX.Core.View. per #611, as referenced in #718 Enable DIM for AndroidX packages.

    Is this the same thing - Not published yet

  10. moljac commented on May 23, 2023

    @moljac
    Contributor

    @moljac

    Thanks for your reply. I didn't realize that it had not been published. I thought that your comment above "Added new bindings" meant that it had been published.

    In the meantime:

    https://www.nuget.org/packages/Xamarin.AndroidX.Annotation.Jvm

    Our process is far more complicated now than it was 2-3 years ago (reviews, security and quality checks, you_name_it) and it takes longer just to fight through all steps. Then if I am out of luck I hit stuff like:

    CI windows only (mac is greeen all the time):

    ========================================
    ci-setup
    ========================================
    
    ========================================
    javadocs
    ========================================
    An error occurred when executing task 'javadocs'.
    Error: One or more errors occurred. (The SSL connection could not be established, see inner exception.)
    	The SSL connection could not be established, see inner exception.
    ##[error]PowerShell exited with code '1'.
    

    and have to restart pipelines.

    Due to the fact I try to stay sane - I did not look at the problem. Simply restarting helps, but it takes time.

    While you are here can you comment on the missing methods OnPrepareMenu, OnMenuClosed in AndroidX.Core.View. per #611, as referenced in #718 Enable DIM for AndroidX packages.

    Is this the same thing - Not published yet

    No. I don't think so. Or... It could be. Not sure without diving in deeper.

    Our tooling is not perfect and even worse - environment changes (tools, languages like java and kotlin), so it could be tons of reasons. In this case java classes (code) was moved to other artifact with -jvm (google does move very often).

  11. gmck commented on May 26, 2023

    @gmck
    Author

    @moljac, @jpobst

    I upgraded the test project to the latest NuGets and I still have a problem with these warnings.

    The warnings are still present if you just do a build. However, if you then deploy the warnings disappear other than the two warnings androidx.window.extensions.jar and androidx.window.sidecar.jar which have been there forever.

    If you do a clean and then just Deploy, it builds and the deploy succeeds, but you get all the warnings. If you then just deploy again, it deploys in just over 1 sec and the error list clears except for the two androidx.window warnings above.

    You should be able to reproduce it with the upgraded sample. The sample also includes a working OnPrepareMenu in the HomeFragment.cs

    Now using 17.7.0 P1.0

  12. moljac commented on Jun 8, 2023

    @moljac
    Contributor

    @moljac, @jpobst

    I upgraded the test project to the latest NuGets and I still have a problem with these warnings.

    Can you try Xamarin.AndroidX.Annotation.1.6.0.3 please?

    The warnings are still present if you just do a build. However, if you then deploy the warnings disappear other than the two warnings androidx.window.extensions.jar and androidx.window.sidecar.jar which have been there forever.

    Previous rounds of published packages were not focused to fix these warnings. Fix was published few days ago.

    Fixed in

    #738

    Now using 17.7.0 P1.0

    It is not VS or .NET SDK issue, but AndroidX package[s]. Namely google moves code around and now it is in annotation-jvm artifact.

    https://maven.google.com/web/index.html?q=androidx.annotation#androidx.annotation

    annotation:1.6.0.pom:

    <?xml version="1.0" encoding="UTF-8"?>
    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
      <!-- This module was also published with a richer model, Gradle metadata,  -->
      <!-- which should be used instead. Do not delete the following line which  -->
      <!-- is to indicate to Gradle or any Gradle module metadata file consumer  -->
      <!-- that they should prefer consuming it instead. -->
      <!-- do_not_remove: published-with-gradle-metadata -->
      <modelVersion>4.0.0</modelVersion>
      <groupId>androidx.annotation</groupId>
      <artifactId>annotation</artifactId>
      <version>1.6.0</version>
      <name>Android Support Library Annotations</name>
      <description>The Support Library is a static library that you can add to your Android application in order to use APIs that are either not available for older platform versions or utility APIs that aren't a part of the framework APIs.</description>
      <url>https://developer.android.com/jetpack/androidx/releases/annotation#1.6.0</url>
      <inceptionYear>2013</inceptionYear>
      <licenses>
        <license>
          <name>The Apache Software License, Version 2.0</name>
          <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
          <distribution>repo</distribution>
        </license>
      </licenses>
      <developers>
        <developer>
          <name>The Android Open Source Project</name>
        </developer>
      </developers>
      <scm>
        <connection>scm:git:https://android.googlesource.com/platform/frameworks/support</connection>
        <url>https://cs.android.com/androidx/platform/frameworks/support</url>
      </scm>
      <dependencies>
        <dependency>
          <groupId>org.jetbrains.kotlin</groupId>
          <artifactId>kotlin-stdlib</artifactId>
          <version>1.8.0</version>
          <scope>runtime</scope>
        </dependency>
      </dependencies>
    </project>

    annotation-jvm:1.6.0.pom

    <?xml version="1.0" encoding="UTF-8"?>
    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
      <!-- This module was also published with a richer model, Gradle metadata,  -->
      <!-- which should be used instead. Do not delete the following line which  -->
      <!-- is to indicate to Gradle or any Gradle module metadata file consumer  -->
      <!-- that they should prefer consuming it instead. -->
      <!-- do_not_remove: published-with-gradle-metadata -->
      <modelVersion>4.0.0</modelVersion>
      <groupId>androidx.annotation</groupId>
      <artifactId>annotation-jvm</artifactId>
      <version>1.6.0</version>
      <name>Android Support Library Annotations</name>
      <description>The Support Library is a static library that you can add to your Android application in order to use APIs that are either not available for older platform versions or utility APIs that aren't a part of the framework APIs.</description>
      <url>https://developer.android.com/jetpack/androidx/releases/annotation#1.6.0</url>
      <inceptionYear>2013</inceptionYear>
      <licenses>
        <license>
          <name>The Apache Software License, Version 2.0</name>
          <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
          <distribution>repo</distribution>
        </license>
      </licenses>
      <developers>
        <developer>
          <name>The Android Open Source Project</name>
        </developer>
      </developers>
      <scm>
        <connection>scm:git:https://android.googlesource.com/platform/frameworks/support</connection>
        <url>https://cs.android.com/androidx/platform/frameworks/support</url>
      </scm>
      <dependencies>
        <dependency>
          <groupId>org.jetbrains.kotlin</groupId>
          <artifactId>kotlin-stdlib</artifactId>
          <version>1.8.0</version>
          <scope>compile</scope>
        </dependency>
      </dependencies>
    </project>
  13. gmck commented on Jun 9, 2023

    @gmck
    Author

    @moljac , @jpobst , @jonathanpeppers

    Can you try Xamarin.AndroidX.Annotation.1.6.0.3, please?

    When I check for updates none are found. Is this to be expected?

    If I add 1.6.0.3 manually to the project the warnings do go away.

    However, how is one meant to know that this particular NuGet is required? @jonathanpeppers originally picked up on reason: class file for androidx.annotation.RestrictTo$Scope not found which eventually led to the fix.

    Could the build system be improved to emit some sort of warning/error indicating that Xamarin.AndroidX.Annotation is required?

  14. moljac commented on Jun 9, 2023

    @moljac
    Contributor

    When I check for updates none are found. Is this to be expected?

    True. 1.6.0.3 is not listed. Not sure why.

    https://www.nuget.org/packages/Xamarin.AndroidX.Annotation.Jvm/1.6.0.3

    If I add 1.6.0.3 manually to the project the warnings do go away.

    However, how is one meant to know that this particular NuGet is required?

    It is not. Only for warnings, because code was moved.

    @jonathanpeppers originally picked up on reason: class file for androidx.annotation.RestrictTo$Scope not found which eventually led to the fix.

    Could the build system be improved to emit some sort of warning/error indicating that Xamarin.AndroidX.Annotation is required?

    Android build system (dependencies) rely on POM files, so we do. This particular POM file did not indicate that annotation-jvm was needed as dependency. Warnings (missing fileds and classes) forced us to check what is going on. The issue was not functional blocker, more aesthetic.

    When building AX or GPS-FB-MLKit there are quite a lot "missing class" warnings and I usually ignore them. I dive only if those are culprit that something was not surfaced/bound. Simply resource optimization (my day is 24 hrs too).

  15. jpobst commented on Jul 27, 2023

    @jpobst
    Contributor

    This should be fixed in Xamarin.AndroidX.Annotation 1.6.0.4.

  16. added a commit that references this issue on Oct 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions