1

I am using file expansion in my project to access audio, video and image files from obb folder. My Obb file is the form: main.1.com.example.sample--->containg three folders with the name Images, Video and Audio--->Now it contains different .mp4,.mp3,.jpg files I have my obb file in Android/obb/com.example.sample/main.1.com.example.sample Now, I am trying to access .mp4 file inside Video folder by using following code:

ZipResourceFile expansionFile = null;
    try {
        expansionFile = APKExpansionSupport.getAPKExpansionZipFile(this,1,0);
         Log.e("expansion",">>>>>"+expansionFile);
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    if(expansionFile!=null){
            AssetFileDescriptor fd = expansionFile.getAssetFileDescriptor("Video/v1.mp4");
            Log.e("AFDDDDDDDD",">>>>>"+fd);
        }

but I am getting exception: 07-30 16:14:24.685: D/zipro(22542): Zip: EOCD not found, /storage/emulated/0/Android/obb/com.example.sample/main.1.com.example.sample.obb is not zip

07-30 16:14:24.685: W/zipro(22542): bad offsets (dir 191367812, size 1771611666, eocd -1) 07-30 16:14:24.685: W/System.err(22542): java.io.IOException 07-30 16:14:24.695: W/System.err(22542): at com.android.vending.expansion.zipfile.ZipResourceFile.addPatchFile(ZipResourceFile.java:353) 07-30 16:14:24.695: W/System.err(22542): at com.android.vending.expansion.zipfile.ZipResourceFile.(ZipResourceFile.java:189) 07-30 16:14:24.695: W/System.err(22542): at com.android.vending.expansion.zipfile.APKExpansionSupport.getResourceZipFile(APKExpansionSupport.java:67) 07-30 16:14:24.695: W/System.err(22542): at com.android.vending.expansion.zipfile.APKExpansionSupport.getAPKExpansionZipFile(APKExpansionSupport.java:77)

and not able to access directly from obb file. Please, suggest a solution and why this exception I am getting?

Thanks

4

1 回答 1

0

Bad Offsets 异常发生在 obb 的文件路径从assetfiledescriptor 取出的位置错误时。这就是为什么它在运行时给出这个错误。

于 2013-08-08T07:35:39.303 回答