title: How to use D8, R8 in Xamarin.Forms apps for Android?
body: <p>I have just downloaded Vs 2019 pre and it offers more configuration for xamarin android as stated <a href="https://github.com/xamarin/xamarin-android/blob/master/Documentation/guides/D8andR8.md" rel="noreferrer" title="here ">here </a></p>
  
  <p>It suggests to use  as below and it tells that proguard cant be use together with r8 as it is replacement for proguard.</p>
  
  <pre><code>&lt;Project&gt;
      &lt;PropertyGroup&gt;
          &lt;AndroidEnableMultiDex&gt;True&lt;/AndroidEnableMultiDex&gt;
          &lt;AndroidDexTool&gt;d8&lt;/AndroidDexTool&gt;
          &lt;AndroidLinkTool&gt;r8&lt;/AndroidLinkTool&gt;
      &lt;/PropertyGroup&gt;
  &lt;/Project&gt;
  </code></pre>
  
  <p>but I dont really understand how r8 supposed to work? because using proguard I have done a lot of configurations like defining which library, class, function keep. So we dont need any of those? simply set up r8 and go? I attempted already as suggested but i get error that 
  <code>8&gt;R8 : error : Compilation can't be completed because some library classes are missing.</code></p>
  
  <p>Beside that how are those settings effect bundle into native assemblies, AotAssemblies, LLVM etc? can we use together with them. my configuration is as below. But unfortunately it doesnt work. if i remove D8 and R8 it works. I tried using Proguard+D8 only but also doesnt work.</p>
  
  <pre><code>&lt;PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "&gt;
      &lt;Optimize&gt;true&lt;/Optimize&gt;
      &lt;OutputPath&gt;bin\Release\&lt;/OutputPath&gt;
      &lt;DefineConstants&gt;TRACE&lt;/DefineConstants&gt;
      &lt;ErrorReport&gt;prompt&lt;/ErrorReport&gt;
      &lt;WarningLevel&gt;4&lt;/WarningLevel&gt;
      &lt;AndroidUseSharedRuntime&gt;False&lt;/AndroidUseSharedRuntime&gt;
      &lt;DebugType&gt;portable&lt;/DebugType&gt;
      &lt;AndroidLinkMode&gt;Full&lt;/AndroidLinkMode&gt;
      &lt;EmbedAssembliesIntoApk&gt;true&lt;/EmbedAssembliesIntoApk&gt;
      &lt;AndroidCreatePackagePerAbi&gt;true&lt;/AndroidCreatePackagePerAbi&gt;
      &lt;JavaMaximumHeapSize&gt;1G&lt;/JavaMaximumHeapSize&gt;
      &lt;AotAssemblies&gt;true&lt;/AotAssemblies&gt;
      &lt;EnableLLVM&gt;true&lt;/EnableLLVM&gt;
      &lt;AndroidAotAdditionalArguments&gt;no-write-symbols,nodebug&lt;/AndroidAotAdditionalArguments&gt;
      &lt;DebugSymbols&gt;false&lt;/DebugSymbols&gt;
      &lt;BundleAssemblies&gt;true&lt;/BundleAssemblies&gt;
      &lt;AndroidEnableMultiDex&gt;True&lt;/AndroidEnableMultiDex&gt;
      &lt;EnableProguard&gt;false&lt;/EnableProguard&gt;
      &lt;Debugger&gt;Xamarin&lt;/Debugger&gt;
      &lt;AndroidSupportedAbis&gt;armeabi-v7a;x86;x86_64&lt;/AndroidSupportedAbis&gt;
      &lt;AndroidLinkSkip&gt; &lt;/AndroidLinkSkip&gt;
      &lt;AndroidEnableMultipleDex&gt;true&lt;/AndroidEnableMultipleDex&gt;
      &lt;AndroidExplicitCrunch&gt;true&lt;/AndroidExplicitCrunch&gt;
      &lt;AndroidDexTool&gt;d8&lt;/AndroidDexTool&gt;
      &lt;AndroidLinkTool&gt;r8&lt;/AndroidLinkTool&gt;
    &lt;/PropertyGroup&gt;
  </code></pre>
  
  <p>UPDATE:</p>
  
  <p>I removed r8 and enabled proguard. because after reading in general (not only xamarin) r8 is not as mature as proguard. so I let d8 only above configuarion and EnableProguard =true. But i get warning and errors regarding r8 </p>
  
  <pre><code>8&gt;"\myApp.Droid\myApp.Droid.csproj" (Rebuild;BuiltProjectOutputGroup;BuiltProjectOutputGroupDependencies;DebugSymbolsProjectOutputGroup;DebugSymbolsProjectOutputGroupDependencies;DocumentationProjectOutputGroup;DocumentationProjectOutputGroupDependencies;SatelliteDllsProjectOutputGroup;SatelliteDllsProjectOutputGroupDependencies;SGenFilesOutputGroup;SGenFilesOutputGroupDependencies target) (1) -&gt;
  8&gt;(_CompileToDalvikWithD8 target) -&gt; 
  8&gt;  R8 : warning : Missing class: com.amazon.device.messaging.ADMMessageReceiver
  8&gt;  R8 : warning : Missing class: com.google.android.gms.location.LocationListener
  8&gt;  R8 : warning : Missing class: com.amazon.device.messaging.ADMMessageHandlerBase
  8&gt;  R8 : warning : Missing class: com.amazon.device.iap.PurchasingListener
  8&gt;  R8 : warning : Missing class: org.apache.http.client.methods.HttpEntityEnclosingRequestBase
  8&gt;
  8&gt;
  8&gt;"\myApp.Droid\myApp.Droid.csproj" (Rebuild;BuiltProjectOutputGroup;BuiltProjectOutputGroupDependencies;DebugSymbolsProjectOutputGroup;DebugSymbolsProjectOutputGroupDependencies;DocumentationProjectOutputGroup;DocumentationProjectOutputGroupDependencies;SatelliteDllsProjectOutputGroup;SatelliteDllsProjectOutputGroupDependencies;SGenFilesOutputGroup;SGenFilesOutputGroupDependencies target) (1) -&gt;
  8&gt;(_CompileToDalvikWithD8 target) -&gt; 
  8&gt;  R8 : error : Compilation can't be completed because some library classes are missing.
  8&gt;
  8&gt;    45 Warning(s)
  8&gt;    1 Error(s)
  8&gt;
  </code></pre>