1

I'm using the APK expansion file in my application with the APEZProvider. This works on every device except Huawei devices. If the user wants to open a video it always comes to a RuntimeException and the video can't be played.

It happens on all Huawei devices (Android version is 8.0).

Is this a known issue with Huawei devices and how can I solve this problem?

enter image description here

Deno Agüero
  • 519
  • 2
  • 9
  • 27
  • Hi, did you ever manage to solve this? As of today, with an up-to-date version of that package, we're incurring in the same error on a Huawei phone, a P20. It reaches that RuntimeException in that `query` method. When manually accessing the asset with `contentResolver.openAssetFileDescriptor` there's no issue, to confirm the file is there – superjos Sep 20 '19 at 20:59

1 Answers1

1

Luckily this code is open source, so you can debug it yourself. The source code is here.

The relevant section:

        int len = projection.length;
        intProjection = new int[len];
        for (int i = 0; i < len; i++) {
            if (projection[i].equals(FILEID)) {
                intProjection[i] = FILEID_IDX;
            } else if (projection[i].equals(FILENAME)) {
                intProjection[i] = FILENAME_IDX;
            } else if (projection[i].equals(ZIPFILE)) {
                intProjection[i] = ZIPFILE_IDX;
            } else if (projection[i].equals(MODIFICATION)) {
                intProjection[i] = MOD_IDX;
            } else if (projection[i].equals(CRC32)) {
                intProjection[i] = CRC_IDX;
            } else if (projection[i].equals(COMPRESSEDLEN)) {
                intProjection[i] = COMPLEN_IDX;
            } else if (projection[i].equals(UNCOMPRESSEDLEN)) {
                intProjection[i] = UNCOMPLEN_IDX;
            } else if (projection[i].equals(COMPRESSIONTYPE)) {
                intProjection[i] = COMPTYPE_IDX;
            } else {
                throw new RuntimeException();
            }

Interesting things about this. Firstly, the line numbers don't match your line numbers. Secondly, the package name doesn't match the package name. Are you using the latest version? The bug may already have been fixed. The update which changed the package name also says "Updated for Marshmallow" which if you are getting breaks might explain why you are getting them on recent phones.

Nick Fortescue
  • 13,530
  • 1
  • 31
  • 37
  • Great advice! I'm using an older version of the google-play-zip-file lib. I've added the libs 1 year ago as module in my project and don't know how to update them. Do you know how can I update an imported module? – Deno Agüero Oct 27 '18 at 17:34
  • If you checked out from github, just go into the module directory and update from github in that directory. Alternatively, just github clone the most recent version, remove the old imported module, and then import the new module (fine if you haven't edited anything) – Nick Fortescue Oct 29 '18 at 07:53