将gradle工具版本从 3.1.4 更新到 3.2.1 后,该应用无法再在Android 6.0上安装,并且在发行版上也无法使用版本(失败[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
由3.1.4 AndroidManifest属性生成的APK:
android:versionCode=".."
android:versionName=".."
android:installLocation="1"
package=".."
由3.2.1 AndroidManifest属性生成的APK:
android:versionCode=".."
android:versionName=".."
android:installLocation="1"
android:compileSdkVersion="28"
android:compileSdkVersionCodename="9"
package=".."
platformBuildVersionCode="same as versionCode"
platformBuildVersionName="same as versionName"
如果我将Gradle构建工具的版本从 3.2.1 降级到 3.1.4 ,则它可以正常工作。
例外:
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)