Skip to content
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

Issues Building Android Release version MAUI #155

Open
Pmr-precure opened this issue Oct 31, 2024 · 5 comments
Open

Issues Building Android Release version MAUI #155

Pmr-precure opened this issue Oct 31, 2024 · 5 comments
Assignees
Labels
bug Something isn't working needmoreinfo

Comments

@Pmr-precure
Copy link

Hi,

We cant build our release version. Here is our config:
image

image
image

Not sure whats going on. If we remove the package then we got no issues. Hope you can help.

@Pmr-precure
Copy link
Author

And of cause if we disable R8 then it runs fine.

@ksidirop-laerdal
Copy link
Collaborator

ksidirop-laerdal commented Nov 4, 2024

We've run some tests based on your feedback:

  • We run a sample MAUI app with the settings you indicated in the .csproj and we could replicate the error you're seeing.

  • Rebuilding the nuget using r8 doesn't seem to solve the issue. Same error occurs when trying to build the application that uses the Android nuget.

        <AndroidDexTool>d8</AndroidDexTool>
        <AndroidLinkTool>r8</AndroidLinkTool>
        <AndroidEnableDesugar>True</AndroidEnableDesugar>
        <AndroidEnableProguard>True</AndroidEnableProguard>
        <AndroidEnableMultiDex>True</AndroidEnableMultiDex>
  • By the looks of it R8 is not inspiring confidence in microsoft just yet for them to make it the default option:

https://github.com/dotnet/android/blob/main/Documentation/guides/D8andR8.md#so-how-do-developers-use-it-what-are-sensible-msbuild-property-defaults

I will look further into this but in the meantime I take it that if you turn off R8 (as you already mentioned) and let the build system fallback to using 'proguard' or whatever then the resulting Android application runs acceptably right? Is there any problem in that regard?

@ksidirop-laerdal ksidirop-laerdal self-assigned this Nov 4, 2024
@ksidirop-laerdal ksidirop-laerdal added bug Something isn't working needmoreinfo labels Nov 4, 2024
@Pmr-precure
Copy link
Author

We've run some tests based on your feedback:

  • We run a sample MAUI app with the settings you indicated in the .csproj and we could replicate the error you're seeing.
  • Rebuilding the nuget using r8 doesn't seem to solve the issue. Same error occurs when trying to build the application that uses the Android nuget.
        <AndroidDexTool>d8</AndroidDexTool>
        <AndroidLinkTool>r8</AndroidLinkTool>
        <AndroidEnableDesugar>True</AndroidEnableDesugar>
        <AndroidEnableProguard>True</AndroidEnableProguard>
        <AndroidEnableMultiDex>True</AndroidEnableMultiDex>
  • By the looks of it R8 is not inspiring confidence in microsoft just yet for them to make it the default option:

https://github.com/dotnet/android/blob/main/Documentation/guides/D8andR8.md#so-how-do-developers-use-it-what-are-sensible-msbuild-property-defaults

I will look further into this but in the meantime I take it that if you turn off R8 (as you already mentioned) and let the build system fallback to using 'proguard' or whatever then the resulting Android application runs acceptably right? Is there any problem in that regard?

Hi,

I managed to build the project with R8 adding this to the proguard.cfg

-keep class com.laerdal.mcumgr.** { *; }
-keepattributes Annotation, Signature, EnclosingMethod, InnerClasses

@ksidirop-laerdal
Copy link
Collaborator

I guess you mean to say that this was added in the proguard.cfg of your application right? (or did you tweak the proguard.cfg of the Laerdal.McuMgr java-lib itself?)

-keep class com.laerdal.mcumgr.** { *; }
-keepattributes Annotation, Signature, EnclosingMethod, InnerClasses

Appreciate the follow up info.

@Pmr-precure
Copy link
Author

I guess you mean to say that this was added in the proguard.cfg of your application right? (or did you tweak the proguard.cfg of the Laerdal.McuMgr java-lib itself?)

-keep class com.laerdal.mcumgr.** { *; }
-keepattributes Annotation, Signature, EnclosingMethod, InnerClasses

Appreciate the follow up info.

No no our application :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needmoreinfo
Projects
None yet
Development

No branches or pull requests

2 participants