Hello,
For a project I have been developing the past few weeks, I have been using the ionic command: ionic build android --debug
to build the APK file, then using adb install ~/project-name/platforms/android/build/outputs/apk/android-debug.apk
to install the debug build on a tester phone.
That’s all good and well until sometime last week I realized whenever I run adb install
on a fresh build, I’m getting a [INSTALL_PARSE_FAILED_NO_CERTIFICATES] Failure that wasn’t an issue before.
I tried manually signing my apk file with jarsigner, but the error I get back indicates my generated apk file is already signed. Suspecting my debug.keystore in ~/.android
is outdated, I deleted the existing one before running the build step again to create a new debug.keystore, but it still looks like my apk file wasn’t properly signed when I run the ionic build step. I also tried deleting the platforms
folder and run ionic state reset
to re add the platforms. But the error still persists.
See details here
After some poking around, I finally got adb to install the app successfully & have it running on my phone by following these steps:
- Run
ionic build android --debug
.
- Rename the generated
android-debug.apk
file to android-debug.zip
.
- Unzip
android-debug.zip
. Delete the META-INF
folder.
- Rezip the contents and rename it back to ```android-debug.apk`.
- Manually sign the apk file:
jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore ~/.android/debug.keystore android-debug.apk androiddebugkey
.
See stackoverflow thread here
My system info:
Cordova CLI: 6.5.0
Ionic Framework Version: 3.4.2
Ionic CLI Version: 2.2.3
Ionic App Lib Version: 2.2.1
Ionic App Scripts Version: 1.3.7
ios-deploy version: 1.9.1
ios-sim version: 5.0.13
OS: macOS Sierra
Node Version: v6.10.2
Xcode version: Xcode 8.3.2 Build version 8E2002
That said, I’m not sure why ionic build is not signing the apk file properly. Is there a way to fix this issue without me having to manually remove the META-INF folder and resigning the debug key every time I build? Thank you!
I’m not familiar with the error, but is there a reason you aren’t using version 3 of the cli? Maybe it’s an issue that was fixed in the new version.
(To be honest I didn’t even know debug builds had to be signed at all on Android…)
I just updated CLI to v. 3.4.0. Still getting the same error 
According to docs, every app to be installed on a phone (debug or release) have to be signed. But usually for debug builds, one does not have to do that manually because android studio automatically generates a debug.keystore and sign the generated apk package with it. Upon looking into ~/.android
I can see a debug.keystore is being correctly generated at each ionic build android
; it just isn’t being signed onto my apk package correctly since 2 weeks ago.
Interesting. Normally Ionic CLI (and Cordova CLI that is used in the background) takes care of all this automatically.
Have you tried it with a newly created project (ionic start blank blank
) to see if this is a problem with your system or “just” your project yet?
A brand new repo seems to be working fine with ionic CLI v.3.4.0 (with ionic cordova build android --debug
). adb installed the blank app without issues. I’m not sure what changed in my project that’s causing the build step to fail to sign the debug app.
Strange. I would try to explicitly remove and re-add the platform, sometimes that fixes things that have gone wrong.
I tried deleting and re-adding the platform again with ionic CLI v.3.4.0. Still no dice. Starting to run out of ideas of things to try. 
Maybe a right problem? Check out the project completely new in another folder and try there again 
A Google search on the error indicates that this can be an issue with the gradle plugin. Maybe it isn’t an Ionic problem. If you solve this, I’d be interested to know.
After 2 full work days debugging the app, the error seems to happen after adding some images within src/assets/img
.
In our app, we have a bunch of PNG images to be embedded within some pages. We have some sub-directories under src/assets/img/
that contains images for different sections of our app.
I have successfully built and installed our app on a cloned project of an earlier branch where images have NOT been added to the project. Cloning our current branch results in the same error when installing the generated apk package. Then, as soon as I copy that particular image folder from the current repo to the cloned project within src/assets
and rebuild with ionic cordova build android
, I get the good ol’ [INSTALL_PARSE_FAILED_NO_CERTIFICATES]
failure.
Adding this image folder once seems to have broke the android build process for good, as I removed the problematic image folder from both src/assets/img
and www/assets/img
but the error persisted. It seems the only way to get rid of this signing error is to re-add the android platform with cordova platform add android
.
The size of this folder is 4.8 MB btw. It contains only PNG files.
Would this be caused by the images in /assets exceeding a limit?? What I don’t understand is that why SDK signs a bad signature due to this…Trying to investigate further now.
EDIT: I think I got our current repo working!! In that image folder there was a file that I presume was accidentally created (the file name is ‘Icon?’). I removed that file, re-added android platform and everything seems to be working now. Took me so long to debug because this had be the most confusing error I’ve ever gotten…
Can you tell us a bit more about that file? Just Icon
? Was it empty or did it contain anything? Can you break a newly created project by copying that file over there?
Sorry for the delay. It seems like Icon?
was an empty file that was created by mistake. By including that broken file into a brand new repo it immediately breaks the build and prevents SDK from signing the debug.keystore properly. My guess is that the question mark at the end of the file name includes an escape backslash that messes up with the build somehow?
Either way, but removing that file and re-adding the platforms seems to have solve the issue.
1 Like
Wow, what a strange case. Thank for reporting back!