Firstly, i have a gradleTemplate.properties file with “android.enableR8=MINIFY_WITH_R_EIGHT” in it. When i try to build android, i get an error: Cannot parse project property android.enableR8=" of type ‘class java.lang.String’ as boolean. Expected ‘true’ or ‘false’.
Faced the same issue here. Cannot use Crashlytics with Unity 2022.2.8f1 if I build for Android, meanwhile iOS builds are fine.
Is there any known information on what exactly has to be changed? The documentation states that “templates have been changed” without any particular information on that topic.
I seem to have found a solution to “Android Resolver Repos Start” block not working at all. It’s related to settings.gradle file having PREFER_SETTINGS over PREFER_PROJECT by default in Unity 2022.2. Custom-patching settings.gradle fixed the issues. Add this to a script inside any Editor folder:
public class AndroidSettingsGradleModifier : IPostGenerateGradleAndroidProject
{
public int callbackOrder => 0;
public void OnPostGenerateGradleAndroidProject(string path)
{
path = path.Substring(0, path.Length - 12);
var settingsGradle = System.IO.File.ReadAllText(path + "/settings.gradle");
settingsGradle = settingsGradle.Replace("repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS)", "repositoriesMode.set(RepositoriesMode.PREFER_PROJECT)");
System.IO.File.WriteAllText(path + "/settings.gradle", settingsGradle);
}
}
Thanks a lot, this is working! Well, apk building is still not working but at least I can move forward thanks to you.
Edit: a cleaner way to do that is to tick “Custom Gradle Settings template” in the player settings, then to proceed with the same modification (RepositoriesMode.PREFER_PROJECT) directly within the newly created file (which is at Assets/Plugins/Android/settingsTemplate.gradle)
This is because Gradle 7.2 (I think) changes a lot of things and this changes are destructive.
For anyone struggling more than necessary on this, updating Firebase to the last version (11.0.0 currently) fixes the issue.
I guess that the fix is contained in the last version of the EDM, that is included within this Firebase version (1.2.176).
From the changelog: “Android Resolver - Inject Maven Repo to settingTemplate.gradle from Unity 2022.2+”
I’m still getting “Cannot parse project property android.enableR8=‘MINIFY_WITH_R_EIGHT’ of type ‘class java.lang.String’ as boolean. Expected ‘true’ or ‘false’.” while my gradleTemplate.properties file looks like this
WARNING:The option ‘android.enableR8’ is deprecated. It was removed in version 7.0 of the Android Gradle plugin. Please remove it from gradle.properties.
Keeping it I have this warning, so I guess the right solution is just to delete the “enableR8” entry (at least using Unity 2022.3.10f1 - built-in gradle 7.1.2).
in my case,
‘android.enableR8=MINIFY_WITH_R_EIGHT’
was written as 'android.enableR8=MINIFY_WITH_R_EIGHT ’ , with 2 empty spaces at the end.
deleted them and problem solved