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.
After some poking around, I finally got adb to install the app successfully & have it running on my phone by following these steps:
ionic build android --debug.
- Rename the generated
android-debug.zip. Delete the
- 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.
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!