MAUI-Android-Release package compiled under W11 not working
Description
MAUI Android (API31) application not working when compiled for Release, under Windows 11 (the application crashes right after the splash screen).
The application runs when compiled in Debug mode. It also works perfectly when compiled for Release or Debug under Windows 10.
Trimmining and AOT have been disabled in Release mode due to other issues.
Error message from the Device Log:
Time Device Name Type PID Tag Message
11-08 14:02:48.067 pixel_5_-_api_31 Error 19999 AndroidRuntime java.lang.NoSuchMethodError: no non-static method "Landroidx/coordinatorlayout/widget/CoordinatorLayout$LayoutParams;.setBehavior(Landroidx/coordinatorlayout/widget/CoordinatorLayout$Behavior;)V"
at crc6488302ad6e9e4df1a.MauiAppCompatActivity.n_onCreate(Native Method)
at crc6488302ad6e9e4df1a.MauiAppCompatActivity.onCreate(Unknown Source:0)
at android.app.Activity.performCreate(Activity.java:8051)
at android.app.Activity.performCreate(Activity.java:8031)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1329)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3608)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3792)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:103)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2210)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:201)
at android.os.Looper.loop(Looper.java:288)
at android.app.ActivityThread.main(ActivityThread.java:7839)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
Why is this method missing when compiled for Release on Windows 11? What are we missing? Do we need to add some specific configuration, whatever to make this work? How to guess what is creating the issue? The error message is not very explicit.
An empty/default MAUI application works as expected when compiled for Release on Windows 11. So, there is something in our application creating this issue.
Steps to Reproduce
I cannot share the code source through this channel.
Link to public reproduction project repository
No public repo
Version with bug
6.0.486 (current)
Last version that worked well
6.0.424
Affected platforms
Android
Affected platform versions
Android 12 and up
Did you find any workaround?
No workaround found.
Relevant log output
Time Device Name Type PID Tag Message
11-08 14:02:48.067 pixel_5_-_api_31 Error 19999 AndroidRuntime FATAL EXCEPTION: main
...
11-08 14:02:48.067 pixel_5_-_api_31 Error 19999 AndroidRuntime java.lang.NoSuchMethodError: no non-static method "Landroidx/coordinatorlayout/widget/CoordinatorLayout$LayoutParams;.setBehavior(Landroidx/coordinatorlayout/widget/CoordinatorLayout$Behavior;)V"
at crc6488302ad6e9e4df1a.MauiAppCompatActivity.n_onCreate(Native Method)
at crc6488302ad6e9e4df1a.MauiAppCompatActivity.onCreate(Unknown Source:0)
at android.app.Activity.performCreate(Activity.java:8051)
at android.app.Activity.performCreate(Activity.java:8031)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1329)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3608)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3792)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:103)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2210)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:201)
at android.os.Looper.loop(Looper.java:288)
at android.app.ActivityThread.main(ActivityThread.java:7839)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
Hi @jonmikeli. We have added the "s/needs-info" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.
Hi, @jonmikeli - thanks for opening this issue. Please share your binlogs so that we can investigate further
Hi @rachelkang , Sure, no problem. Is there a way to send it through a private channel?
@jonathanpeppers thoughts?
Hi @jonmikeli. We have added the "s/needs-info" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.
I think we need some .binlogs to look at this, or a sample app that hits the same issue.
Hi @jonathanpeppers ,
No problem to provide the binlogs but I cannot share them here. Any way to share them through a private channel?
@PureWeen @rachelkang how does the MAUI team go about sharing files privately?
Thanks for the issue report @jonmikeli! This issue appears to be a problem with Visual Studio, so we ask that you use the VS feedback tool to report the issue. That way it will get to the routed to the team that owns this experience in VS.
If you encounter a problem with Visual Studio, we want to know about it so that we can diagnose and fix it. By using the Report a Problem tool, you can collect detailed information about the problem, and send it to Microsoft with just a few button clicks.
- Go to the Visual Studio for Windows feedback tool or Visual Studio for Mac feedback tool to report the issue
- Close this bug, and consider adding a link to the VS Feedback issue so that others can follow its activity there.
This issue will be automatically closed in 3 days if there are no further comments.
@jonmikeli @jonathanpeppers I think the best and easiest way is to open a new issue in VS feedbug and upload logs and screenshots privately. You can link to it here and we can see it there.
That issue will eventually come back here, but we can use it for now to keep all your secrets hidden on our private servers in the cloud. 😄
Hi @jonmikeli. We have added the "s/needs-info" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.
Thanks @mattleibow @jonathanpeppers . Good to know that :). This is the link: https://developercommunity.visualstudio.com/t/MAUI-Android-Release-package-compiled-un/10197661
You mention that you disabled some settings:
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net6.0-android|AnyCPU'">
<!-- NOTE: this setting doesn't do anything if you have trimming off -->
<AndroidLinkTool>r8</AndroidLinkTool>
<PublishTrimmed>False</PublishTrimmed>
<RunAOTCompilation>False</RunAOTCompilation>
<!-- NOTE: this setting is already the default for Release -->
<EmbedAssembliesIntoApk>True</EmbedAssembliesIntoApk>
</PropertyGroup>
What happens if you remove this entire block and use the default values?
Hi @jonmikeli. We have added the "s/needs-info" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.
Hi @jonathanpeppers ,
Thank you for your message. No more crashes if I delete those lines :), which is super great ;) :). I can close the issue.
This said, now, I have noticed strange behaviors related to styles with some controls. For instance, some button backgrounds are not updated after changing the styles. If I leave and load back the given view, everything is ok. We do not experience this issue with Debug packages or Release (compiled on W10). Any idea though about the reason of the new problem? Do you want me to open another issue?
Thanks again ;)
Please open a new issue so we can track that better. Thanks!
And, glad you got the app building!