close
我的環境配置:Windows 10、Unity 5.3.4f1、Java JDK 1.8.0_51
最近我使用 Unity 的 Build And Run 來打包 Android APK 順便安裝到手機上時,發生了這錯誤:
Installation failed with the following output:
[ 0%] /data/local/tmp/Package.apk
[ 1%] /data/local/tmp/Package.apk
......
......
......
[ 99%] /data/local/tmp/Package.apk
[100%] /data/local/tmp/Package.apk
pkg: /data/local/tmp/Package.apk
Failure [INSTALL_FAILED_CONTAINER_ERROR]
UnityException: Unable to install APK!
Installation failed. See the Console for details.
Error building Player: UnityException: Unable to install APK!
Installation failed. See the Console for details.

安裝到 100% 後失敗了,但是 APK 有成功匯出。

但就算我直接把 APK 抓到手機上,再執行安裝,也是會失敗。

原因是我在 Install Location 裡,選擇了 Prefer External 導致的,因為我手機沒有裝 SD Card,所以才會失敗。
不過好像是我這一版 Unity 預設的樣子?所以大家匯出 APK 前要注意一下喔!
Install Location 意思為要安裝的位置:
Automatic 是系統自己選擇,但使用者可以移動安裝位置的樣子?
Prefer External 是安裝到手機的 SD Card 上。
Force Internal 是安裝到手機的內建記憶體上。
以下為解決辦法:
首先開啟 Edit > Project Settings > Player

選擇 Android > Other Settings

最後將 Configuration 底下的 Install Location 改成 Automatic 就可以了

文章標籤
全站熱搜