Unity Android打包持续集成一次出多个APK问题解决(脚本自动化打包APK)

解决思路:

1、先使用Unity打出Android工程,再使用Android工程进行打包

1)修改CommandBuild.cs

在public static void Build()方法中修改

        {
			locationPathName ="Android_Build";
			buildOption |= BuildOptions.AcceptExternalModificationsToPlayer;
			BuildPipeline.BuildPlayer(ms_scenes, locationPathName, ms_buildTarget, buildOption);
        }

关于BuildOptions.AcceptExternalModificationsToPlayer;配置相关文献查看

https://docs.unity3d.com/ScriptReference/BuildOptions.AcceptExternalModificationsToPlayer.html

Description

Used when building Xcode (iOS) or Eclipse (Android) projects.

On iOS, this setting will append an existing Xcode project. Existing Xcode project setting changes will be preserved. With the IL2CPP scripting backend, this setting will also allow incremental builds of the generated C++ code to work in Xcode.

On Android, this setting will create a new Eclipse project. Existing Eclipse project setting changes will be discarded.

2)再使用gradle命令进行打包

gradle -p ./(Project_Name) assembleRelease

 

2、直接修改CommandBuild.cs打出多个APK

修改CommandBuild.cs支持生成多个APK文件,理论上可行,待研究

你可能感兴趣的:(android,可持续集成)