@@ -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 }
0 commit comments