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();
}
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