1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- #if UNITY_ANDROID
- using UnityEngine;
- using UnityEditor.Android;
- using System.IO;
- using System.Text;
- namespace RenderHeads.Media.AVProVideo.Editor
- {
- public class PostProcessBuild_Android : IPostGenerateGradleAndroidProject
- {
- public int callbackOrder { get { return 1; } }
- public void OnPostGenerateGradleAndroidProject( string path )
- {
- GradleProperty( path );
- }
- private void GradleProperty( string path )
- {
- #if UNITY_2020_1_OR_NEWER || UNITY_2020_OR_NEWER
-
-
-
- Debug.Log("[AVProVideo] Post-processing Android project: patching gradle.properties");
- StringBuilder stringBuilder = new StringBuilder();
-
- string filePath = Path.Combine( path, "..", "gradle.properties" );
- if( File.Exists( filePath ) )
- {
-
- string[] allLines = File.ReadAllLines( filePath );
- foreach( string line in allLines )
- {
- if( line.Length > 0 )
- {
-
- if ( !line.Contains( "android.enableDexingArtifactTransform" ) )
- {
- stringBuilder.AppendLine( line );
- }
- }
- }
- }
-
- stringBuilder.AppendLine( "android.enableDexingArtifactTransform=false" );
-
- File.WriteAllText( filePath, stringBuilder.ToString() );
- #endif
- }
- }
- }
- #endif // UNITY_ANDROID
|