51

I downloaded Myfiles.apk from the internet and I'm trying to install it to my Android emulator.

While installing Myfiles.apk file through the command prompt, I'm getting this error.

I tried following in command prompt

C:\android-sdk\tools> adb -s emulator-5554 install C:\Users\Me\Desktop\MyFiles.apk

How do I install this APK to the emulator correctly?

Michael Celey
  • 12,645
  • 6
  • 57
  • 62
sid123
  • 519
  • 1
  • 6
  • 7
  • Possible duplicate of [What is INSTALL\_PARSE\_FAILED\_NO\_CERTIFICATES error?](http://stackoverflow.com/questions/2914105/what-is-install-parse-failed-no-certificates-error) – Paul Ratazzi Mar 29 '17 at 15:09

3 Answers3

45

This site helped me a lot to properly sign the unsigned apk. But,for the last process i.e. for jarsigner,following command need to be used

jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore my-release-key.keystore    my_application.apk alias_name.

Further do look upon this unable to sign zipexception if you encounter with any zipexception error . So overall,use following procedure

  1. keytool -genkey -v -keystore debug.keystore -alias android -keyalg RSA -keysize 2048 -validity 20000
  2. jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore my-release-key.keystore yourapkalign.apk alias_name
  3. zipalign -v 4 yourapk.apk yourapkalign.apk

Now,you can successfully install the apk file.

Community
  • 1
  • 1
laaptu
  • 2,963
  • 5
  • 30
  • 49
  • 6
    `zipalign -v apkfile` is not sufficient, you need to execute `zipalign -v 4 apkfile` you need to provide align size. – DevZer0 Feb 26 '14 at 09:10
  • 4
    Also, I have been told that you need to run zipalign last, or jarsigner breaks the alignment. – Erhannis Mar 29 '14 at 02:42
  • 2
    I am trying to install app to my phone. I've executed all the above commands. (Though I think the second one should be `... -keystore debug.keystore ...`. But I am getting the following error: >Failure [INSTALL_PARSE_FAILED_NO_CERTIFICATES: Failed to collect certificates from /data/app/vmdl840513344.tmp/base.apk: META-INF/MYKEY.SF indicates /data/app/vmdl840513344.tmp/base.apk is signed using APK Signature Scheme v2, but no such signature was found. Signature stripped?] – LRDPRDX Jul 24 '18 at 10:17
  • 2021 and also getting this same error as @LRDPRDX . Any solution? – DARKGuy Apr 22 '21 at 23:09
  • For Android 11 (No signature found in package of version 2 or newer): zipalign first, then instead of jarsign: `apksigner sign --ks ~/.android/debug.keystore --ks-key-alias someKey foo.apk` – sirbrialliance Jun 11 '22 at 20:32
11

It means that the apk you downloaded hasn't been signed with any certificate, debug or otherwise.

You can sign it from the command line, as described here.

Raghav Sood
  • 81,899
  • 22
  • 187
  • 195
1

You can use the androiddebugkey the sign the apk.

The keystore lives in ~/.android, named debug.keystore.

Run

keytool -list -keystore ~/.android/debug.keystore

To see the debug key, we can see its name is androiddebugkey

Run the following command to sign the apk.

jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore ~/.android/debug.keystore yourapp-release.apk androiddebugkey
Eric Liu
  • 1,516
  • 13
  • 19