简体   繁体   English

INSTALL_PARSE_FAILED_NO_CERTIFICATES 在发布版本上

[英]INSTALL_PARSE_FAILED_NO_CERTIFICATES on a release build

I have the weird issue that my debug version works fine, but after signing and generating an app bundle, which I uploaded to the Play Store, the app immediately crashes (I ran the LogCat on a phone that had the Store-version of my app and I saw it had something to do with AndroidX ConstraintLayout, but no way of reproduce that).我有一个奇怪的问题,我的调试版本工作正常,但在签名并生成一个应用程序包后,我上传到 Play 商店,该应用程序立即崩溃(我在具有应用程序商店版本的手机上运行 LogCat我看到它与 AndroidX ConstraintLayout 有关,但无法重现)。 I reckon there is some difference between the release and debug version, so I set out to debug my release version.我认为releasedebug版本之间存在一些差异,因此我开始调试我的发布版本。

When I do though, Android Studio cannot install the APK with the following error:但是,当我这样做时,Android Studio 无法安装 APK,并出现以下错误:

Installation failed with message INSTALL_PARSE_FAILED_NO_CERTIFICATES: Package /data/app/vmdl1900556551.tmp/base.apk has no certificates at entry AndroidManifest.xml.安装失败并显示消息 INSTALL_PARSE_FAILED_NO_CERTIFICATES: Package /data/app/vmdl1900556551.tmp/base.apk 在条目 AndroidManifest.xml 中没有证书。 It is possible that this issue is resolved by uninstalling an existing version of the apk if it is present, and then re-installing.可以通过卸载现有版本的 apk(如果存在)然后重新安装来解决此问题。

WARNING: Uninstalling will remove the application data!警告:卸载将删除应用程序数据!

Do you want to uninstall the existing application?您要卸载现有的应用程序吗?

I have the signing config in my app.gradle , which uses the same data as my signed and published app:我的app.gradle有签名配置,它使用与我签名和发布的应用程序相同的数据:

android {
    signingConfigs {
        defaultConfig {
            keyAlias 'solaredge-notifier'
            keyPassword '******'
            storeFile file('/path/to/KeyStore.jks')
            storePassword '*****'
        }
    }
    compileSdkVersion 28
    defaultConfig {
        applicationId "nl.friesoft.solaredgenotifier"
        minSdkVersion 23
        targetSdkVersion 27
        versionCode 2
        versionName "1.1"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
            debuggable true
            signingConfig signingConfigs.defaultConfig
        }
    }
}

I am a little lost here now (and, quite frankly, a little pissed because I have published a crashing app on the Play Store).我现在有点迷茫(坦率地说,有点生气,因为我在 Play 商店发布了一个崩溃的应用程序)。

If you would like to check the live app, it is here: https://play.google.com/store/apps/details?id=nl.friesoft.solaredgenotifier&hl=en如果您想查看实时应用程序,请访问: https : //play.google.com/store/apps/details?id=nl.friesoft.solaredgenotifier&hl=en

Before (re)generating your certificate, please try this:在(重新)生成证书之前,请尝试以下操作:

Does your device's Android SDK version fall within the range specified by the minSdkVersion and compileSdkVersion?您设备的Android SDK版本是否在minSdkVersion和compileSdkVersion指定的范围内?

At the very least your device's SDK version must comply with the minSdkVersion.至少您设备的 SDK 版本必须符合 minSdkVersion。

Try it.尝试一下。 Speaking from my experience, when i deployed to a device with an SDK version outside the minSdkVersion and compileSdkVersion range, i got this error: 'The application could not be installed: INSTALL_PARSE_FAILED_NO_CERTIFICATES'.根据我的经验,当我部署到 SDK 版本超出 minSdkVersion 和 compileSdkVersion 范围的设备时,我收到此错误:“无法安装应用程序:INSTALL_PARSE_FAILED_NO_CERTIFICATES”。

I modified the range to include my device's SDK version, and voilà!我修改了范围以包含我设备的 SDK 版本,瞧!

Steps to generate signed apk:生成签名apk的步骤:

1 – Build release unsigned apk. 1 – 构建发布未签名的 apk。

2 – Zip align unsigned APK using the command prompt. 2 – 使用命令提示符压缩对齐未签名的 APK。

zipalign -v -p 4 my-app-unsigned.apk my-app-unsigned-aligned.apk

3 – Sign the APK with Sonim private key using the app signer via command prompt. 3 – 通过命令提示符使用应用程序签名者使用 Sonim 私钥对 APK 进行签名。

apksigner sign --ks my-release-key.jks --out my-app-release.apk my-app-unsigned-aligned.apk

4 – Install the signed apk in device. 4 – 在设备中安装已签名的 apk。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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