4

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). I reckon there is some difference between the release and debug version, so I set out to debug my release version.

When I do though, Android Studio cannot install the APK with the following error:

Installation failed with message INSTALL_PARSE_FAILED_NO_CERTIFICATES: Package /data/app/vmdl1900556551.tmp/base.apk has no certificates at entry 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.

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:

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).

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

Bart Friederichs
  • 30,888
  • 13
  • 85
  • 169
  • If you [use `keytool` to examine your signed APK](https://stackoverflow.com/q/11331469/115145), is it signed as you expect? – CommonsWare Feb 17 '19 at 18:26
  • @CommonsWare do you mean the one I try to debug? – Bart Friederichs Feb 17 '19 at 18:29
  • I mean the one that is resulting in the `INSTALL_PARSE_FAILED_NO_CERTIFICATES` install error. You are trying to sign it -- is it signed? Or are you accidentally using an unsigned copy of the APK? – CommonsWare Feb 17 '19 at 18:31
  • @CommonsWare I set Android Studio to build variant "release" and I push Shift-F9 to debug it. I am checking with `keytool` now. – Bart Friederichs Feb 17 '19 at 18:32
  • There is no RSA file in META-INF in the APK. It seems unsigned. – Bart Friederichs Feb 17 '19 at 18:33
  • It would appear that the APK is indeed unsigned. The `assembleRelease` Gradle task should sign it, and I normally create my APKs through that task. Build > Generate Signed Bundle / APK in Android Studio should also create a signed APK. – CommonsWare Feb 17 '19 at 18:36
  • I could create a signed APK, but how to debug that release build, to make sure the problem I get from the "Store version" can be reproduced (and thus fixed). – Bart Friederichs Feb 17 '19 at 18:41
  • You have marked it as `debuggable true`. In theory, if you run the app manually from the device, you should be able to use Run > Attach to Process to connect the debugger. That won't help in your case, due to the "immediately crashes" part. Since you have `minifyEnabled false`, I'm not sure what is really different between the `debug` and `release` builds other than the signing keys. You might consider using the APK Analyzer to see if there are gross differences (e.g., your `release` build doesn't include `ConstraintLayout` for some reason). – CommonsWare Feb 17 '19 at 18:48
  • When just plainly putting the APK on the phone and it works fine. I suspect there is some issue in the Android Bundle. I will re-release using an APK now, see if that fixes the issue. – Bart Friederichs Feb 17 '19 at 18:53
  • It gets stranger, when using "Generate Signed Bundle/APK", it goes through all the steps, and then just generates an unsigned APK.... – Bart Friederichs Feb 17 '19 at 18:59
  • I had the same problem. Doing a Build->Clean Project first solved it. – Lawrence Kesteloot Mar 12 '19 at 22:16

2 Answers2

1

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?

At the very least your device's SDK version must comply with the 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'.

I modified the range to include my device's SDK version, and voilà!

reymalahay
  • 11
  • 1
  • 1
  • 2
0

Steps to generate signed apk:

1 – Build release unsigned apk.

2 – Zip align unsigned APK using the command prompt.

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.

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

4 – Install the signed apk in device.

ilke444
  • 2,366
  • 1
  • 15
  • 29