public static void OnPostProcessBuild(BuildTarget target, string path) { if (target == BuildTarget.Android) { // Only allow builds for Gradle for Android // Native video surfaces are broken with internal builds AndroidBuildSystem currentBuildSystem = EditorUserBuildSettings.androidBuildSystem; if (currentBuildSystem != AndroidBuildSystem.Gradle) { throw new PlatformNotSupportedException("Audience Network SDK must be built with Gradle. " + "Switch build system to \"Gradle (New)\" under Build Settings."); } var defaultIdentifier = "com.Company.ProductName"; // Find application identifier (backwards compatible prior to Unity 5.6) if (Utility.GetApplicationIdentifier() == defaultIdentifier) { Debug.LogError("The default Unity Bundle Identifier (com.Company.ProductName) will not work correctly."); } if (!ManifestMod.CheckManifest()) { // If something is wrong with the Android Manifest, try to regenerate it to fix it for the next build. ManifestMod.GenerateManifest(); } } else if (target == BuildTarget.iOS) { ConfigurePluginPlatforms(); } }
private static void RegenerateManifest() { bool updateManifest = EditorUtility.DisplayDialog(title, "Are you sure you want to regenerate your Android Manifest.xml?", "Okay", "Cancel"); if (updateManifest) { ManifestMod.GenerateManifest(); EditorUtility.DisplayDialog(title, "Android Manifest updated. \n \n If interstitial ads still throw ActivityNotFoundException, " + "you may need to copy the generated manifest at " + ManifestMod.AndroidManifestPath + " to /Assets/Plugins/Android.", "Okay"); } }
public static void OnPostProcessBuild(BuildTarget target, string path) { if (target == BuildTarget.Android) { // The default Bundle Identifier for Unity does magical things that causes bad stuff to happen if (PlayerSettings.applicationIdentifier == "com.Company.ProductName") { Debug.LogError("The default Unity Bundle Identifier (com.Company.ProductName) will not work correctly."); } if (!ManifestMod.CheckManifest()) { // If something is wrong with the Android Manifest, try to regenerate it to fix it for the next build. ManifestMod.GenerateManifest(); } } else if (target == BuildTarget.iOS) { ConfigurePluginPlatforms(); } }
// Exporting the *.unityPackage for Asset store public static bool ExportPackage() { // Check that SDKs are built bool iOSFound = File.Exists(AudienceNetworkPluginiOSPath); bool androidFound = File.Exists(AudienceNetworkPluginAndroidPath); if (!iOSFound || !androidFound) { Debug.Log("Exporting failed, no AN SDK build found. Found SDKS - iOS: " + iOSFound + " Android: " + androidFound); return(false); } try { AssetDatabase.DeleteAsset(PluginsPath + "Android/AndroidManifest.xml"); AssetDatabase.DeleteAsset(PluginsPath + "Android/AndroidManifest.xml.meta"); AssetDatabase.DeleteAsset(AudienceNetworkPluginsPath + "Android/AndroidManifest.xml"); AssetDatabase.DeleteAsset(AudienceNetworkPluginsPath + "Android/AndroidManifest.xml.meta"); string[] facebookFiles = Directory.GetFiles(AudienceNetworkPath, "*.*", SearchOption.AllDirectories); string[] pluginsFiles = Directory.GetFiles(AudienceNetworkPluginsPath, "*.*", SearchOption.AllDirectories); string[] files = new string[facebookFiles.Length + pluginsFiles.Length]; facebookFiles.CopyTo(files, 0); pluginsFiles.CopyTo(files, facebookFiles.Length); AssetDatabase.ExportPackage( files, UnityPackagePath, ExportPackageOptions.IncludeDependencies | ExportPackageOptions.Recurse); } finally { // regenerate the manifest ManifestMod.GenerateManifest(); } return(true); }
public static void OnPostProcessBuild(BuildTarget target, string path) { // Unity renamed build target from iPhone to iOS in Unity 5, this keeps both versions happy if (target.ToString() == "iOS" || target.ToString() == "iPhone") { UpdatePlist(path); } if (target == BuildTarget.Android) { // The default Bundle Identifier for Unity does magical things that causes bad stuff to happen if (PlayerSettings.bundleIdentifier == "com.Company.ProductName") { Debug.LogError("The default Unity Bundle Identifier (com.Company.ProductName) will not work correctly."); } if (!ManifestMod.CheckManifest()) { // If something is wrong with the Android Manifest, try to regenerate it to fix it for the next build. ManifestMod.GenerateManifest(); } } }
public static void OnPostProcessBuild(BuildTarget target, string path) { if (target == BuildTarget.Android) { var defaultIdentifier = "com.Company.ProductName"; // Find application identifier (backwards compatible prior to Unity 5.6) if (Utility.GetApplicationIdentifier() == defaultIdentifier) { Debug.LogError("The default Unity Bundle Identifier (com.Company.ProductName) will not work correctly."); } if (!ManifestMod.CheckManifest()) { // If something is wrong with the Android Manifest, try to regenerate it to fix it for the next build. ManifestMod.GenerateManifest(); } } else if (target == BuildTarget.iOS) { ConfigurePluginPlatforms(); } }