Search code examples
androidandroid-assetsapk-expansion-files

getAssetFileDescriptor return null


I need to read files from an expansion file. In the first LOG it shows expansionFile without problem. But when i try to access the files inside zip file according with the docs 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 is organized like this

 /enterprie

     /0

     /config.json

Somebody know the problem?


Solution

  • I tried to change for this and work fine.

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