-
Notifications
You must be signed in to change notification settings - Fork 533
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
Crash on startup after updating to Xamarin.Android 13.1.0.1 #7588
Comments
Hi @akrol95. We have added the "need-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. |
@grendello Is it possible that this issue now happens due to additional check if (!UseAndroidNdk) {
ldFlags.Append ("--no-relax");
} Since #6901 |
@FoggyFinder it is possible and |
@grendello The documentation says that the |
We had a similar issue and after playing around with the settings quite a bit, the only combination that worked for us was both |
@akrol95 the setting may come from other sources than the .csproj (it can be in the environment, or set in @kevcrooks yes, that might be necessary if the NDK pointed to by |
The root cause of the issue is described in this commit. |
@grendello I tried with:
It's still crashing for the same reason. |
@akrol95 did you rebuild from scratch, after removing all |
I've tried to reproduce the issue, but the app neither crashes nor starts up, it just locks up on the splash screen. However, I see the following in the build logs:
@akrol95 would you mind building with On Unix, the script should be modified to look as follows: #!/bin/bash -e
MY_DIR="$(cd $(dirname $0);pwd)"
exec "${MY_DIR}"/ld --no-relax "$@" and on Windows, to: @echo off
setlocal
set BINARIES_DIRECTORY=%~dp0
set "BINARIES_DIRECTORY=" && "%BINARIES_DIRECTORY%ld.exe" --no-relax %*
if not ERRORLEVEL 0 exit /b %errorlevel% |
Yes, I did it every time.
So for me this line (and all the rest starting with "Executing the native linker...") looks like this: Sorry, but I don't get which exact script should I modify. Would you mind describing it more precisely? |
Looks like your build isn't passing The script to edit would be |
Thank you for clarification. But what's next? What else can I check to have this |
You can try adding the below property to your csproj, hopefully it works: <PropertyGroup>
<AndroidExtraAotOptions>ld-flags=--no-relax -s</AndroidExtraAotOptions>
</PropertyGroup> |
@grendello I am getting following error and the build crashes:
|
@akrol95 OK, so that didn't work... I'll try to think about some other approach. |
@akrol95 we tested Xamarin.Android 13.1.0.1 locally and it built your app properly. I'm afraid we're going to need a binlog from one of your builds (pass |
Hi @akrol95. We have added the "need-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'm unable to reproduce the specified crash on macOS using Xamarin.Android 13.1.0.1: % git clone https://github.com/bcc-code/bmm-app.git
% cd bmm-app
% git checkout crash-on-start
% msbuild -p:Configuration=Release -restore
% msbuild -p:Configuration=Release
% cd BMM.UI.Android
% msbuild -p:Configuration=Release -t:Install -v:diag > b.txt
% msbuild -p:Configuration=Release -t:_Run
Additionally, That said, the app does crash on startup, but for a different reason; from
I haven't investigated my startup crash further, I just note that it is not an assertion in |
Cursory investigation shows that it fails because the type doesn't exist: % $ANDROID_SDK_PATH/build-tools/31.0.3/dexdump obj/Release/android/bin/classes.dex | grep BmmMessaging
# no matches
|
@akrol95: the likely immediate cause of your issue is: https://github.com/bcc-code/bmm-app/blob/3c498d48f66994a00168f054a68c56aa726235fa/azure-pipelines-android.yaml#L43 - task: XamarinAndroid@1
inputs:
msbuildArguments: '/p:SolutionDir="$(Build.SourcesDirectory)" -p:AndroidPackageFormat=aab -t:SignAndroidPackage -p:AndroidKeyStore=True -p:AndroidNdkDirectory="$(ANDROID_NDK_LATEST_HOME)"' MSBuild command-line arguments are immutable; they cannot be changed from project files. For example, given <Project>
<PropertyGroup>
<Foo>Default</Foo>
</PropertyGroup>
<Target Name="PrintFoo">
<Message Text="Foo=$(Foo)" Importance="High" />
</Target>
</Project> If you invoke the % msbuild -nologo -v:m x.targets -t:PrintFoo -p:Foo=Override
Foo=Override Similarly, if we instead "set and clear" the property: <PropertyGroup>
<Foo>Default</Foo>
<Foo/>
</PropertyGroup> Then the "default" invocation sees an empty string: % msbuild -nologo -v:m x.targets -t:PrintFoo
Foo= while the above "set an override" version continues to show the override value: % msbuild -nologo -v:m x.targets -t:PrintFoo -p:Foo=Override
Foo=Override If you build
further emphasizing that the property cannot be changed. Solution/Workaround: If you update |
I tried you MSBuild commands and the builld output also contains I realized that something is causing the IDE to pass AndroidNdkDirectory parameter to MSBuild even though it's not explicitly set in the code. And now the build output correctly shows BTW. Setting AndroidNdkDirectory in .csproj does nothing when building from IDE, because it looks that this value is override anyway from IDE settings and pass as parameter to MSBuild. @jonpryor @grendello Thank you for your time investigating the issue. |
With support for Classic Xamarin.Android ended May 1st, 2024, this issue is likely no longer relevant. If this still persists in .NET 8+, please open a new issue with updated information based on |
Android application type
Classic Xamarin.Android (MonoAndroid12.0, etc.)
Affected platform version
Xamarin.Android 13.1.0.1
Description
Our application started to crashing on start recently.
During investingation on our side, we found out, that the only change we recently made is change Xamarin.Android package from 13.0.0.0 to 13.1.0.1.
The app is crashing only when built in release mode and archived as .apk or .aab.
The behaviour is the same, regardless of the platform where the app has been built (Windows, Mac, Azure DevOps hosted agent).
Our configuration:
As we are open source, I have prepared a branch with smallest possible project, where you can reproduce the issue:
https://github.com/bcc-code/bmm-app/tree/crash-on-start
I'm also attaching logcat with crash description.
I'm open to share more information if needed.
Steps to Reproduce
Did you find any workaround?
Downgrading Xamarin.Android to 13.0.0.0
Relevant log output
The text was updated successfully, but these errors were encountered: