Note that there are some explanatory texts on larger screens.

plurals
  1. POAPK expansion file expPath does not exists
    text
    copied!<p>I have been trying to convert my App to use an APK Expansion file and for some reason this code below cannot find the path to my APK Expansion file ...</p> <pre><code>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&lt;String&gt; ret = new Vector&lt;String&gt;(); 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; } </code></pre> <p>... logcat shows this ...</p> <pre><code>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 </code></pre> <p>... even though the path does exists and the file is there as demonstrated in this screen shot:</p> <p><img src="https://i.stack.imgur.com/gGGoU.png" alt="enter image description here"> I am pretty certain I do not have a typo and the path exists. So why would <code>expPath.exists()</code> return false.</p> <p>Thanks for the answer Ted ... but I still get this in the logcat ....</p> <pre><code>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 </code></pre> <p>... could it be that I created the directories with Windows and not <code>avd</code>. What would the <code>adb</code> command be to create the dirs and push the APK expansion zip file on to my phone?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload