Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[android] update to the latest AndroidX packages #5588

Merged
merged 5 commits into from
Mar 29, 2022

Conversation

jonathanpeppers
Copy link
Member

@jonathanpeppers jonathanpeppers commented Mar 25, 2022

Context: #5305
Fixes: xamarin/AndroidX#509

Update to the latest AndroidX packages, so we also use the latest
Xamarin.Google.Guava.ListenableFuture

This currently has build failures:

src\Core\src\Platform\Android\Navigation\StackNavigationManager.cs(145,41): error CS1061: 'NavController' does not contain a definition for 'BackStack' and no accessible extension method 'BackStack' accepting a first argument of type 'NavController' could be found (are you missing a using directive or an assembly reference?)
src\Core\src\Platform\Android\Navigation\StackNavigationManager.cs(188,48): error CS1061: 'NavController' does not contain a definition for 'BackStack' and no accessible extension method 'BackStack' accepting a first argument of type 'NavController' could be found (are you missing a using directive or an assembly reference?)
src\Core\src\Platform\Android\Navigation\StackNavigationManager.cs(245,51): error CS1061: 'NavController' does not contain a definition for 'BackStack' and no accessible extension method 'BackStack' accepting a first argument of type 'NavController' could be found (are you missing a using directive or an assembly reference?)

Looking at:

~\.nuget\packages\xamarin.androidx.navigation.runtime\2.4.1\lib\net6.0-android31.0\Xamarin.AndroidX.Navigation.Runtime.dll

I can't find:

[Register("androidx/navigation/NavController", DoNotGenerateAcw = true)]
public class NavController : Object
{
    public unsafe virtual IDeque BackStack
    {
        [Register("getBackStack", "()Ljava/util/Deque;", "GetGetBackStackHandler")]
        get;

But it's not documented here either:

https://developer.android.com/reference/androidx/navigation/NavController

Context: dotnet#5305
Fixes: xamarin/AndroidX#509

Update to the latest AndroidX packages, so we also use the latest
Xamarin.Google.Guava.ListenableFuture

This currently has build failures:

  src\Core\src\Platform\Android\Navigation\StackNavigationManager.cs(145,41): error CS1061: 'NavController' does not contain a definition for 'BackStack' and no accessible extension method 'BackStack' accepting a first argument of type 'NavController' could be found (are you missing a using directive or an assembly reference?)
  src\Core\src\Platform\Android\Navigation\StackNavigationManager.cs(188,48): error CS1061: 'NavController' does not contain a definition for 'BackStack' and no accessible extension method 'BackStack' accepting a first argument of type 'NavController' could be found (are you missing a using directive or an assembly reference?)
  src\Core\src\Platform\Android\Navigation\StackNavigationManager.cs(245,51): error CS1061: 'NavController' does not contain a definition for 'BackStack' and no accessible extension method 'BackStack' accepting a first argument of type 'NavController' could be found (are you missing a using directive or an assembly reference?)

Looking at:

    ~\.nuget\packages\xamarin.androidx.navigation.runtime\2.4.1\lib\net6.0-android31.0\Xamarin.AndroidX.Navigation.Runtime.dll

I can't find:

    [Register("androidx/navigation/NavController", DoNotGenerateAcw = true)]
    public class NavController : Object
    {
        public unsafe virtual IDeque BackStack
        {
            [Register("getBackStack", "()Ljava/util/Deque;", "GetGetBackStackHandler")]
            get;

But it's not documented here either:

https://developer.android.com/reference/androidx/navigation/NavController
@jonathanpeppers
Copy link
Member Author

/cc @moljac @jpobst

@jpobst
Copy link
Contributor

jpobst commented Mar 25, 2022

It does appear that it has been removed in 2.4+.

navigation-runtime-2.3.5.aar:
image

navigation-runtime-2.4.1.aar:
image

I think their:

@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})

essentially means "this is not public API".

Documentation

LIBRARY_GROUP - Restrict usage to code within the same group of libraries.

We likely should not be binding stuff marked this way, but it's not something our tools have support for.

@jonathanpeppers
Copy link
Member Author

@jpobst should MAUI just be using a different API here?

@PureWeen it looks like maybe you wrote this part, do you see what we should change?

Copy link
Contributor

@moljac moljac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

version bumps - LGTM

@PureWeen
Copy link
Member

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 2 pipeline(s).

Comment on lines -145 to +146
var iterator = NavHost.NavController.BackStack.Iterator();
var iterator = NavHost.NavController.BackQueue.Iterator();
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LOL!

@rmarinho
Copy link
Member

   (_ReadAndroidManifest target) -> 
         obj\Release\net6.0-android\android\AndroidManifest.xml : error XA4218: Unable to find //manifest/application/uses-library at path: C:\Program Files (x86)\Android\android-sdk\platforms\android-31\optional\androidx.window.extensions.jar [D:\a\_work\_temp\templatesTestmaui\templatesTestmaui.csproj]
         obj\Release\net6.0-android\android\AndroidManifest.xml : error XA4218: Unable to find //manifest/application/uses-library at path: C:\Program Files (x86)\Android\android-sdk\platforms\android-31\optional\androidx.window.sidecar.jar [D:\a\_work\_temp\templatesTestmaui\templatesTestmaui.csproj]

@jonathanpeppers
Copy link
Member Author

I'm having trouble reproducing this problem locally... I get no warnings or errors with ../bin/dotnet/dotnet new maui.

Trying $(MSBuildWarningsAsMessages) now.

@jonathanpeppers jonathanpeppers marked this pull request as ready for review March 29, 2022 02:19
@jonathanpeppers
Copy link
Member Author

Ok, I see the same test failures on other PRs. I had retried them a few times.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
fixed-in-6.0.300-rc.1 Look for this fix in 6.0.300-rc.1! platform/android 🤖
Projects
None yet
Development

Successfully merging this pull request may close these issues.

error : java.lang.RuntimeException: com.android.tools.r8.CompilationFailedException
8 participants