我的環境配置: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.
 
image01.jpg
 

安裝到 100% 後失敗了,但是 APK 有成功匯出。
image02.jpg
 
但就算我直接把 APK 抓到手機上,再執行安裝,也是會失敗。
image06.jpg
 
 
原因是我在 Install Location 裡,選擇了 Prefer External 導致的,因為我手機沒有裝 SD Card,所以才會失敗。
不過好像是我這一版 Unity 預設的樣子?所以大家匯出 APK 前要注意一下喔!
 
Install Location 意思為要安裝的位置:
Automatic 是系統自己選擇,但使用者可以移動安裝位置的樣子?
Prefer External 是安裝到手機的 SD Card 上。
Force Internal 是安裝到手機的內建記憶體上。
 
 
以下為解決辦法:
首先開啟 Edit > Project Settings > Player
image05.jpg
 
選擇 Android > Other Settings
image03.jpg
 
最後將 Configuration 底下的 Install Location 改成 Automatic 就可以了
image04.jpg
 
arrow
arrow

    岳 發表在 痞客邦 留言(0) 人氣()