OBB file are not Extract Error is “XAPK file Validation Failed”

我怕爱的太早我们不能终老 提交于 2020-01-01 19:12:32

问题


I implemented apk expansion successfully and OBB file downloaded at Storage->Android->Obb->PackageName->main.1.com.packagename.obb

But when i go to extract i am getting issue is "Not a Zip archive".

ZipResourceFile zrf = new ZipResourceFile(fileName);

public ZipResourceFile(String zipFileName) throws IOException {
        addPatchFile(zipFileName);
    }

    void addPatchFile(String zipFileName) throws IOException {
        File file = new File(zipFileName);
        RandomAccessFile f = new RandomAccessFile(file, "r");
        long fileLength = f.length();

        if (fileLength < kEOCDLen) {
            throw new java.io.IOException();
        }

        long readAmount = kMaxEOCDSearch;
        if (readAmount > fileLength)
            readAmount = fileLength;

        /*
         * Make sure this is a Zip archive.
         */
        f.seek(0);

        int header = read4LE(f);
        if (header == kEOCDSignature) {
            Log.i(LOG_TAG, "Found Zip archive, but it looks empty");
            throw new IOException();
        } else if (header != kLFHSignature) {
            Log.v(LOG_TAG, "Not a Zip archive");
            throw new IOException();
        }


回答1:


I got the Solution after 2 days

only problem is that -

.obb file are create wrong direction

the obb file create step
-All Resources store in one folder.
-Zip this folder
-Only Rename .obb to .zip file

Happy with this solution



来源:https://stackoverflow.com/questions/32645069/obb-file-are-not-extract-error-is-xapk-file-validation-failed

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!