现象:由于业务需要将开发的app预置到{MTK平台}Android9.0的系统中,使用platform签名可以正常安装,其它方式均失败。
原因:是由于使用了“APK Signature Scheme v2”签名导致异常。
解决:在app 签名build的时候在config中添加“v2SigningEnabled false”即可,默认值 为true。详细build.gradle的配置参考如下:
apply plugin: 'com.android.application' android { compileSdkVersion 28 buildToolsVersion "28.0.3" defaultConfig { applicationId "com.zn.dpa" minSdkVersion 19 targetSdkVersion 19 multiDexEnabled true } aaptOptions { cruncherEnabled = false useNewCruncher = false } dexOptions { //incremental = true; preDexLibraries = false javaMaxHeapSize "4g" } lintOptions { abortOnError false checkReleaseBuilds false disable "ResourceType" } signingConfigs { release { storeFile file("../key") storePassword "123456" keyAlias "key" keyPassword "654321" v2SigningEnabled false } debug { storeFile file("../key") storePassword "123456" keyAlias "key" keyPassword "654321" v2SigningEnabled false } } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' signingConfig signingConfigs.release } debug { debuggable true signingConfig signingConfigs.debug } } android { compileOptions.encoding = "UTF-8" } repositories { flatDir { dirs 'libs' } } } |