BlueRoseNote/03-UnrealEngine/Mobile/IOS&Android Engine Package.md

186 lines
7.5 KiB
Markdown
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
title: IOS&Android Package
date: 2023-05-05 10:59:01
excerpt:
tags: MAC IOS Android
rating: ⭐⭐
---
# 其他笔记
[[黑苹果配置笔记]]
[[安装Mac UE开发环境]]
[[安装UE开发环境]]
# 命令行
## Win
```bash
cd /d D:/
cd D:/UnrealEngine/UnrealEngine5/Engine/Build/BatchFiles
RunUAT.bat BuildGraph -target="Make Installed Build Win64" -script=Engine/Build/InstalledEngineBuild.xml -set:WithDDC=true -set:SignExecutables=false -set:EmbedSrcSrvInfo=false -set:GameConfigurations=Development;Shipping -set:WithFullDebugInfo=false -set:HostPlatformEditorOnly=false -set:AnalyticsTypeOverride= -set:HostPlatformDDCOnly=true -set:WithWin64=true -set:WithMac=false -set:WithAndroid=false -set:WithIOS=false -set:WithTVOS=false -set:WithLinux=false -set:WithLinuxArm64=false -set:CompileDatasmithPlugins=false -set:WithServer=false -set:WithClient=false -set:WithHoloLens=false
```
```
del *.cpp /s
```
## Android
```bash
cd /d D:/
cd D:/UnrealEngine/UnrealEngine5/Engine/Build/BatchFiles
RunUAT.bat BuildGraph -target="Make Installed Build Win64" -script=Engine/Build/InstalledEngineBuild.xml -set:WithDDC=true -set:SignExecutables=false -set:EmbedSrcSrvInfo=false -set:GameConfigurations=Development;Shipping -set:WithFullDebugInfo=false -set:HostPlatformEditorOnly=false -set:AnalyticsTypeOverride= -set:HostPlatformDDCOnly=false -set:WithWin64=true -set:WithMac=false -set:WithAndroid=true -set:WithIOS=false -set:WithTVOS=false -set:WithLinux=false -set:WithLinuxArm64=false -set:CompileDatasmithPlugins=false -set:WithServer=false -set:WithClient=false -set:WithHoloLens=false
```
```
RunUAT Turnkey -command=Verifysdk -platform=Android
```
## MAC
```bash
cd ./Desktop/UnrealEngine/Engine/Build/BatchFiles
./RunUAT.sh BuildGraph -target="Make Installed Build MAC" -script=Engine/Build/InstalledEngineBuild.xml -set:WithDDC=true -set:SignExecutables=false -set:EmbedSrcSrvInfo=false -set:GameConfigurations=Development;Shipping -set:WithFullDebugInfo=false -set:HostPlatformEditorOnly=true -set:AnalyticsTypeOverride= -set:HostPlatformDDCOnly=false -set:WithWin64=false -set:WithMac=true -set:WithAndroid=false -set:WithIOS=true -set:WithTVOS=false -set:WithLinux=false -set:WithLinuxArm64=false -set:CompileDatasmithPlugins=false -set:WithServer=false -set:WithClient=false -set:WithHoloLens=false
```
# MAC&IOS
## Windows
安装环境:
- iTunes 12.10.11.2不安装IOS SDK就无法检测到。
文档:
- Building for iOS on Windows[https://docs.unrealengine.com/5.1/en-US/building-ios-projects-on-windows-in-unreal-engine/](https://docs.unrealengine.com/5.1/en-US/building-ios-projects-on-windows-in-unreal-engine/)
- Provisioning Profiles and Signing Certificates[https://docs.unrealengine.com/5.1/en-US/setting-up-ios-tvos-and-ipados-provisioning-profiles-and-signing-certificates-for-unreal-engine-projects/](https://docs.unrealengine.com/5.1/en-US/setting-up-ios-tvos-and-ipados-provisioning-profiles-and-signing-certificates-for-unreal-engine-projects/)
### GenerateProjectFiles跳过SDK问题
运行GenerateProjectFiles.bat时提示
>Some Platforms were skipped due to invalid SDK setup: Mac, IOS, Android, Linux, LinuxArm64, TVOS.
查看`Engine\Programs\UnrealBuildTool`目录下的`Log_GPF.txt`
```
Note: Android toolchain NDK r25b recommended
Registering build platform: Android - buildable: False
Registering build platform: UnrealBuildTool.IOSPlatformFactory
Registering build platform: IOS - buildable: False
Registering build platform: UnrealBuildTool.LinuxPlatformFactory
Registering build platform: Linux - buildable: False
Registering build platform: LinuxArm64 - buildable: False
Registering build platform: UnrealBuildTool.MacPlatformFactory
Registering build platform: Mac - buildable: False
Registering build platform: UnrealBuildTool.TVOSPlatformFactory
Registering build platform: TVOS - buildable: False
Registering build platform: UnrealBuildTool.WindowsPlatformFactory
Found Windows 10 SDK root at C:\Program Files (x86)\Windows Kits\10 (1)
Found Windows 10 SDK root at C:\Program Files (x86)\Windows Kits\10 (2)
```
- 问题原因
- 安装Itunes太新或者没有安装itunes。
- 解决方法
- 卸载**itunes**以及**Apple Mobile Device Support**。之后安装12.10.11.2版本的**itunes**。
### SSH登录设置
MAC
Apple
ssh bluerose@192.168.2.164
ECDSA key fingerprint is SHA256:fkRVqfbPPmbLUB4dn3QRFpATQykuu1AtlWmNLMSDXtU.
SSH还需要生成秘钥文件之后放置在对应文件夹里
### 证书与BaseEngine.ini
证书需要后缀名为p12的证书可以通过MAC的钥匙串进行转换。具体操作为
1. 选择想要导出的证书,右键点击导出。
2. 选择p12类型
3. 不要设置密码。
可以参考https://blog.51cto.com/u_15318120/3241489
>. cer证书只包含公钥p12证书可能同时包含公钥和私钥。这就是他们的区别除了xcode开发工具打包都需要p12。
需要通过编辑器先在`Platform-IOS`先导入一次证书通过后再把DefaultEngine.ini中的IOS设置加入到BaseEngine.ini中。
比如:
DefaultEngine.ini
```ini
[/Script/IOSRuntimeSettings.IOSRuntimeSettings]
BundleDisplayName=eto
BundleName=eto
BundleIdentifier=cn.tectree.eto
MobileProvision=eto.mobileprovision
SigningCertificate=iPhone Developer: xiangtian luo (RD2564LPA4)
```
BaseEngine.ini
```ini
[/Script/IOSRuntimeSettings.IOSRuntimeSettings]
BundleDisplayName=etoBundleName=eto
BundleIdentifier=cn.tectree.eto
MobileProvision=eto.mobileprovision
SigningCertificate=iPhone Developer: xiangtian luo (RD2564LPA4)
```
### 证书放置位置
 `~/Library/MobileDevice/Provisioning/Profiles`
## MAC
![[安装Mac UE开发环境]]
## MAC 删除CPP文件
```bash
cd /Users/Shared/UE_Toon/localBuilds/Engine/Mac/Engine/Source
find . -name "*.txt" | xargs rm -rf
```
## MAC使用7zip进行压缩
安装p7zip
```bash
brew update
brew install p7zip
```
压缩
```bash
cd /Users/Shared/UE_Toon/LocalBuilds/Engine/
7z a UnrealEngine5.1.1-Toon-IOS-2023.7.14.7z ./Mac/* -r -mx=9
```
- a:表示add命令即新建一个压缩文件该压缩文件存放在当前目录下
- -r:表示遍历所有的子目录,每个文件都执行压缩操作,添加到压缩文件中。
- -mx:表示压缩等级9级是最高等级。默认等级是5。
分卷压缩
```bash
cd /Users/Shared/UE_Toon/LocalBuilds/Engine/
7z a UnrealEngine5.1.1-Toon-IOS-2023.7.14.7z ./Mac/* -r -mx=9 -v4000m
```
# Android
UE5.1为准的安装环境:
- Android Studio 4.0
- Android Cmd line tool 8.0
- Android NDK r25b
- Android SDK
- Recommended: SDK 32
- Minimum for compiling UE: SDK 30
具体步骤参考https://docs.unrealengine.com/5.1/en-US/how-to-set-up-android-sdk-and-ndk-for-your-unreal-engine-development-environment/
因为打包Android时一定会运行**Extra/SetupAndroid.bat**,所以需要完全按照文档步骤进行操作,比如:
- 使用Android Studio4.0
- 使用默认的安装位置。
设置完之后需要运行`GenerateProjectFiles.bat`并且编译一下。
# 插件构建
```bash
cd D:\UnrealEngine\UE_5.3\Engine\Build\Batchfiles
RunUAT.bat BuildPlugin -plugin="D:\Work\MultiDraw\Plugins\MultiDraw\MultiDraw.uplugin" -package="D:\MultiDraw"
```
# BuildGraph PlatformFilters
在InstalledEngineFilters.xml可以看得出各个平台的区别
```xml
    <!-- Platform extensions filter overrides -->
    <Expand Name="Platform_FilterOverrides"/>
   
    <ForEach Name="Filter" Values="$(CopyEditorEngineOrPlatformFilter)">
        <Property Name="CopyEditorFilter" Value="$(CopyEditorFilter);Engine/$(Filter);Engine/Platforms/*/$(Filter)"/>
    </ForEach>
```