Closed MagicAndre1981 closed 1 year ago
Usually this happens after an upgrade and you need to aggressively do some rebuilds and/or delete the bin & obj folders to clear the cache. Have you tried that?
yes, I did this. I just saw at AndroidX repository there is also a bug report similar to mine
@jfversluis I also tested the new massive nuget updates from PR and issue is the same.
Comparing 1.5.1.1 with 1.6.x shows that the classes are renamed. In 1.6.x Compat was added to class names in AndroidX.AppCompat.AppCompatResource.
This is why DrawableWrapper is not found any longer as the new name is now DrawableWrapperCompat
The Android Platform implements ClipDrawableWrapper
in ShellSearchView.cs
from DrawableWrapper.
And because of the renamed class this causes runtime failure. So update this code and require new lib as nuget dependency
I'm getting this same error as well.
as mentioned above a class is renamed and XF requires the old class name which triggers this error.
It is strange the error only occurs for me when i've set the deployment configuration to release. if it is set to debug, it works.
ok @jfversluis those new AndroidX nugets require now Targetframework 12.0 . This is a massive change in code. Can someone from the team make retarget and nuget androidx bumps?
I am targeting Android 12 and still can't build in Release. I have switched back to 1.5.1.1 for the Xamarin.AndroidX.AppCompat and Xamarin.AndroidX.AppCompat.AppCompatResources. Seems to be working
Android 12 is required for building XF with new androidx nugets not your app itself.
@MagicAndre1981 Not sure I understand. I am building on VS2022 with Android SDK Platform 33 installed. My Target Android Version for the app is 12.0 API Level 31
Release build fails with Failed to resolve AndroidX.AppCompat.Graphics.Drawable.DrawableWrapper using AppCompat Nuget libraries 1.6.x. But does build with 1.5.1.1
yes, but trying to make XF comaptible with AndroidX.AppCompat.Graphics.Drawable.DrawableWrapper 1.6.x XF itself must target Android12. Currently they build XF against old AndroidX libs and target Android10
Got it! So we need to wait for an update. I'll stay on 15.1.1 until we get the XF update
Thanks for the clarification.
A workaround that so far works for me was to build a custom binding library and add missing (renamed) classes back and repacking this in custom local nuget.
See this repo: https://github.com/sasa-bobic/Xamarin.AndroidX.AppCompat.AppCompatResources
Downgrading to 1.5.1.1 does not solve the problem for me. I have tried clearing all caches after downgrade, but problem persists.
@donfbecker it worked for me. Perhaps you have some nuget packages that have dependency of the ver 1.6.0 of AppCompat and silently selected newer version to be installed?
@donfbecker it worked for me. Perhaps you have some nuget packages that have dependency of the ver 1.6.0 of AppCompat and silently selected newer version to be installed?
The NuGet package manager reported that 1.5.1.1 was installed, but I did find some warnings about version requirements of other Xamarin.AndroidX packages that were in use. I had to downgrade the other four AndroidX packages as well.
Will this be addressed soon or do we all need to use the workaround @sasa-bobic posted?
there is a PR to fix the issue and upgrade to Monodroid13.0
Same problem in release mode. Debug works. Problem is that Xamarin.AndroidX.AppCompat >= 1.6.0 is needed for the new "per-app language preferences" in android 13: https://developer.android.com/guide/topics/resources/app-languages#java
@sasa-bobic followed that and updated package then the error changed. Now getting this: Type androidx.appcompat.graphics.drawable.AnimatedStateListDrawableCompat$1 is defined multiple times
Error in obj\Release\130\lp\132\jl\classes.jar:androidx/appcompat/graphics/drawable/AnimatedStateListDrawableCompat$1.class: Type androidx.appcompat.graphics.drawable.AnimatedStateListDrawableCompat$1 is defined multiple times: obj\Release\130\lp\132\jl\classes.jar:androidx/appcompat/graphics/drawable/AnimatedStateListDrawableCompat$1.class, obj\Release\130\lp\26\jl\bin\classes.jar:androidx/appcompat/graphics/drawable/AnimatedStateListDrawableCompat$1.class Compilation failed java.lang.RuntimeException: com.android.tools.r8.CompilationFailedException: Compilation failed to complete, origin: obj\Release\130\lp\132\jl\classes.jar androidx/appcompat/graphics/drawable/AnimatedStateListDrawableCompat$1.class at com.android.tools.r8.internal.Fj.a(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:98) at com.android.tools.r8.D8.main(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:4) Caused by: com.android.tools.r8.CompilationFailedException: Compilation failed to complete, origin: obj\Release\130\lp\132\jl\classes.jar:androidx/appcompat/graphics/drawable/AnimatedStateListDrawableCompat$1.class at Version.fakeStackEntry(Version_3.3.75.java:0) at com.android.tools.r8.internal.Fj.a(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:75) at com.android.tools.r8.internal.Fj.a(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:28) at com.android.tools.r8.internal.Fj.a(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:27) at com.android.tools.r8.internal.Fj.b(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:2) at com.android.tools.r8.D8.a(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:22) at com.android.tools.r8.D8.a(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:17) at com.android.tools.r8.internal.Fj.a(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:85) ... 1 more Caused by: com.android.tools.r8.internal.f: Type androidx.appcompat.graphics.drawable.AnimatedStateListDrawableCompat$1 is defined multiple times: obj\Release\130\lp\132\jl\classes.jar:androidx/appcompat/graphics/drawable/AnimatedStateListDrawableCompat$1.class, obj\Release\130\lp\26\jl\bin\classes.jar:androidx/appcompat/graphics/drawable/AnimatedStateListDrawableCompat$1.class at com.android.tools.r8.internal.JT.a(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:14) at com.android.tools.r8.internal.JT.a(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:22) at com.android.tools.r8.internal.HN.a(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:26) at com.android.tools.r8.internal.HN.a(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:10) at java.base/java.util.concurrent.ConcurrentHashMap.merge(ConcurrentHashMap.java:2048) at com.android.tools.r8.internal.HN.a(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:6) at com.android.tools.r8.graph.B2$a.e(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:4) at com.android.tools.r8.dex.b.a(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:110) at com.android.tools.r8.dex.b.a(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:28) at com.android.tools.r8.D8.a(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:25) at com.android.tools.r8.D8.d(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:606) at com.android.tools.r8.D8.c(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:1) at com.android.tools.r8.internal.Fj.a(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:24) ... 5 more Directory 'obj\Release\130\lp\132' is from 'androidx.appcompat.appcompat-resources.aar'
I’m also very interested in a fix for this, but in the meantime the workaround that I found to be easiest was simply to downgrade the Xamarin.AndroidX.AppCompat versions to 1.5.1.1 and then also (by consequence) to target Android 12 rather than 13. This workaround will continue to work for publishing apps to Google Play until the store starts requiring targeting 13 in August of 2023.
I am also facing the same error, and our project needs to be updated to Android 13. Can anyone provide a solution please!
as said, Microsoft works on it and already has a PR
Xamarin.AndroidX.AppCompat
It's not that it works in debug. It works with Linker set to none.
Downgrading Xamarin.AndroidX.AppCompat to 1.5.1.1 does not solve the problem, clean the proyect and delete bin and obj folder does not solve the problem...
In Debug mode, works perfectly, the problem is only in release mode, i have de links options to none and persist de error.
Has anyone found any solution?
@ivaldiviah just use pre release of xamarin.forms and latest appCompat. then it should work.
It works for me, when I also downgrade Xamarin.AndroidX.AppCompat.AppCompatResources to 1.5.1.1
A workaround that so far works for me was to build a custom binding library and add missing (renamed) classes back and repacking this in custom local nuget.
See this repo: https://github.com/sasa-bobic/Xamarin.AndroidX.AppCompat.AppCompatResources
Thank you. I solved it with this content.
Thank you. I solved it with this content.
why? Simply use the official XF SR15
Thank you. I solved it with this content.
why? Simply use the official XF SR15
Maui (.net7) Android AOT Compile Error. https://github.com/xamarin/xamarin-android/issues/8252#issuecomment-1677395907
ok, this topic is about Xamarin Forms, so it was not clear that you use MAUI
Description
Updating Xamarin.AndroidX.AppCompat to 1.6.0 causes following error at startup:
Could not resolve type with token 01000363 from typeref (expected class 'AndroidX.AppCompat.Graphics.Drawable.DrawableWrapper' in assembly 'Xamarin.AndroidX.AppCompat.AppCompatResources, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null')
Steps to Reproduce
Expected Behavior
app starts fine
Actual Behavior
error at startup
Basic Information
Environment
VS2019 16.11.23
Workaround
stay at 1.5.1.1