This commit is contained in:
2025-08-02 12:09:34 +08:00
commit e70b01cdca
2785 changed files with 575579 additions and 0 deletions

View File

@@ -0,0 +1,175 @@
---
title: Android常用命令
date: 2025-06-17 14:09:07
excerpt:
tags:
rating: ⭐
---
# Adb
adb 是 Android 的调试工具,非常强大,熟悉一些 adb 的命令能够让效率加倍。
## 安装 Apk
adb install APK_FILE_NAME.apk
## 启动 App
安装的 renderdoccmd 是没有桌面图标的,想要自己启动的话只能使用下列 adb 命令:
```bash
adb shell am start org.renderdoc.renderdoccmd.arm64/.Loader -e renderdoccmd "remoteserver"
```
adb 启动 App 的 shell 命令模板:
```bash
adb shell am start PACKAGE_NAME/.ActivityName
```
这个方法需要知道 App 的包名和 Activity 名,包名很容易知道,但是 Activity 如果不知道可以通过下列操作获取:
首先使用一个反编译工具将 apk 解包(可以使用之前的[apktools](https://imzlp.com/notes/#apk%E7%9A%84%E5%8F%8D%E7%BC%96%E8%AF%91%E4%B8%8E%E7%AD%BE%E5%90%8D))
```bash
apktool.bat d -o ./renderdoccmd_arm64 org.renderdoc.renderdoccmd.arm64.apk|
```
然后打开 `org.renderdoc.renderdoccmd.arm64` 目录下的 `AndroidManifest.xml` 文件,找到其中的 `Application` 项:
```xml
<?xml version="1.0" encoding="utf-8" standalone="no"?><manifest xmlns:android="http://schemas.android.com/apk/res/android" package="org.renderdoc.renderdoccmd.arm64" platformBuildVersionCode="26" platformBuildVersionName="8.0.0">
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-feature android:glEsVersion="0x00030000" android:required="true"/>
<application android:debuggable="true" android:hasCode="true" android:icon="@drawable/icon" android:label="RenderDocCmd">
<activity android:configChanges="keyboardHidden|orientation" android:exported="true" android:label="RenderDoc" android:name=".Loader" android:screenOrientation="landscape">
<meta-data android:name="android.app.lib_name" android:value="renderdoccmd"/>
</activity>
</application>
</manifest>
```
其中有所有注册的`Activity`,没有有界面的 apk 只有一个 Activity所以上面的 renderdoccmd 的主 Activity 就是`.Loader`
如果说有界面的 app则会有多个则可以从 `AndroidManifest.xml` 查找 `Category` 或者根据命名 (名字带`main` 的 Activity)来判断哪个是主 Activity。一般都是从 lanucher 开始,到 main或者有的进登陆界面。
> PS使用 UE 打包出游戏的主 Activity 是`com.epicgames.ue4.SplashActivity`,可以通过下列命令启动。
```bash
adb shell am start com.imzlp.GWorld/com.epicgames.ue4.SplashActivity
```
## 传输文件
使用 adb 往手机传文件:
```bash
adb push 1.0_Android_ETC2_P.pak /sdcard/Android/data/com.imzlp.TEST/files/UE4GameData/Mobile422/Mobile422/Saved/Paks
adb push FILE_NAME REMOATE_PATH
```
从手机传递到电脑:
```bash
adb pull /sdcard/Android/data/com.imzlp.TEST/files/UE4GameData/Mobile422/Mobile422/Saved/Paks/1.0_Android_ETC2_P.pak A.Pak
adb pull REMOATE_FILE_PATH LOCAL_PATH
```
## Logcat
使用 `logcast` 可以看到 Android 的设备 Log 信息。
```bash
adb logcat
```
会打印出当前设备的所有信息,但是我们调试 App 时不需要看到这么多,可以使用 `find` 进行筛选(注意大小写严格区分)
```bash
adb logcat | find "GWorld"
adb logcat | find "KEY_WORD"
```
查看 UE 打包的 APP 所有的 log 可以筛选:
```bash
adb logcat | find "UE4"
```
如果运行的次数过多积累了大量的 Log可以使用清理
```bash
adb logcat -c
```
输出到文件:
```bash
adb logcat > c:\Users\loujiajie\Desktop\log.txt
```
## 从设备中提取已安装的 APK
注意:执行下列命令时需要检查手机是否开放开发者权限,手机上提示的验证指纹信息要允许。
```bash
# 查看链接设备
$ adb devices
List of devices attached
b2fcxxxx unauthorized
# 列出手机中安装的所有 app
$ adb shell pm list package
# 如果提示下问题,则需要执行 adb kill-server
error: device unauthorized.
This adb servers $ADB_VENDOR_KEYS is not set
Try 'adb kill-server' if that seems wrong.
Otherwise check for a confirmation dialog on your device.
# 正常情况下会列出一堆这样的列表
C:\Users\imzlp>adb shell pm list package
package:com.miui.screenrecorder
package:com.amazon.mShop.android.shopping
package:com.mobisystems.office
package:com.weico.international
package:com.github.shadowsocks
package:com.android.cts.priv.ctsshim
package:com.sorcerer.sorcery.iconpack
package:com.google.android.youtube
# 找到指定 app 的的 apk 位置
$ adb shell pm path com.github.shadowsocks
package:/data/app/com.github.shadowsocks-iBtqbmLo8rYcq2BqFhJtsA==/base.apk
# 然后将该文件拉取到本地来即可
$ adb pull /data/app/com.github.shadowsocks-iBtqbmLo8rYcq2BqFhJtsA==/base.apk
/data/app/com.github.shadowsocks-iBtqbmLo8rYcq2BqFhJtsA==/...se.apk: 1 file pulled. 21.5 MB/s (4843324 bytes in 0.215s)
```
## 刷入 Recovery
下载[Adb](https://ue5wiki.com/wiki/6fa72650/index/Adb.7z),然后根据具体情况使用下列命令(如果当前已经在 bootloader 就不需要执行第一条了)。
```bash
adb reboot bootloader
# 写入 img 到设备
fastboot flash recovery recovery.img
fastboot flash boot boot.img
# 引导 img
fastboot boot recovery.img
```
## 端口转发
可以通过 adb 命令来指定:
```bash
# PC to Device
adb reverse tcp:1985 tcp:1985
# Device to PC
adb forward tcp:1985 tcp:1985
```
- [Android 上超级好用的前端调试方法adb reverse](http://blog.xiaoyu.im/post_678.html)
## 根据包名查看 apk 位置
可以使用以下 adb 命令:
```bash
$ adb shell pm list package -f com.tencent.tmgp.fm
package:/data/app/com.tencent.tmgp.fm-a_cOsX8G3VClXwiI-RD9wQ==/base.apk=com.tencent.tmgp.fm
```
最后一个参数是包名, 输出的则是 apk 的路径。
## 查看当前窗口的 app 的包名
使用以下 adb 命令:
```bash
adb shell dumpsys window w | findstr \/ | findstr name=
mSurface=Surface(name=SideSlideGestureBar-Bottom)/@0xa618588
mSurface=Surface(name=SideSlideGestureBar-Right)/@0x619b646
mSurface=Surface(name=SideSlideGestureBar-Left)/@0xea02007
mSurface=Surface(name=StatusBar)/@0x7e4962d
mAnimationIsEntrance=true mSurface=Surface(name=com.tencent.tmgp.fm/com.epicgames.ue4.GameActivity)/@0x43b30a0
mSurface=Surface(name=com.tencent.tmgp.fm/com.epicgames.ue4.GameActivity)/@0xa3481e
mAnimationIsEntrance=true mSurface=Surface(name=com.vivo.livewallpaper.monster.bmw.MonsterWallpaperService)/@0x53e44ae
```
其中的 `mAnimationIsEntrance=true mSurface=Surface(name=` 之后,到 `/` 之前的字符串就是我们的 app 包名。
# MuMu打开ABD方法
1. CMD CD到MuMu安装目录下例如`E:\Program Files\Netease\MuMu Player 12\shell`
2. 在命令提示符窗口内输入adb.exe connect 127.0.0.1:XXXXX之后点击回车。注XXXXX为模拟器端口号请参考打开的模拟器问题诊断内展示端口号或MuMu多开器12内的adb端口后再输入。
1. 在MuMu多开器右上角的ADB图标点击就可以显示端口。
2.

View File

@@ -0,0 +1,212 @@
---
title: IOS&Android Package
date: 2023-05-05 10:59:01
excerpt:
tags: MAC IOS Android
rating: ⭐⭐
---
# 其他笔记
[[黑苹果配置笔记]]
[[安装Mac UE开发环境]]
[[安装UE开发环境]]
## 其他问题
- shadercompileworker terminated unexpectedly falling back to directly compiling which will be very slow.
- 编译DDC阶段出现 SCW 5 Queued Jobs, Unknown number of processed jobs!:在 Nvidia 控制面板的“管理 3D 设置”中将着色器缓存大小设置为“无限制”。
- *没有效果*
- 设置注册表,来调整**TdrDelay**和**TdrDdiDelay**都更改为更高的值(例如 60 秒)。
- Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\GraphicsDrivers
- 将**TdrDelay**设置为**2s**,将**TdrDdiDelay**设置为**5s** ;或者将其删除。
- 参考
- [https://docs.microsoft.com/en-us/windows-hardware/drivers/display/tdr-registry-keys ](https://docs.microsoft.com/en-us/windows-hardware/drivers/display/tdr-registry-keys) 
- https://helpx.adobe.com/substance-3d-painter/technical-support/technical-issues/gpu-issues/gpu-drivers-crash-with-long-computations-tdr-crash.html
- https://learn.microsoft.com/en-us/answers/questions/1163496/code-error-when-building-unreal-engine-5-source-co
- https://www.reddit.com/r/battlefield_4/comments/1xzzn4/tdrdelay_10_fixed_my_crashes_since_last_patch/
# 设置版本号
修改三處:
1. `Engine\Source\Runtime\Launch\Resources\version.h`尋找BUILT_FROM_CHANGELIST並修改
2. 更新`Engine\Build\Build.Version`
3. `Engine\Intermediate\ProjectFiles\UE4.vcxproj中的BRANCH_NAME`
# 将CMD的代码页设置成UTF-8
```c++
chcp 65001
```
# 命令行
完全构建
```c++
-set:WithClean=true
```
## Win
```bash
cd /d E:/
cd E:/UnrealEngine/UnrealEngine5-Toon/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
```
```
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
```
```
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
```
# 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>
```

View File

@@ -0,0 +1,9 @@
---
title: Untitled
date: 2025-06-25 15:45:06
excerpt:
tags:
rating: ⭐
---
# 前言
- [UE5 移动端ASTC贴图压缩](https://zhuanlan.zhihu.com/p/662319403)