public XamarinAndroidApplicationProject() { SetProperty("AndroidApplication", "True"); SetProperty("AndroidResgenClass", "Resource"); SetProperty("AndroidResgenFile", () => "Resources\\Resource.designer" + Language.DefaultExtension); SetProperty("AndroidManifest", "Properties\\AndroidManifest.xml"); SetProperty(DebugProperties, "AndroidLinkMode", "None"); SetProperty(ReleaseProperties, "AndroidLinkMode", "SdkOnly"); AndroidManifest = default_android_manifest; LayoutMain = default_layout_main; StringsXml = default_strings_xml; PackageName = PackageName ?? string.Format("{0}.{0}", ProjectName); OtherBuildItems.Add(new BuildItem.NoActionResource("Properties\\AndroidManifest.xml") { TextContent = () => AndroidManifest.Replace("${PROJECT_NAME}", ProjectName). Replace("${PACKAGENAME}", PackageName) }); AndroidResources.Add(new AndroidItem.AndroidResource("Resources\\layout\\Main.axml") { TextContent = () => LayoutMain }); AndroidResources.Add(new AndroidItem.AndroidResource("Resources\\values\\Strings.xml") { TextContent = () => StringsXml.Replace("${PROJECT_NAME}", ProjectName) }); Sources.Add(new BuildItem.Source(() => "MainActivity" + Language.DefaultExtension) { TextContent = () => ProcessSourceTemplate(MainActivity ?? DefaultMainActivity) }); }
public XamarinAndroidApplicationProject(string debugConfigurationName = "Debug", string releaseConfigurationName = "Release", [CallerMemberName] string packageName = "") : base(debugConfigurationName, releaseConfigurationName) { if (Builder.UseDotNet) { SetProperty(KnownProperties.OutputType, "Exe"); SetProperty("XamarinAndroidSupportSkipVerifyVersions", "True"); SetProperty("_FastDeploymentDiagnosticLogging", "True"); // Workaround for AndroidX, see: https://github.com/xamarin/AndroidSupportComponents/pull/239 Imports.Add(new Import(() => "Directory.Build.targets") { TextContent = () => @"<Project> <PropertyGroup> <VectorDrawableCheckBuildToolsVersionTaskBeforeTargets /> </PropertyGroup> </Project>" }); } else { SetProperty("_FastDeploymentDiagnosticLogging", "True"); SetProperty("AndroidApplication", "True"); SetProperty("AndroidResgenClass", "Resource"); SetProperty("AndroidResgenFile", () => "Resources\\Resource.designer" + Language.DefaultDesignerExtension); SetProperty("AndroidManifest", "Properties\\AndroidManifest.xml"); SetProperty(DebugProperties, "AndroidLinkMode", "None"); SetProperty(ReleaseProperties, "AndroidLinkMode", "SdkOnly"); SetProperty(DebugProperties, KnownProperties.EmbedAssembliesIntoApk, "False", "'$(EmbedAssembliesIntoApk)' == ''"); SetProperty(ReleaseProperties, KnownProperties.EmbedAssembliesIntoApk, "True", "'$(EmbedAssembliesIntoApk)' == ''"); } AndroidManifest = default_android_manifest; TargetSdkVersion = AndroidSdkResolver.GetMaxInstalledPlatform().ToString(); LayoutMain = default_layout_main; StringsXml = default_strings_xml; PackageName = $"com.xamarin.{(packageName ?? ProjectName).ToLower ()}"; JavaPackageName = JavaPackageName ?? PackageName.ToLowerInvariant(); OtherBuildItems.Add(new BuildItem.NoActionResource("Properties\\AndroidManifest.xml") { TextContent = ProcessManifestTemplate, }); AndroidResources.Add(new AndroidItem.AndroidResource("Resources\\layout\\Main.axml") { TextContent = () => LayoutMain }); AndroidResources.Add(new AndroidItem.AndroidResource("Resources\\values\\Strings.xml") { TextContent = () => StringsXml.Replace("${PROJECT_NAME}", ProjectName) }); Sources.Add(new BuildItem.Source(() => "MainActivity" + Language.DefaultExtension) { TextContent = () => ProcessSourceTemplate(MainActivity ?? DefaultMainActivity) }); }
public XamarinAndroidLibraryProject() { SetProperty("AndroidApplication", "False"); AndroidResources.Add(new AndroidItem.AndroidResource("Resources\\values\\Strings.xml") { TextContent = () => StringsXml.Replace("${PROJECT_NAME}", ProjectName) }); StringsXml = default_strings_xml; }
public XamarinAndroidLibraryProject(string debugConfigurationName = "Debug", string releaseConfigurationName = "Release") : base(debugConfigurationName, releaseConfigurationName) { SetProperty("AndroidApplication", "False"); AndroidResources.Add(new AndroidItem.AndroidResource("Resources\\values\\Strings.xml") { TextContent = () => StringsXml.Replace("${PROJECT_NAME}", ProjectName) }); StringsXml = default_strings_xml; }
public MSBuildSdkExtrasProject() { Sdk = "MSBuild.Sdk.Extras/2.0.41"; Sources.Add(new BuildItem.Source("Class1.cs") { TextContent = () => "public class Class1 { }" }); Sources.Add(new AndroidItem.AndroidResource("Resources\\values\\Strings.xml") { TextContent = () => StringsXml.Replace("${PROJECT_NAME}", ProjectName) }); StringsXml = XamarinAndroidLibraryProject.default_strings_xml; TargetFrameworks = "MonoAndroid10.0"; }
public XamarinAndroidLibraryProject(string debugConfigurationName = "Debug", string releaseConfigurationName = "Release") : base(debugConfigurationName, releaseConfigurationName) { if (!Builder.UseDotNet) { SetProperty("AndroidApplication", "False"); SetProperty("AndroidResgenFile", Path.Combine("Resources", "Resource.designer.cs")); } AndroidResources.Add(new AndroidItem.AndroidResource("Resources\\values\\Strings.xml") { TextContent = () => StringsXml.Replace("${PROJECT_NAME}", ProjectName) }); StringsXml = default_strings_xml; }
public XamarinAndroidApplicationProject(string debugConfigurationName = "Debug", string releaseConfigurationName = "Release") : base(debugConfigurationName, releaseConfigurationName) { SetProperty("AndroidApplication", "True"); SetProperty("AndroidResgenClass", "Resource"); SetProperty("AndroidResgenFile", () => "Resources\\Resource.designer" + Language.DefaultDesignerExtension); SetProperty("AndroidManifest", "Properties\\AndroidManifest.xml"); SetProperty(DebugProperties, "AndroidLinkMode", "None"); SetProperty(ReleaseProperties, "AndroidLinkMode", "SdkOnly"); SetProperty(DebugProperties, KnownProperties.EmbedAssembliesIntoApk, "False", "'$(EmbedAssembliesIntoApk)' == ''"); SetProperty(ReleaseProperties, KnownProperties.EmbedAssembliesIntoApk, "True", "'$(EmbedAssembliesIntoApk)' == ''"); AndroidManifest = default_android_manifest; LayoutMain = default_layout_main; StringsXml = default_strings_xml; PackageName = PackageName ?? string.Format("{0}.{0}", ProjectName); JavaPackageName = JavaPackageName ?? PackageName.ToLowerInvariant(); OtherBuildItems.Add(new BuildItem.NoActionResource("Properties\\AndroidManifest.xml") { TextContent = () => AndroidManifest.Replace("${PROJECT_NAME}", ProjectName). Replace("${PACKAGENAME}", PackageName) }); AndroidResources.Add(new AndroidItem.AndroidResource("Resources\\layout\\Main.axml") { TextContent = () => LayoutMain }); AndroidResources.Add(new AndroidItem.AndroidResource("Resources\\values\\Strings.xml") { TextContent = () => StringsXml.Replace("${PROJECT_NAME}", ProjectName) }); Sources.Add(new BuildItem.Source(() => "MainActivity" + Language.DefaultExtension) { TextContent = () => ProcessSourceTemplate(MainActivity ?? DefaultMainActivity) }); }