提示内容如下:[INSTALL_PARSE_FAILED_NO_CERTIFICATES: Failed to collect certificates from /data/app/vmdl979122267.tmp/base.apk: Attempt to get length of null array]
- openssl pkcs8 -inform DER -nocrypt -in platform.pk8 -out platform.pem
-
- openssl pkcs12 -export -in platform.x509.pem -out platform.p12 -inkey platform.pem -password pass:pwdpwd -name platform
-
- keytool -importkeystore -deststorepass android -destkeystore ./platform.jks -srckeystore ./platform.p12 -srcstoretype PKCS12 -srcstorepass pwdpwd
- signingConfigs {
- platform {
- //将系统签名文件platform.keystore 放在projectName/app/ 目录下
- storeFile file('platform.keystore')
- storePassword 'pwdpwd' // 对应-srcstorepass
- keyAlias 'platform' //对应-name
- keyPassword 'pwdpwd' // 对应-pass
- }
- }
- buildTypes {
- release {
- minifyEnabled false
- proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
- signingConfig signingConfigs.platform
- }
- debug {
- minifyEnabled false
- proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
- signingConfig signingConfigs.platform
- }
- }
小tips:如果不用[Build--Build Bundle(s)--Build APK(s)] 该步骤打包,直接run 运行编译apk也可以得到最新的apk。但直接run到真机和手动双击安装apk之间存在差异。run 可以安装成功不代表双击安装apk也可以成功。
- signingConfigs {
- platform {
- storeFile file('platform.keystore')
- storePassword 'android'
- keyAlias 'androiddebugkey'
- keyPassword 'android'
- v1SigningEnabled true
- v2SigningEnabled false
- }
- }
-
- <manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.huawei.hicar"
- android:sharedUserId="android.uid.system"
- android:testOnly="false">
-
- plugins {
- id 'com.android.application'
- }
-
- android {
- compileSdk 28
-
- defaultConfig {
- applicationId "xxxx.xxx.xxx" //对应自身应用包名
- minSdk 28
- targetSdk 28
- versionCode 1
- versionName "1.0"
-
- testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
- }
- signingConfigs {
- platform {
- storeFile file('platform.keystore')
- storePassword 'pwdpwd'
- keyAlias 'platform'
- keyPassword 'pwdpwd'
- v1SigningEnabled true
- v2SigningEnabled false
- }
- }
- buildTypes {
- release {
- minifyEnabled false
- proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
- signingConfig signingConfigs.platform
- }
- debug {
- minifyEnabled false
- proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
- signingConfig signingConfigs.platform
- }
- }
- compileOptions {
- sourceCompatibility JavaVersion.VERSION_1_8
- targetCompatibility JavaVersion.VERSION_1_8
- }
- }
- dependencies {
- implementation fileTree(dir: 'libs', include: ['*.aar', '*.jar'], exclude: [])
- api 'com.google.zxing:core:3.3.0'
-
-
- }
- <?xml version="1.0" encoding="utf-8"?>
- <manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.huawei.hicar"
- android:sharedUserId="android.uid.system"
- android:testOnly="false">
- .........
-
- </manifest>