.NET for Android provides open-source bindings of the Android SDK for use with .NET managed languages such as C#
MIT License
1.93k
stars
532
forks
source link
Following up on [#9213](https://github.com/dotnet/android/issues/9213), The information provided in the comment is inaccurate, and this has caused us significant trouble. #9530
In the comment, grendello mentioned that if our customers upgraded to Android 10, native apps would also encounter this issue, and they would then upgrade their signing and verification system. However, in reality, after waiting for our customers to upgrade to Android 10, the native apps are running perfectly fine without encountering any alignment issues. The problem we are facing persists with the application developed using MAUI, just as it did before.
// assemblies must be 16-byte or 4-byte aligned, or Bad Things happen
if (((state.data_offset & 0xf) != 0) || ((state.data_offset & 0x3) != 0)) {
log_fatal (LOG_ASSEMBLY, "Assembly '%s' is located at bad offset %lu within the .apk", entry_name.get (), state.data_offset);
log_fatal (LOG_ASSEMBLY, "You MUST run zipalign on %s to align it on 4 or 16 bytes ", strrchr (state.file_name, '/') + 1);
Helpers::abort_application ();
} The code snippet enforces alignment and forcibly exits when the alignment is incorrect,Could we modify it to avoid forcing the application to exit? While Google enforces alignment requirements, native apps do not forcibly exit in such cases.
Android framework version
net8.0-android
Affected platform version
VS 2022 17.9.0, .NET 8.0.100
Description
In the comment, grendello mentioned that if our customers upgraded to Android 10, native apps would also encounter this issue, and they would then upgrade their signing and verification system. However, in reality, after waiting for our customers to upgrade to Android 10, the native apps are running perfectly fine without encountering any alignment issues. The problem we are facing persists with the application developed using MAUI, just as it did before.
Steps to Reproduce
review Resolving Offset Errors in MAUI 8 Apps Post-Publisher Signing
9213
Did you find any workaround?
// assemblies must be 16-byte or 4-byte aligned, or Bad Things happen if (((state.data_offset & 0xf) != 0) || ((state.data_offset & 0x3) != 0)) { log_fatal (LOG_ASSEMBLY, "Assembly '%s' is located at bad offset %lu within the .apk", entry_name.get (), state.data_offset); log_fatal (LOG_ASSEMBLY, "You MUST run
zipalign
on %s to align it on 4 or 16 bytes ", strrchr (state.file_name, '/') + 1); Helpers::abort_application (); } The code snippet enforces alignment and forcibly exits when the alignment is incorrect,Could we modify it to avoid forcing the application to exit? While Google enforces alignment requirements, native apps do not forcibly exit in such cases.Relevant log output