diff --git a/src/Xamarin.Android.Build.Tasks/Resources/proguard_xamarin.cfg b/src/Xamarin.Android.Build.Tasks/Resources/proguard_xamarin.cfg index 4629e018dd5..914ef686ac2 100644 --- a/src/Xamarin.Android.Build.Tasks/Resources/proguard_xamarin.cfg +++ b/src/Xamarin.Android.Build.Tasks/Resources/proguard_xamarin.cfg @@ -4,7 +4,7 @@ -keep class android.support.multidex.MultiDexApplication { (); } -keep class com.xamarin.java_interop.** { *; (); } --keep class mono.MonoRuntimeProvider { *; (...); } +-keep class mono.MonoRuntimeProvider* { *; (...); } -keep class mono.MonoPackageManager { *; (...); } -keep class mono.MonoPackageManager_Resources { *; (...); } -keep class mono.android.** { *; (...); } diff --git a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/BuildTest.cs b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/BuildTest.cs index f2a6fca49b3..14f66281616 100644 --- a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/BuildTest.cs +++ b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/BuildTest.cs @@ -3607,6 +3607,19 @@ public void Desugar ([Values (true, false)] bool isRelease, [Values ("dx", "d8") DexTool = dexTool, LinkTool = linkTool, }; + + //Add a BroadcastReceiver + proj.Sources.Add (new BuildItem.Source ("MyReceiver.cs") { + TextContent = () => @" +using Android.Content; + +[BroadcastReceiver(Process = "":remote"", Name = ""foo.MyReceiver"")] +public class MyReceiver : BroadcastReceiver +{ + public override void OnReceive(Context context, Intent intent) { } +}", + }); + //Okhttp and Okio //https://github.com/square/okhttp //https://github.com/square/okio @@ -3691,6 +3704,8 @@ public void foo() var dexFile = builder.Output.GetIntermediaryPath (Path.Combine ("android", "bin", "classes.dex")); FileAssert.Exists (dexFile); Assert.IsTrue (DexUtils.ContainsClass (className, dexFile, AndroidSdkPath), $"`{dexFile}` should include `{className}`!"); + className = "Lmono/MonoRuntimeProvider_1;"; + Assert.IsTrue (DexUtils.ContainsClass (className, dexFile, AndroidSdkPath), $"`{dexFile}` should include `{className}`!"); } }