maui: HttpClient in AndroidApp crash again
Description
Crash occurs when httpclient is used to access the API,No crash in previous versions。
Steps to Reproduce
use
dotnet publish -f net6.0-android -c Release
build apk, Then run the app on your phone
If httpclient is used, it will crash and try catch will not catch errors
Version with bug
Release Candidate 1 (current)
Last version that worked well
Unknown/Other
Affected platforms
Android
Affected platform versions
Android11
Did you find any workaround?
I found a strange step to solve this problem.
1, pack apk.
2, remove <uses-permission android:name="android.permission.INTERNET" /> in AndroidManifest.xml (Maybe any other setting)
3, pack apk again
4. add <uses-permission android:name="android.permission.INTERNET" /> in AndroidManifest.xml
5. pack apk again
6. if the packaged apk becomes smaller, the bug may be fixed
Relevant log output
No response
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 23 (11 by maintainers)
Sorry for the delay. But I can confirm that it seems to be working just fine in RC 3. No need to add
<RunAOTCompilation>False</RunAOTCompilation>@PieEatingNinjas can you try MAUI RC 3 that just shipped? dotnet/runtime 6.0.5 did not ship until today as well.
@RedChops so if you’re seeing this in a Debug build, then
RunAOTCompilation=falsewon’t help, because it is only enabled during Release builds by default.I filed a new issue to track this here: https://github.com/xamarin/xamarin-android/issues/6961
@ssccinng seems to be the problem we solved. So closing for now, thanks! MAUI RC 2 should hopefully work for you, and I’d use the workaround for now.
It seems that this works. The app size is the same as that after my special steps above