Share via

Can I remove my proguard.cfg file from my Android project?

Kim Strasser 2,416 Reputation points
2026-03-29T10:28:40.01+00:00

I´m not sure if I can remove my proguard.cfg file from my Android project:


-dontobfuscate

-dontwarn com.google.android.gms.**
-keep class com.google.android.gms.** { *; }
-keep class com.google.firebase.** { *; }

-ignorewarnings

Is this file still necessary in Debug or Release mode? Will my Android project still work when I remove the file?

My .csproj file:

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>net10.0-android36.1</TargetFramework>
    <SupportedOSPlatformVersion>31.0</SupportedOSPlatformVersion>
    <OutputType>Exe</OutputType>
    <ApplicationId>com.companyname.MyProjectAndroid</ApplicationId>
    <ApplicationVersion>10</ApplicationVersion>
    <ApplicationDisplayVersion>1.0</ApplicationDisplayVersion>
    <!-- Signing -->
    <AndroidKeyStore>true</AndroidKeyStore>
    <AndroidSigningKeyStore>mykeystore.keystore</AndroidSigningKeyStore>
    <AndroidSigningKeyAlias>mykeystore</AndroidSigningKeyAlias>
    <AndroidSigningStorePass>...</AndroidSigningStorePass>
    <AndroidSigningKeyPass>...</AndroidSigningKeyPass>
    <!-- Architecture (keep only what you need) -->
    <RuntimeIdentifiers>android-arm64</RuntimeIdentifiers>
    <!-- Linking (safe baseline) -->
    <AndroidLinkMode>SdkOnly</AndroidLinkMode>
    <DebugType>portable</DebugType>
    <DebugSymbols>true</DebugSymbols>
  </PropertyGroup>
 <PropertyGroup Condition="'$(Configuration)'=='Release'">
    <AndroidGenerateNativeDebugSymbols>true</AndroidGenerateNativeDebugSymbols>
    <AndroidStripNativeDebugSymbols>true</AndroidStripNativeDebugSymbols>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)'=='Debug'">
    <RuntimeIdentifiers>android-arm64;android-x64</RuntimeIdentifiers>
    <EmbedAssembliesIntoApk>true</EmbedAssembliesIntoApk>
  </PropertyGroup>
    <ItemGroup>
    <None Remove="google-services.json" />
  </ItemGroup>
  <ItemGroup>
    <GoogleServicesJson Include="google-services.json" />
  </ItemGroup>
  <ItemGroup>
    <!-- Exclude duplicate JVM packages to resolve D8 compilation conflicts with Android variants -->
    <PackageReference Include="Xamarin.AndroidX.Compose.Runtime.Annotation.Jvm" Version="1.10.4.1" ExcludeAssets="all" />
    <PackageReference Include="Xamarin.AndroidX.Datastore.Preferences.Core.Jvm" Version="1.2.0.2" ExcludeAssets="all" />
    <PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.2" />
    <PackageReference Include="Microsoft.Maui.Controls" Version="10.0.51" />
    <PackageReference Include="Microsoft.Maui.Core" Version="10.0.51" />
    <PackageReference Include="Microsoft.Maui.Essentials" Version="10.0.51" />
    <PackageReference Include="MonoGame.Content.Builder.Task" Version="3.8.4.1" />
    <PackageReference Include="MonoGame.Framework.Android" Version="3.8.4.1" />
    <PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
    <PackageReference Include="PlayFabAllSDK" Version="1.220.260313" />
    <PackageReference Include="Plugin.InAppBilling" Version="10.0.0" />
    <PackageReference Include="Plugin.MediaManager" Version="1.2.2" />
    <PackageReference Include="Xamarin.AndroidX.Activity" Version="1.12.4.1" />
    <PackageReference Include="Xamarin.AndroidX.Activity.Ktx" Version="1.12.4.1" />
    <PackageReference Include="Xamarin.AndroidX.Collection.Jvm" Version="1.5.0.5" />
    <PackageReference Include="Xamarin.AndroidX.Collection.Ktx" Version="1.5.0.5" />
    <PackageReference Include="Xamarin.AndroidX.Core.SplashScreen" Version="1.2.0.2" />
    <PackageReference Include="Xamarin.AndroidX.Fragment.Ktx" Version="1.8.9.2" />
    <PackageReference Include="Xamarin.AndroidX.Lifecycle.LiveData" Version="2.10.0.2" />
    <PackageReference Include="Xamarin.AndroidX.Lifecycle.LiveData.Core" Version="2.10.0.2" />
    <PackageReference Include="Xamarin.AndroidX.Lifecycle.LiveData.Core.Ktx" Version="2.10.0.2" />
    <PackageReference Include="Xamarin.AndroidX.Lifecycle.Process" Version="2.10.0.2" />
    <PackageReference Include="Xamarin.AndroidX.Lifecycle.Runtime" Version="2.10.0.2" />
    <PackageReference Include="Xamarin.AndroidX.Lifecycle.Runtime.Android" Version="2.10.0.2" />
    <PackageReference Include="Xamarin.AndroidX.Lifecycle.Runtime.Ktx" Version="2.10.0.2" />
    <PackageReference Include="Xamarin.AndroidX.Lifecycle.Runtime.Ktx.Android" Version="2.10.0.2" />
    <PackageReference Include="Xamarin.AndroidX.Lifecycle.ViewModel.Ktx" Version="2.10.0.2" />
    <PackageReference Include="Xamarin.AndroidX.Lifecycle.ViewModelSavedState" Version="2.10.0.2" />
    <PackageReference Include="Xamarin.AndroidX.Preference" Version="1.2.1.17" />
    <PackageReference Include="Xamarin.AndroidX.SavedState.SavedState.Ktx" Version="1.4.0.2" />
    <PackageReference Include="Xamarin.Firebase.Messaging" Version="125.0.1.2" />
    <PackageReference Include="Xamarin.Google.Guava" Version="33.5.0.2" />
    <PackageReference Include="Xamarin.GooglePlayServices.Base" Version="118.10.0.1" />
  </ItemGroup>
  <Target Name="RestoreDotnetTools" BeforeTargets="Restore">
    <Message Text="Restoring dotnet tools" Importance="High" />
    <Exec Command="dotnet tool restore" />
  </Target>
  <Import Project="..\FarseerPhysicsCode\FarseerPhysicsCode.projitems" Label="Shared" />
  <Import Project="..\FarseerPhysicsDebug\FarseerPhysicsDebug.projitems" Label="Shared" />
  <Import Project="..\SharedCode\SharedCode.projitems" Label="Shared" />
