Hi,
After enabling the androidX library by setting it to true in the gradle.Template properties file I’m still getting the same error and failed build stating I AndroidX is not enabled, please enable it and try again.
So I tried to put this script, which should ensure androidX is enabled when you try to make a build, into the Editor folder but the same error still occurs:
using System.IO;
using UnityEditor.Android;
using UnityEngine;
public class AndroidPostBuildProcessor : IPostGenerateGradleAndroidProject {
public int callbackOrder {
get {
return 999;
}
}
void IPostGenerateGradleAndroidProject.OnPostGenerateGradleAndroidProject(string path) {
Debug.Log("Bulid path : " + path);
string gradlePropertiesFile = path + "/gradle.properties";
if (File.Exists(gradlePropertiesFile)) {
File.Delete(gradlePropertiesFile);
}
StreamWriter writer = File.CreateText(gradlePropertiesFile);
writer.WriteLine("org.gradle.jvmargs=-Xmx4096M");
writer.WriteLine("android.useAndroidX=true");
writer.WriteLine("android.enableJetifier=true");
writer.Flush();
writer.Close();
}
}is not enabled
Can anyone tell me how to get this to work? There’s not much online about what to do if :
android.useAndroidX=true
android.enableJetifier=true
in the gradle template file doesn’t work. Frustrating!