The package appears to be currupted

Hi there
I’m trying to build my app with a release version but when I install it it always gives me (The package appears to be currupted)
I also tried to create a new app and then build it with release and prod, the problem still the same.
But with debug version it works fine.
I tried to use both release and prod.
I tried to install it in different device.
All attempts failed
Hope you can help me
Thank you

1 Like

Signing issue?

Android or iOS?

What command are you using to build?
What is your ionic info output?

Building Android released app

@ionic/cli-utils  : 1.13.0
ionic (Ionic CLI) : 3.13.0

global packages:

cordova (Cordova CLI) : 6.5.0

local packages:

@ionic/app-scripts : 3.0.0
Cordova Platforms  : android 6.1.2
Ionic Framework    : ionic-angular 3.7.1

System:

Node : v6.11.4
npm  : 3.10.10
OS   : Windows 7

If there is no reason to keep these versions, update them.

We also still need the exact command you are executing to build.

ionic cordova build android --release
&
ionic cordova build android --prod --release

Build process is fine? No error messages?

Can you install when you just run ionic cordova build android?

Yes, it builds fine. But during installation it shows the package appears to be corrupted.
ionic cordova build android with this command the app works fine

What is your keystore configuration?

Today, I have reinstall Android Studio and install the SDK and required tools and platforms. Also I have reinstall Node.js, Ionic, and cordova.

Ionic Info when creating a new app

@ionic/cli-utils  : 1.13.0
ionic (Ionic CLI) : 3.13.0

local packages:

@ionic/app-scripts : 3.0.0
Ionic Framework    : ionic-angular 3.7.1

System:

Node : v6.11.4
npm  : 3.10.10
OS   : Windows 7

Misc:

backend : legacy

Cordova requirements
Requirements check results for android:
Java JDK: installed 1.8.0
Android SDK: installed true
Android target: installed android-26,android-25
Gradle: installed C:\Program Files\Android\Android Studio\gradle\gradle-3.2\bin
gradle

Now when running this command line
ionic cordova platform add android
It gave me the following error
x Running command - failed!
[ERROR] Exception: Using cordova-fetch for cordova-android@~6.3.0

    Adding android project...
    Creating Cordova project for the Android platform:
            Path: platforms\android
            Package: io.ionic.starter
            Name: MyApp
            Activity: MainActivity
            Android target: android-26
    Subproject Path: CordovaLib
    Android project created with cordova-android@6.3.0
    Discovered plugin "ionic-plugin-keyboard" in config.xml. Adding it to
    the project
    Installing "ionic-plugin-keyboard" for android
    Adding ionic-plugin-keyboard to package.json
    Saved plugin info for "ionic-plugin-keyboard" to config.xml
    Discovered plugin "cordova-plugin-whitelist" in config.xml. Adding it to

    the project
    Installing "cordova-plugin-whitelist" for android

                    This plugin is only applicable for versions of
    cordova-android greater than 4.0. If you have a previous platform
    version, you do *not* need this plugin since the whitelist will be built

    in.

    Adding cordova-plugin-whitelist to package.json
    Saved plugin info for "cordova-plugin-whitelist" to config.xml
    Discovered plugin "cordova-plugin-statusbar" in config.xml. Adding it to

    the project
    Failed to restore plugin "cordova-plugin-statusbar" from config.xml. You

    might need to try adding it again. Error: Failed to fetch plugin
    https://github.com/apache/cordova-plugin-statusbar.git via registry.
    Probably this is either a connection problem, or plugin spec is
    incorrect.
    Check your connection and plugin name/version/URL.
    Error: cmd: Command failed with exit code 1 Error output:
    npm ERR! git clone
    C:\Users\MYPC\AppData\Roaming\npm-cache\_git-remotes\git-https-github-

com-apache-cordova-plugin-statusbar-git-c66a3d92
C:\Users\MYPC\AppData\Local\Temp\npm-6324-c6c4d5ad\git-cache-58fe1520
08127bf674bcfc5a161466a4c19e8fd21f726892:
Cloning into
’C:\Users\MYPC\AppData\Local\Temp\npm-6324-c6c4d5ad\git-cache-58fe1520
\08127bf674bcfc5a161466a4c19e8fd21f726892’…
npm ERR! git clone
C:\Users\MYPC\AppData\Roaming\npm-cache_git-remotes\git-https-github-
com-apache-cordova-plugin-statusbar-git-c66a3d92
C:\Users\MYPC\AppData\Local\Temp\npm-6324-c6c4d5ad\git-cache-58fe1520
08127bf674bcfc5a161466a4c19e8fd21f726892:
git-upload-pack
’C:\Users\MYPC\AppData\Roaming\npm-cache_git-remotes\git-https-github
-com-apache-cordova-plugin-statusbar-git-c66a3d92’:
git-upload-pack: command not found
npm ERR! git clone
C:\Users\MYPC\AppData\Roaming\npm-cache_git-remotes\git-https-github-
com-apache-cordova-plugin-statusbar-git-c66a3d92
C:\Users\MYPC\AppData\Local\Temp\npm-6324-c6c4d5ad\git-cache-58fe1520
08127bf674bcfc5a161466a4c19e8fd21f726892:
fatal: Could not read from remote repository.
npm ERR! git clone
C:\Users\MYPC\AppData\Roaming\npm-cache_git-remotes\git-https-github-
com-apache-cordova-plugin-statusbar-git-c66a3d92
C:\Users\MYPC\AppData\Local\Temp\npm-6324-c6c4d5ad\git-cache-58fe1520
08127bf674bcfc5a161466a4c19e8fd21f726892:

    npm ERR! git clone
    C:\Users\MYPC\AppData\Roaming\npm-cache\_git-remotes\git-https-github-

