-
UnityWebRequest 报错
InvalidOperationException: Insecure connection not allowed
解决方法
-
不兼容jdk 8 需要安装 JDK11 64bit
必须JDK 11,高版本也不行 -
安卓环境hub 未给我安装完全。 Data\PlaybackEngines\AndroidPlayer 并没有NDK,SDK。但是 HUB 显示已经安装,无法再次安装。
在Unity 同级目录找到 modules.json ,打开找到配置 把这些selected都改为false。
重新打开hub,及可选择 Android SDK & NDKTools 再次安装。如果还不能勾选,多试几次。可能是因为你的Hub没有正常关闭,用右键退出再开。
{
"id": "android-sdk-ndk-tools",
"name": "Android SDK & NDK Tools",
"description": "Android SDK & NDK Tools 26.1.1",
"downloadUrl": "https://dl.google.com/android/repository/sdk-tools-windows-4333796.zip",
"category": "Platforms",
"installedSize": 174000000,
"downloadSize": 148000000,
"visible": true,
"sync": "Android Build Support",
"selected": true,
"destination": "{UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/SDK",
"parent": "android",
"eulaUrl1": "https://dl.google.com/dl/android/repository/repository2-1.xml",
"eulaLabel1": "Android SDK and NDK License Terms from Google",
"eulaMessage": "Please review and accept the license terms before downloading and installing Android's SDK and NDK.",
"preselected": false
},
{
"id": "android-sdk-platform-tools",
"name": "Android SDK Platform Tools",
"description": "Android SDK Platform Tools 32.0.0",
"downloadUrl": "https://dl.google.com/android/repository/platform-tools_r32.0.0-windows.zip",
"category": "Platforms",
"installedSize": 28200000,
"downloadSize": 11500000,
"visible": false,
"sync": "android-sdk-ndk-tools",
"selected": true,
"destination": "{UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/SDK",
"preselected": false
},
{
"id": "android-sdk-build-tools",
"name": "Android SDK Build Tools",
"description": "Android SDK Build Tools 32.0.0",
"downloadUrl": "https://dl.google.com/android/repository/210b77e4bc623bd4cdda4dae790048f227972bd2.build-tools_r32-windows.zip",
"category": "Platforms",
"installedSize": 144000000,
"downloadSize": 54100000,
"visible": false,
"sync": "android-sdk-ndk-tools",
"selected": true,
"destination": "{UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/SDK",
"renameTo": "{UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/SDK/build-tools/32.0.0",
"renameFrom": "{UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/SDK/android-12",
"preselected": false
},
{
"id": "android-sdk-platforms-31",
"name": "Android SDK Platforms 31",
"description": "Android SDK Platforms 31 31",
"downloadUrl": "https://dl.google.com/android/repository/platform-31_r01.zip",
"category": "Platforms",
"installedSize": 91900000,
"downloadSize": 53900000,
"visible": false,
"sync": "android-sdk-ndk-tools",
"selected": true,
"destination": "{UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/SDK",
"renameTo": "{UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/SDK/platforms/android-31",
"renameFrom": "{UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/SDK/android-12",
"preselected": false
},
{
"id": "android-sdk-platforms-32",
"name": "Android SDK Platforms 32",
"description": "Android SDK Platforms 32 32",
"downloadUrl": "https://dl.google.com/android/repository/platform-32_r01.zip",
"category": "Platforms",
"installedSize": 101600000,
"downloadSize": 63000000,
"visible": false,
"sync": "android-sdk-ndk-tools",
"selected": true,
"destination": "{UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/SDK",
"renameTo": "{UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/SDK/platforms/android-32",
"renameFrom": "{UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/SDK/android-12",
"preselected": false
},
{
"id": "android-ndk",
"name": "Android NDK",
"description": "Android NDK r23b",
"downloadUrl": "https://dl.google.com/android/repository/android-ndk-r23b-windows.zip",
"category": "Platforms",
"installedSize": 2594600000,
"downloadSize": 752000000,
"visible": false,
"sync": "android-sdk-ndk-tools",
"selected": true,
"destination": "{UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/NDK",
"renameTo": "{UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/NDK",
"renameFrom": "{UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/NDK/android-ndk-r23b",
"preselected": false
},
{
"id": "android-sdk-command-line-tools",
"name": "Android SDK Command-Line Tools",
"description": "Android SDK Command-Line Tools 6.0",
"downloadUrl": "https://dl.google.com/android/repository/commandlinetools-win-8092744_latest.zip",
"category": "Platforms",
"installedSize": 119600000,
"downloadSize": 119600000,
"visible": false,
"sync": "android-sdk-ndk-tools",
"selected": true,
"destination": "{UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/SDK/cmdline-tools",
"renameTo": "{UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/SDK/cmdline-tools/6.0",
"renameFrom": "{UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/SDK/cmdline-tools/cmdline-tools",
"preselected": false
},
-
重新加载 又出现安装失败: validation Failed。
大概率是因为上面的配置漏改了,如果某项selected true 就会安装失败。
也有可能是网络原因。那么可以从上面配置得到downloadUrl。自行下载后,解压到
C:\Program Files\Tuanjie\Hub\Editor\2022.3.2t10\Editor\Data\PlaybackEngines\AndroidPlayer\SDK目录 或者C:\Program Files\Tuanjie\Hub\Editor\2022.3.2t10\Editor\Data\PlaybackEngines\AndroidPlayer\NDK 目录 -
打包还是报错
UnityException: Target Android SDK not installed
Android SDK does not include your Target SDK of 29.
Please use the Android SDK Manager to install your target SDK version. Restart Unity after SDK installation for the changes to take effect.
发生错误的原因 PlayerSetting 中Target API Level选择的是 Android 10.0 API Level 29。
我的2022.3.2t10\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\platforms 目录并没有 29 的版本。
解决方法1. 把 TargetAPILevel 选择存在的版本
解决方法2. 下载对应的版本。
我这里选择的是解决方法2
打开Android Studio 选择 File -》 Project Structure -> SDK Location 把 Android SDK Location 选择为 2022.3.2t10\Editor\Data\PlaybackEngines\AndroidPlayer\SDK。
然后 Tools- > sdkmanager 选择对应的版本进行下载,下载完后重启。
6. 小程序导出报错
Exception: Invalid WebGL template path: D:\Work\hjha\hjha_Client\Packages\com.qq.weixin.minigame\WebGLTemplates\WXTemplate2022TJ! Select a template in player settings.
团结引擎的安装方式跟Unity不一样,需要使用PackageManager进行安装,仓库都不一样
链接 https://github.com/wechat-miniprogram/minigame-tuanjie-transform-sdk