简体   繁体   中英

Error publishing multiple density split APKs to Play Store

Background

I'm building 10 APKs for my app using two flavors and 5 density splits:

productFlavors {
    flavorA {
        ...
    }
    flavorB {
        ...
    }
}

// Builds APKs for mdpi, hdpi, xhdpi, xxhdpi, and universal
splits {
    density {
        enable true
        exclude "ldpi", "xxxhdpi"
    }
}

Each APK gets a unique versionCode. Each APK only contains one drawable folder that matches the desired target density.

After creating a new release in the Play Store developer console all APKs are successfully uploaded. When moving forward with reviewing the release the following error message is displayed:

Fully shadowed APK PROBLEM

This APK will not be served to any users because it is completely shadowed by one or more APKs with higher version codes. RESOLUTION Remove this APK from your release or review the targeting and version codes of the APKs that you are including in this release.

Running aapt on the APKs shows that the all have the same target screens and densities:

supports-screens: 'small' 'normal' 'large' 'xlarge'

supports-any-density: 'true'

densities: '160' '240' '320' '360' '65534'

Worth mentioning is that none of the above are explicitly set in the manifest file.

The Question(s)

I was expecting each density split APK to automatically get a Google Play filter added, but that doesn't seem to be the case. Is this something I need to do manually, and if so how? I can't find anything in the documentation that explains how it's supposed to work. Or am I simply missing something else?

splits {
    density {
        enable true
        exclude "ldpi", "xxxhdpi" //IMPORTANT: only if you want to exclude some density
        compatibleScreens 'small', 'normal', 'large', 'xlarge' // IMPORTANT: all supported by your application
    }
}

It turns out that you have to include compatibleScreens for the correct filter to be added to the manifest file. Updating the build script to look like this solves the problem:

splits {
    density {
        enable true

        // Optional: Exclude any screen densities your app doesn't support
        exclude "ldpi", "xxxhdpi"

        // Add all screen sizes your app supports (mine is a wearable app)
        compatibleScreens 'small'
    }
}

Running aapt on the new APKs results in the same output as before, but Play Store no longer complains about shadowing. You will also see something like

Screen layouts: small@hdpi

under APK details in the Google Play Console.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM