Problems reading EXPANSION FILE

Asked

Viewed 42 times

1

I need to read files from an EXPANSION FILE.

In the first Log in which I print expansionFile is working perfectly, ie I was able to read the zip file, but while trying to access the files from inside the zip as it guides the documentation http://developer.android.com/google/play/expansion-files.html the file returns null

    ZipResourceFile expansionFile = null;

    try {
        expansionFile = APKExpansionSupport.getAPKExpansionZipFile(context,
                2, 1);

    } catch (IOException e) {

        e.printStackTrace();
    }

    Log.d("DEBUG", expansionFile + "expansionFile");

    AssetFileDescriptor fd = expansionFile.getAssetFileDescriptor("enterprise/config.json");
    Log.d("DEBUG", fd + "FILE");

The Zip file has the following organization

 /enterprie

     /0

     /config.json

Someone knows the problem?

  • 1

    Igor, take a look at this question and my answer to see if it helps your problem: http://answall.com/q/31107/6436

  • I didn’t understand the use of the Providervideozipuri class in Question

  • Actually I suspect it might be a problem in the versions of the extension (mainVersion and patchVersion) and apk. If they are different and you do not specify correctly, it will not find the extension and will return null.

  • The extension has already been found, Log appears, but when I try to access the ZIP files it gives null

  • I thought the problem would be the way, but I’ve tried a lot of stuff and it didn’t work

1 answer

1


I switched it on

AssetFileDescriptor fd = expansionFile.getAssetFileDescriptor("enterprise/config.json");

therefore

InputStream is = expansionFile.getInputStream("enterprise/config.json");

and it worked!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.