Phonegap: Compile with CLI-6.5

Phonegap: Compile with CLI-6.5

Hello I've tried to compile in PhoneGap my Android project made by XDK. No errors if I compile leaving CLI-6.2, If I remove CLI tag from config.xml file generated after exporting from XDK, PhoneGap Android build fails (while iOs build is ok).

I've attached PhoneGap build Android Log.

Downloadtext/plain phonegap-android-build.txt6.85 KB
13 posts / 0 new

I had the same problem in build cordova.

change xwalk version as is :  <plugin name="cordova-plugin-crosswalk-webview" version="2.2.0" />

thank you! it fixed my problem!

only 1 problem:

If I try to update my previous app installed it says "Unable to install". As if changing CLI creates problems. What I have to do? I cannot say to my users to uninstall and install again!


Alessandro S. wrote:

If I try to update my previous app installed it says "Unable to install". As if changing CLI creates problems. What I have to do? I cannot say to my users to uninstall and install again!

I suspect it is a versionCode problem. When building for Android the versionCode is modified as a function of how the app is built. My suspicion is your versionCode in the PhoneGap built app may be lower than that in the old app. You can get the existing versionCode from the Google app store and you can inspect the APK that was built by PhoneGap Build to see what versionCode is assigned to that APK. If the new one is less then or equal to the old one, that is probably the problem. See this article for a few notes regarding how the versionCode is set.

Most solutions for inspecting the versionCode in an APK involve using aapt, which is a tool that is part of Android Studio. If you have that tool, then find one of those instructions for checking the versionCode in your APK. Another option is a new tool from Google called ClassyShark, which might work. I have not installed or tried it (I use the aapt process), but if you don't want to install Android Studio just to get a copy of aapt, the ClassyShark solution might be a good one to try.

Hello my tries have been the following:
Starting from the app version 2.1.54 ( app version and app version code set in XDK as I did in last 2 years) installed from the store (built with XDK no phonegap), I've compiled a new version 2.1.58 (by changing in XDK version and version code) by exporting to Phonegap (CLI 6.2). This app replaces the original One. Then I installed the original version 2.1.54 from the store and I've modified the config.xml of version 2.1.58 to remove preference for CLI and correct webview plugin version. The phonegap build now doesn't replace the original one (app not installed error). If I remove the original one the new 2.1.58 version can be installed

The "app version" does nothing, it is for display in the store, only. You need to modify the "app version code" in the Build Settings (you'll also find a reference to it in the <widget> header in the android-versionCode field). Please read this doc that I pointed you to in a previous post > <

Your description is confusing. It sounds like you did this:

  • original version 2.1.54 from the store (what is the versionCode???) already installed on device and available in the store
  • created new version 2.1.58 with PGB (what is the versionCode???)
  • attempt to install new version, but install fails

What is the versionCode for the copy that is in the store? What is the versionCode for the one you built with PGB? That is the important data that is needed to debug this. Please see my previous post for information on how to get those numbers. Without that information we cannot make any progress.


sorry :(

I set App Version and VersionCode to the same value, always ( as you can see from my attachment). I did it from the starting.

So version 2.1.54 has 2154 as versionCode, version 2.1.56 has 2156 and version 2.1.58 has 2158.

I repeat my steps

1) I have my XDK build version 2.1.54 (2154 versioncode) downloaded and installed from Store

2) I build my PhoneGap version 2.1.58 (2158 versioncode) CLI 6.2 and I try to update my installation 2.1.54. The update is OK

3) now I uninstall and install back 2.1.54 from Store

4) I build my PhoneGap version 2.1.58 (2158 versioncode) CLI 6.5 and WebView Plugin Version set to 2.2.0 and I try to update my installation 2.1.54. The update FAILS with error (Cannot install App).

So the problem seems to be CLI 6.5 or WebView version not the versioncode, IMO



Downloadimage/png Immagine.png21.41 KB

The versionCode may still be the culprit, since the Cordova project has monkeyed with the way the versionCode that is inserted into the built APK multiple times. I do not know if they have done it again, but it should be checked to be sure it is or is not the source the problem. It should not be assumed that you are getting "the right thing."

It is also possible it has something to do with the CLI 6.5 build, but let's be sure the versionCode is not the fault, first.

ok but why the error occurs only with CLI 6.5? the version with CLI 6.2 and same VersionCode setup is ok

We do not yet know if the versionCode is changing when you build with 6.5. We only know that we need to first get accurate versionCode data for ALL of your builds so we can determine if it is the cause or eliminate it as the cause, especially since a bad versionCode is the most frequent reason for the problem you are seeing.

We cannot assume that the results you get with 6.5 will be the same as what you get with 6.2, they are different versions and the Cordova group has made changes in the past that have affected things like this, so there are no guarantees that every new version works like the last.

Perfect, so what I have to do?

Leave a Comment

Please sign in to add a comment. Not a member? Join today