Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fix INSTALL_PARSE_FAILED_NO_CERTIFICATES for xiaomi/redmi/miui while debugging?

I only have this error message when using my xiaomi redmi note 7 (pie). I was using my previous phone is redmi 2 and still work. I try to debug from flutter or android studio project still got the same error. When I want to try debug to my friend phone Samsung A50 it's working perfectly. I was try anything from this answer but none of its working for me.

From Flutter

Error: ADB exited with exit code 1
Performing Streamed Install

adb: failed to install D:\pks\flutter\delisia\build\app\outputs\apk\app.apk: Failure [INSTALL_PARSE_FAILED_NO_CERTIFICATES: Failed to collect certificates from /data/app/vmdl1357086466.tmp/base.apk using APK Signature Scheme v2: SHA-256 digest of contents did not verify]
Error launching application on Redmi Note 7.

From Android Studio

11:12 AM    Session 'app': Installation did not succeed.
                    The application could not be installed: INSTALL_PARSE_FAILED_NO_CERTIFICATES
                    Retry

11:14 AM    Executing tasks: [:app:assembleDebug] in project D:\kuliah\Aplikasi\MoLearn

11:14 AM    Gradle build finished in 7 s 93 ms

11:14 AM    Failed to commit install session 652017913 with command cmd package install-commit 652017913. Error: INSTALL_PARSE_FAILED_NO_CERTIFICATES: Failed to collect certificates from /data/app/vmdl652017913.tmp/0_app-debug using APK Signature Scheme v2: SHA-256 digest of contents did not verify

11:14 AM    Session 'app': Installation did not succeed.
                    The application could not be installed: INSTALL_PARSE_FAILED_NO_CERTIFICATES
                    Retry

So, i can debug using my phone, I'm only can debug from my emulator nox and its so slow. But i dunno why somethime the app is installed on my phone redmi note 7, and when i try to update some code the app is uninstalled automatically and the error is showing again.

I can install my own app from play store, but its an release app. I can't debug from it.

like image 909
Nanda R.M Avatar asked Feb 13 '20 04:02

Nanda R.M


3 Answers

Go to Phone Developer Settings.

and on/off the verify apps over USB enter image description here

like image 110
Anil Mehta Avatar answered Nov 17 '22 01:11

Anil Mehta


In my case I was getting this error when trying to run flutter in release mode (flutter run --release) and it was because my app level build gradle (..android/app/build.gradle) wasn't set up correctly.

You need to make sure you have "signingConfigs" object inside of the "android" object, and also the corresponding "buildType" set up

e.g.

android {
    compileSdkVersion 30

    lintOptions {
        disable 'InvalidPackage'
    }

    signingConfigs {
        release {
            storeFile file('<path to key store file>')
            storePassword '<key store password>'
            keyAlias '<key alias>'
            keyPassword '<key password>'
        }
        debug {
            storeFile file('<path to key store file>')
            storePassword '<key store password>'
            keyAlias '<key alias>'
            keyPassword '<key password>'
        }
    }  

    defaultConfig {
        applicationId "XXXXXXXXXXX"
        minSdkVersion 21
        targetSdkVersion 30
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
    }

    buildTypes {
        release {
            signingConfig signingConfigs.release
        }
        debug {
            signingConfig signingConfigs.debug
        }
    }
}
like image 28
Chris Avatar answered Nov 16 '22 23:11

Chris


in your android/app/build.gradle at the bottom of the android section, add build types:

android{
  ...
   buildTypes {
    release {
        signingConfig signingConfigs.debug
    }
   }
}

in case of release you may need to change the .debug to .release. It fixed my problem :D

like image 2
Ayyaz meo Avatar answered Nov 17 '22 00:11

Ayyaz meo