diff --git a/src/Xamarin.Android.Build.Tasks/Utilities/ManifestDocument.cs b/src/Xamarin.Android.Build.Tasks/Utilities/ManifestDocument.cs index 9dd676dfc92..30721433687 100644 --- a/src/Xamarin.Android.Build.Tasks/Utilities/ManifestDocument.cs +++ b/src/Xamarin.Android.Build.Tasks/Utilities/ManifestDocument.cs @@ -336,10 +336,12 @@ public IList Merge (TaskLoggingHelper log, TypeDefinitionCache cache, Li if (PackageName == null) PackageName = t.Namespace; - var name = JavaNativeTypeManager.ToJniName (t, cache).Replace ('/', '.'); - var compatName = JavaNativeTypeManager.ToCompatJniName (t, cache).Replace ('/', '.'); - if (((string) app.Attribute (attName)) == compatName) { - app.SetAttributeValue (attName, name); + if (t.IsSubclassOf ("Android.App.Application", cache)) { + (string name, string compatName) = GetNames (t, cache); + if (((string) app.Attribute (attName)) == compatName) { + app.SetAttributeValue (attName, name); + } + continue; } Func generator = GetGenerator (t, cache); @@ -347,6 +349,7 @@ public IList Merge (TaskLoggingHelper log, TypeDefinitionCache cache, Li continue; try { + (string name, string compatName) = GetNames (t, cache); // activity not present: create a launcher for it IFF it has attribute if (!existingTypes.Contains (name) && !existingTypes.Contains (compatName)) { XElement fromCode = generator (t, name, targetSdkVersionValue); @@ -481,6 +484,11 @@ SequencePoint FindSource (IEnumerable methods) } } + (string name, string compatName) GetNames(TypeDefinition type, TypeDefinitionCache cache) => ( + JavaNativeTypeManager.ToJniName (type, cache).Replace ('/', '.'), + JavaNativeTypeManager.ToCompatJniName (type, cache).Replace ('/', '.') + ); + // FIXME: our manifest merger is hacky. // To support complete manifest merger, we will have to implement fairly complicated one, described at // http://tools.android.com/tech-docs/new-build-system/user-guide/manifest-merger