xamarin / AndroidX

AndroidX bindings for .NET for Android
MIT License
180 stars 45 forks source link

androidx.profileinstaller.ProfileInstaller.writeProfile java.lang.ClassNotFoundException: Didn't find class "com.google.common.util.concurrent.ListenableFuture" on path: DexPathList #896

Closed Jakar510 closed 3 months ago

Jakar510 commented 4 months ago

Android application type

Android for .NET (net6.0-android, etc.)

Affected platform version

.NET 8.0.300

Description

Current Behavior

androidx.profileinstaller.ProfileInstaller.writeProfile java.lang.ClassNotFoundException: Didn't find class "com.google.common.util.concurrent.ListenableFuture" on path: DexPathList

After some further research i found this Previous Issue and Previous Issue, so i tried to install Xamarin.Google.Guava.ListenableFuture v1.0.0.19 and nuget got this error:

NU1605: Warning As Error: Detected package downgrade: Xamarin.Google.Guava.ListenableFuture from 9999.0.0 to 1.0.0.19. Reference the package directly from the project to select a different version. 
 Project.Maui -> Shared.Maui -> CommunityToolkit.Maui.MediaElement 3.1.1 -> Xam.Plugins.Android.ExoPlayer 2.19.1 -> Xam.Plugins.Android.ExoPlayer.Common 2.19.1 -> Xamarin.Google.Guava 31.1.0.3 -> Xamarin.Google.Guava.ListenableFuture (>= 9999.0.0) 
 Project.Maui -> Xamarin.Google.Guava.ListenableFuture (>= 1.0.0.19)

NU1605: Warning As Error: Detected package downgrade: Xamarin.Google.Guava.ListenableFuture from 9999.0.0 to 1.0.0.19. Reference the package directly from the project to select a different version. 
 Project.Maui -> Shared.Maui -> CommunityToolkit.Maui.MediaElement 3.1.1 -> Xam.Plugins.Android.ExoPlayer.Transformer 2.19.1 -> Xam.Plugins.Android.ExoPlayer.Core 2.19.1 -> Xam.Plugins.Android.ExoPlayer.Common 2.19.1 -> Xamarin.Google.Guava 31.1.0.3 -> Xamarin.Google.Guava.ListenableFuture (>= 9999.0.0) 
 Project.Maui -> Xamarin.Google.Guava.ListenableFuture (>= 1.0.0.19)

Expected Behavior

Not crash on startup.

Steps To Reproduce

Create a MAUI project, add the CommunityToolkit.Maui.MediaElement and try to run it.

Relevant log output

Known stack traces:

    dalvik.system.BaseDexClassLoader.findClass BaseDexClassLoader.java:259
    java.lang.ClassLoader.loadClass ClassLoader.java:379
    java.lang.ClassLoader.loadClass ClassLoader.java:312
    androidx.profileinstaller.ProfileInstaller.writeProfile ProfileInstaller.java:577
    androidx.profileinstaller.ProfileInstaller.writeProfile ProfileInstaller.java:515
    androidx.profileinstaller.ProfileInstaller.writeProfile ProfileInstaller.java:479
    androidx.profileinstaller.ProfileInstallerInitializer.lambda$writeInBackground$2 ProfileInstallerInitializer.java:145
    androidx.profileinstaller.ProfileInstallerInitializer$$ExternalSyntheticLambda2.run
    java.util.concurrent.ThreadPoolExecutor.runWorker ThreadPoolExecutor.java:1145
    java.util.concurrent.ThreadPoolExecutor$Worker.run ThreadPoolExecutor.java:644
    java.lang.Thread.run Thread.java:1012

    androidx.profileinstaller.ProfileInstaller.writeProfile ProfileInstaller.java:577
    androidx.profileinstaller.ProfileInstaller.writeProfile ProfileInstaller.java:515
    androidx.profileinstaller.ProfileInstaller.writeProfile ProfileInstaller.java:479
    androidx.profileinstaller.ProfileInstallerInitializer.lambda$writeInBackground$2 ProfileInstallerInitializer.java:145
    androidx.profileinstaller.ProfileInstallerInitializer$$ExternalSyntheticLambda2.run
    java.util.concurrent.ThreadPoolExecutor.runWorker ThreadPoolExecutor.java:1145
    java.util.concurrent.ThreadPoolExecutor$Worker.run ThreadPoolExecutor.java:644
    java.lang.Thread.run Thread.java:1012

    java.lang.VMClassLoader.findLoadedClass VMClassLoader.java
    java.lang.ClassLoader.findLoadedClass ClassLoader.java:738
    java.lang.ClassLoader.loadClass ClassLoader.java:363
    java.lang.ClassLoader.loadClass ClassLoader.java:312
    androidx.profileinstaller.ProfileInstaller.writeProfile ProfileInstaller.java:577
    androidx.profileinstaller.ProfileInstaller.writeProfile ProfileInstaller.java:515
    androidx.profileinstaller.ProfileInstaller.writeProfile ProfileInstaller.java:479
    androidx.profileinstaller.ProfileInstallerInitializer.lambda$writeInBackground$2 ProfileInstallerInitializer.java:145
    androidx.profileinstaller.ProfileInstallerInitializer$$ExternalSyntheticLambda2.run
    java.util.concurrent.ThreadPoolExecutor.runWorker ThreadPoolExecutor.java:1145
    java.util.concurrent.ThreadPoolExecutor$Worker.run ThreadPoolExecutor.java:644
    java.lang.Thread.run Thread.java:1012

    androidx.profileinstaller.ProfileInstaller.writeProfile ProfileInstaller.java:577
    androidx.profileinstaller.ProfileInstaller.writeProfile ProfileInstaller.java:515
    androidx.profileinstaller.ProfileInstaller.writeProfile ProfileInstaller.java:479
    androidx.profileinstaller.ProfileInstallerInitializer.lambda$writeInBackground$2 ProfileInstallerInitializer.java:145
    androidx.profileinstaller.ProfileInstallerInitializer$$ExternalSyntheticLambda2.run
    java.util.concurrent.ThreadPoolExecutor.runWorker ThreadPoolExecutor.java:1145
    java.util.concurrent.ThreadPoolExecutor$Worker.run ThreadPoolExecutor.java:644
    java.lang.Thread.run Thread.java:1012
Jakar510 commented 4 months ago

CommunityToolkit/Maui/1908

Jakar510 commented 3 months ago

The workarounds listed in https://github.com/xamarin/AndroidX/issues/535 don't work.

jpobst commented 3 months ago

Using .NET 8.0.301, I did:

Running this from VS on an API 34 emulator appears to succeed.

Jakar510 commented 3 months ago

@jpobst

And on a physical device?

jpobst commented 3 months ago

I don't have one available, but there shouldn't be a difference.

Jakar510 commented 3 months ago

I'm not sure what changed, but it no longer occurs.