通过USB链接PC 和 android设备, 使用命令adb -s xxx install xxx.apk, 遇到过的错误类型及解析
1. INSTALL_FAILED_MEDIA_UNAVAILABLE
安装位置不可得。 这时去到手机的shell下, adb -s xxx shell -> cd /sdcard 时, 会出现 \”Permission denied\”的错误。
sdcard现在处于unmounted状态。 通常插拔下usb链接, 就可以安装了。
实际上, 安装位置是可以设置的。
对于手机而言, pm get-install-location, 可以得到, 手机的安装位置设置。
pm get-install-location: returns the current install location.
0 [auto]: Let system decide the best location
1 [internal]: Install on internal device storage
2 [external]: Install on external media
另外, manifest.xml中的安装位置选项:
<manifest xmlns:android=\"http://schemas.android.com/apk/res/android\" android:installLocation=\"preferExternal\" ... >
\”If you do notdeclarethis attribute, your applicationwill be installed on the internal storage only and it cannot be moved to the external storage.\” as said in http://developer.android.com/guide/topics/data/install-location.html
If you declare \”preferExternal\”, you request that your application be installed on the external storage, but the system does not guarantee that your application will be installed on the external storage.