After updating the gradle tools version from 3.1.4 to 3.2.1 the app cannot be installed anymore on the Android 6.0 and bellow on release builds (Failure [INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION]).
compileSdkVersion = 28
minSdkVersion = 19
targetSdkVersion = 27
gradleToolsVersion = 3.2.1
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip
APK generated by 3.1.4 AndroidManifest attributes:
android:versionCode=".."
android:versionName=".."
android:installLocation="1"
package=".."
APK generated by 3.2.1 AndroidManifest attributes:
android:versionCode=".."
android:versionName=".."
android:installLocation="1"
android:compileSdkVersion="28"
android:compileSdkVersionCodename="9"
package=".."
platformBuildVersionCode="same as versionCode"
platformBuildVersionName="same as versionName"
If I downgrade just the version of the gradle build tools from 3.2.1 to 3.1.4 then it's working.
Exception:
12-24 11:55:40.930 1498-1527/system_process W/PackageManager: Failed collect during installPackageLI
android.content.pm.PackageParser$PackageParserException: Failed reading resources.arsc in java.util.jar.StrictJarFile@39b13b4e
at android.content.pm.PackageParser.loadCertificates(PackageParser.java:600)
at android.content.pm.PackageParser.collectCertificates(PackageParser.java:1094)
at android.content.pm.PackageParser.collectCertificates(PackageParser.java:1049)
at com.android.server.pm.PackageManagerService.installPackageLI(PackageManagerService.java:10564)
at com.android.server.pm.PackageManagerService.access$2300(PackageManagerService.java:234)
at com.android.server.pm.PackageManagerService$6.run(PackageManagerService.java:8627)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.os.HandlerThread.run(HandlerThread.java:61)
at com.android.server.ServiceThread.run(ServiceThread.java:46)
Caused by: java.lang.SecurityException: META-INF/MANIFEST.MF has invalid digest for resources.arsc in resources.arsc
at java.util.jar.JarVerifier.invalidDigest(JarVerifier.java:140)
at java.util.jar.JarVerifier.access$000(JarVerifier.java:51)
at java.util.jar.JarVerifier$VerifierEntry.verify(JarVerifier.java:132)
at java.util.jar.JarFile$JarFileInputStream.read(JarFile.java:117)
at android.content.pm.PackageParser.readFullyIgnoringContents(PackageParser.java:5015)
at android.content.pm.PackageParser.loadCertificates(PackageParser.java:597)
at android.content.pm.PackageParser.collectCertificates(PackageParser.java:1094)
at android.content.pm.PackageParser.collectCertificates(PackageParser.java:1049)
at com.android.server.pm.PackageManagerService.installPackageLI(PackageManagerService.java:10564)
at com.android.server.pm.PackageManagerService.access$2300(PackageManagerService.java:234)
at com.android.server.pm.PackageManagerService$6.run(PackageManagerService.java:8627)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.os.HandlerThread.run(HandlerThread.java:61)
at com.android.server.ServiceThread.run(ServiceThread.java:46)
The fix is updating the gradle tools version to 3.3.0-rc1 as Pierre suggested in comments.