com-apache-cordova-plugin-statusbar-git-c66a3d92
C:\Users\MYPC\AppData\Local\Temp\npm-6324-c6c4d5ad\git-cache-58fe1520
08127bf674bcfc5a161466a4c19e8fd21f726892:
Please make sure you have the correct access rights
npm ERR! git clone
C:\Users\MYPC\AppData\Roaming\npm-cache_git-remotes\git-https-github-
com-apache-cordova-plugin-statusbar-git-c66a3d92
C:\Users\MYPC\AppData\Local\Temp\npm-6324-c6c4d5ad\git-cache-58fe1520
08127bf674bcfc5a161466a4c19e8fd21f726892:
and the repository exists.
npm ERR! git clone
C:\Users\MYPC\AppData\Roaming\npm-cache_git-remotes\git-https-github-
com-apache-cordova-plugin-statusbar-git-c66a3d92
C:\Users\MYPC\AppData\Local\Temp\npm-6324-c6c4d5ad\git-cache-58fe1520
08127bf674bcfc5a161466a4c19e8fd21f726892:

    npm ERR! Windows_NT 6.1.7601
    npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program
    Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install"
    "https://github.com/apache/cordova-plugin-statusbar.git" "--production"

    "--save"
    npm ERR! node v6.11.4
    npm ERR! npm  v3.10.10
    npm ERR! code 128

    npm ERR! Command failed: git -c core.longpaths=true clone
    C:\Users\MYPC\AppData\Roaming\npm-cache\_git-remotes\git-https-github-

com-apache-cordova-plugin-statusbar-git-c66a3d92
C:\Users\MYPC\AppData\Local\Temp\npm-6324-c6c4d5ad\git-cache-58fe1520
08127bf674bcfc5a161466a4c19e8fd21f726892
npm ERR! Cloning into
’C:\Users\MYPC\AppData\Local\Temp\npm-6324-c6c4d5ad\git-cache-58fe1520
\08127bf674bcfc5a161466a4c19e8fd21f726892’…
npm ERR! git-upload-pack
’C:\Users\MYPC\AppData\Roaming\npm-cache_git-remotes\git-https-github
-com-apache-cordova-plugin-statusbar-git-c66a3d92’:
git-upload-pack: command not found
npm ERR! fatal: Could not read from remote repository.
npm ERR!
npm ERR! Please make sure you have the correct access rights
npm ERR! and the repository exists.
npm ERR!
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! https://github.com/npm/npm/issues

    npm ERR! Please include the following file with any support request:
    npm ERR!     C:\Users\MYPC\Desktop\apptesting\npm-debug.log
    Discovered plugin "cordova-plugin-device" in config.xml. Adding it to
    the project
    Installing "cordova-plugin-device" for android
    Adding cordova-plugin-device to package.json
    Saved plugin info for "cordova-plugin-device" to config.xml
    Discovered plugin "cordova-plugin-splashscreen" in config.xml. Adding it

    to the project
    Installing "cordova-plugin-splashscreen" for android
    Adding cordova-plugin-splashscreen to package.json
    Saved plugin info for "cordova-plugin-splashscreen" to config.xml
    Discovered plugin "cordova-plugin-ionic-webview" in config.xml. Adding
    it to the project
    Installing "cordova-plugin-ionic-webview" for android
    Adding cordova-plugin-ionic-webview to package.json
    Saved plugin info for "cordova-plugin-ionic-webview" to config.xml
    --save flag or autosave detected
    Saving android@~6.3.0 into config.xml file ...

And when running Ionic info again, it shows the following

@ionic/cli-utils  : 1.13.0
ionic (Ionic CLI) : 3.13.0

global packages:

cordova (Cordova CLI) : 7.1.0

local packages:

@ionic/app-scripts : 3.0.0
Cordova Platforms  : android 6.3.0
Ionic Framework    : ionic-angular 3.7.1

System:

Android SDK Tools : 26.0.2
Node              : v6.11.4
npm               : 3.10.10
OS                : Windows 7

Misc:

backend : legacy

When I run the following command
ionic cordova build android
It builds the app successfully: android-debug.apk and it is installed successfully.

And when I run the following command
ionic cordova build android --release
It builds the app successfully: android-release-unsigned.apk but it cannot be installed. it show the package appears to be corrupted.

When running:
keytool -genkey -v -keystore apptest.keystore -alias apptest -keyalg RSA -keysize 2048 -validity 10000

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

It has to be signed to be installable.

keytool is only available in specific folders, depending on your local installation.

2 Likes

Here is my keytool
C:\Program Files\Java\jre1.8.0_144\bin

I have add this to environment variables (PATH)
But still gave me error

In Powershell you have to add ./ in front of the commands.

still getting ‘keytool’ is not recognized as an internal or external command,

Finally, solved. Thank you so much for your helps.
keytool was not recognized because there was some error in my PATH variable.
Now my application is installed.
Thanks again.

2 Likes

may i know what was your problem? I am also facing the same issue now.