</Project>

Screenshot 2026-03-29 120748

Screenshot 2026-03-29 120841
Screenshot 2026-03-29 120941
Screenshot 2026-03-29 121020
Screenshot 2026-03-29 121048

Developer technologies | .NET | .NET MAUI
0 comments No comments

Answer accepted by question author
  1. Nancy Vo (WICLOUD CORPORATION) 2,655 Reputation points Microsoft External Staff Moderator
    2026-03-30T04:50:52.7233333+00:00

    Hi @Kim Strasser ,

    Thanks for your question.

    In Debug mode, proguard.cfg is usually not used. ProGuard only runs if code shrinking is enabled. By default, shrinking is something you turn on for release, not debug (base on Enable app optimization with R8).

    While this is a non-Microsoft link, it’s official android documentation and is safe to visit.

    When you build your Android app in Release mode, Android uses a tool called ProGuard to:

    1. Make your app smaller.
    2. Make it faster.
    3. Obfuscate the code so it's harder for other people to steal or understand your game logic.
    • If your app builds and runs fine in Release without any crashes → you probably don’t need a custom proguard.cfg file.
    • If you start seeing strange crashes only in Release builds, then you need to add keep rules inside proguard.cfg.

    I hope this addresses your question. If this response was helpful, please consider following the guidance to provide feedback.

    1 person found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. Q&A Assist
    2026-03-29T10:29:00.37+00:00
    AI generated content. This question contains an answer created with AI from Q&A Assist. Learn more

    The proguard.cfg file is only used when ProGuard is enabled via the corresponding MSBuild properties and build items.

    From the build items documentation, ProGuard configuration files are honored only when:

    • They are included in the project with the ProguardConfiguration build action, and
    • The $(EnableProguard) MSBuild property is set to True.

    “Files with a ProguardConfiguration build action contain options which are used to control proguard behavior… These files are ignored unless the $(EnableProguard) MSBuild property is True.”

    In addition, ProGuard is no longer supported with the D8 compiler; only R8 is supported. When a project is configured to use D8 with ProGuard, build errors XA1011/XA1027/XA1028 are raised, and the guidance is to remove the old ProGuard settings and switch to R8:

    • Set the Code shrinker to r8 (or AndroidLinkTool = r8).
    • Remove <EnableProguard> / <AndroidEnableProguard> and any ProGuard-specific configuration.

    Given that modern .NET for Android projects should be using R8, the ProGuard configuration file is not required for either Debug or Release as long as ProGuard is not enabled. The project will build and run without it; if ProGuard is disabled (or not supported), the file is ignored.

    If the project still has any of the old ProGuard properties (<EnableProguard>, <AndroidEnableProguard>, or AndroidLinkTool set to proguard), those should be removed, and the ProGuard config file can be deleted.


    References:

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.