How to Build apk with Phonegap Cli

Dinesh picture Dinesh · Mar 19, 2016 · Viewed 24.7k times · Source

I Build a apk with phonegap cli, but problem is when I try to install apk with android phone get a Parse Error "There is a problem parsing the package"

What I try to build apk

1)phonegap create my-app com.example.myapp my-app

2)phonegap platform add android

at path /path/to/myproject/platforms/android/cordova run command build --release

I get apk at path/myapp/platforms/android/build/outputs/apk/android-release-unsigned.apk

I tried to install this apk to my phone get error Parse Error "There is a problem parsing the package"

As I search over net this may be problem with sign/key, I found some solutions

first command not work keytool -genkey -v -keystore [keystore_name].keystore -alias [alias_name] -keyalg RSA -keysize 2048 -validity 10000 get error

'keytool' is not recognized as an internal or external command,
operable program or batch file.

Secondly this is for online phone build but I need to create apk with cli.

This also does not suit to me.

Can anyone help me to resolve this issue Thanks in advance for help.

Answer

johnborges picture johnborges · Mar 20, 2016

If your using the CLI for dev purposes just use phonegap build android --debug --device. Your don't need to worry about any signing identity issues this way. For release builds use the other method you were using build --release. After a release build you need to sign the android-release-unsigned.apk before it can be put on a device.

https://developer.android.com/tools/publishing/app-signing.html