Skip to content

Commit 5424da2

Browse files
committed
build aab
1 parent 7a1ab5d commit 5424da2

3 files changed

Lines changed: 12 additions & 5 deletions

File tree

Assets/AndroidIl2cppPatchDemo/Editor/AndroidBuilder.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ public static bool ExportGradleProject()
126126
string[] levels = new string[] { "Assets/AndroidIl2cppPatchDemo/Scene/0.unity" };
127127
BuildOptions options = BuildOptions.None;
128128
EditorUserBuildSettings.exportAsGoogleAndroidProject = true;
129+
EditorUserBuildSettings.buildAppBundle = true;
129130
if (Directory.Exists(ANDROID_EXPORT_PATH)) { FileUtil.DeleteFileOrDirectory(ANDROID_EXPORT_PATH);}
130131
Directory.CreateDirectory(ANDROID_EXPORT_PATH);
131132
try
@@ -328,10 +329,13 @@ public static bool GenerateBuildScripts()
328329
string keystoreDir = PROJECT_DIR + "/AndroidKeystore";
329330
if (!Directory.Exists(keystoreDir)) { Directory.CreateDirectory(keystoreDir); }
330331
string keystoreFile = keystoreDir + "/test.keystore";
332+
StringBuilder genKeyCmd = new StringBuilder();
333+
string keytoolPath = jdkPath + "/bin/keytool.exe";
334+
string genKeyParam = "-genkey -alias test -validity 1000 -keyalg RSA -keystore " + keystoreFile + " -dname \"CN = Test, OU = Test, O = Test, L = Test, S = Test, C = Test\" -keysize 4096 -storepass testtest -keypass testtest";
335+
genKeyCmd.AppendFormat("\"{0}\" {1}\n", keytoolPath, genKeyParam);
336+
File.WriteAllText(ANDROID_EXPORT_PATH + "/gen_key.bat", genKeyCmd.ToString());
331337
if (!File.Exists(keystoreFile))
332338
{
333-
string keytoolPath = jdkPath + "/bin/keytool.exe";
334-
string genKeyParam = "-genkey -alias test -validity 1000 -keyalg RSA -keystore " + keystoreFile + " -dname \"CN = Test, OU = Test, O = Test, L = Test, S = Test, C = Test\" -keysize 4096 -storepass testtest -keypass testtest";
335339
if (!Exec(keytoolPath, genKeyParam))
336340
{
337341
Debug.LogError("exec failed:" + keytoolPath + " " + genKeyParam);
@@ -360,6 +364,9 @@ public static bool GenerateBuildScripts()
360364
allCmd.AppendFormat("explorer.exe {0} \n\n", ANDROID_EXPORT_PATH.Replace("//", "/").Replace("/", "\\"));
361365
allCmd.AppendFormat("@echo on\n\n"); //explorer as the last line wont return success, so...
362366
File.WriteAllText(ANDROID_EXPORT_PATH + "/build_apk.bat", allCmd.ToString());
367+
File.WriteAllText(ANDROID_EXPORT_PATH + "/build_aab.bat", allCmd.ToString()
368+
.Replace("assembleRelease", "bundleRelease")
369+
.Replace(".apk", ".aab"));
363370

364371
return true;
365372
}

ProjectSettings/ProjectVersion.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
m_EditorVersion: 2022.3.16f1
2-
m_EditorVersionWithRevision: 2022.3.16f1 (d2c21f0ef2f1)
1+
m_EditorVersion: 2022.3.19f1
2+
m_EditorVersionWithRevision: 2022.3.19f1 (244b723c30a6)

build_demo_apk_2022.3.cmd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
rem global
2-
SET UnityBin="C:\Program Files\Unity\Hub\Editor\2022.3.16f1\Editor\Unity.exe"
2+
SET UnityBin="C:\Program Files\Unity\Hub\Editor\2022.3.19f1\Editor\Unity.exe"
33

44
rem prepare build cmd
55
SET ScriptPath=%~dp0

0 commit comments

Comments
 (0)