我一直想我的應用程序轉換爲使用APK擴展文件,由於某種原因,下面這段代碼無法找到路徑到我的APK擴展文件...APK擴展文件expPath不存在
static String[] getAPKExpansionFiles(Context ctx, int mainVersion, int patchVersion) {
Log.v(TAG, "Utils.getAPKExpansionFiles [27] mainVersion is " + mainVersion + " patchVersion = " + patchVersion);
String packageName = ctx.getPackageName();
Log.v(TAG, "Utils.getAPKExpansionFiles [27] packageName is [" + packageName + "]");
Vector<String> ret = new Vector<String>();
if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
Log.v(TAG, "Utils.getAPKExpansionFiles [32] MEDIA_MOUNTED");
// Build the full path to the app's expansion files
File root = Environment.getExternalStorageDirectory();
Log.v(TAG, "Utils.getAPKExpansionFiles [35] root = " + root);
File expPath = new File(root.toString() + EXP_PATH + packageName);
Log.v(TAG, "Utils.getAPKExpansionFiles [37] expPath " + expPath);
// Check that expansion file path exists
if (expPath.exists()) {
...
} else {
Log.v(TAG, "Utils.getAPKExpansionFiles [60] expPath DOES NOT EXISTS");
}
} else {
Log.v(TAG, "Utils.getAPKExpansionFiles [57] NOT MEDIA_MOUNTED");
}
String[] retArray = new String[ret.size()];
ret.toArray(retArray);
return retArray;
}
... logcat中顯示了這個...
03-20 21:04:24.206: V/GospelofMatthewAudiobook(10965): Utils.getAPKExpansionFiles [37] expPath /mnt/sdcard/Android/obb/com.redcricket.GospelofMatthewAudiobook
03-20 21:04:24.214: V/GospelofMatthewAudiobook(10965): Utils.getAPKExpansionFiles [60] expPath DOES NOT EXISTS
...即使路徑不存在,該文件是那裏證明在這個屏幕截圖:
我很確定我沒有錯別字和路徑存在。那麼爲什麼expPath.exists()
返回false。
感謝您的回答泰德......但我仍然得到這個在logcat中....
03-20 21:59:48.198: V/GospelofMatthewAudiobook(11988): Utils.getAPKExpansionFiles [37] expPath /mnt/sdcard/Android/obb/com.redcricket.GospelofMatthewAudiobook/main.1.com.redcricket.GospelofMatthewAudiobook.obb
03-20 21:59:48.198: V/GospelofMatthewAudiobook(11988): Utils.getAPKExpansionFiles [60] expPath DOES NOT EXISTS
...會不會是我創建的Windows目錄和不avd
。 adb
命令是如何創建目錄並將APK擴展zip文件推送到我的手機上的?
我發現'adb.exe'在'C:\用戶\小兵\ AppData \ Local \ Android \ android-sdk \ platform-tools>' – 2013-03-21 05:25:51
我試過這個命令:'C:\ Users \ dogface \ AppData \ Local \ Android \ android-sdk \ platform-tools> adb.exe push c :\ main.1.com.redcricket.GospelofMatthewAudiobook.obb到/ mnt/SD卡/安卓/ OBB/COM .redcricket.GospelofMatthewAudiobook \ main.1.com.redcricket.GospelofMatthewAudiob ook.obb 無法複製「C:\ main.1 .com.redcricket.GospelofMatthewAudiobook.obb」到 '的/ mnt/ SD卡/ Android設備/ OBB/com.redcricket.GospelofMatthewAudiobook \ main.1.com.redcricket .GospelofMatthewAudiobook.obb':權限被拒絕 C:\用戶\ dogface \ AppData \ Local \ Android \ android-sdk \ platform-tools>' – 2013-03-21 05:43:52