Cordova build error after update to 3.5.0
Asked Answered
C

6

7

I have an Android Cordova app that built perfectly on Cordova 3.4. I just update to Cordova 3.5.0 and the build fails, showing these errors:

-code-gen:
[mergemanifest] Found Deleted Target File
[mergemanifest] Merging AndroidManifest files into one.
[mergemanifest] Manifest merger disabled. Using project manifest only.
     [echo] Handling aidl files...
     [aidl] No AIDL files to compile.
     [echo] ----------
     [echo] Handling RenderScript files...
     [echo] ----------
     [echo] Handling Resources...
     [aapt] Found Deleted Target File
     [aapt] Generating resource IDs...
     [aapt] D:\Proyectos\Trialtea\Proyecto 31 - Aplicaciones HTML5\05. Aplicaciones Google Play\phonegap_projects\InglesEn100DiasTurbo\platforms\andro
id\ant-build\AndroidManifest.xml:2: error: Error: Float types not allowed (at 'versionCode' with value 'NaN').

BUILD FAILED
D:\Recursos\Android_Development\adt-bundle-windows-x86_64-20130729\sdk\tools\ant\build.xml:653: The following error occurred while executing this line
:
D:\Recursos\Android_Development\adt-bundle-windows-x86_64-20130729\sdk\tools\ant\build.xml:698: null returned: 1

Total time: 5 seconds
Error code 1 for command: cmd with args: /s,/c,ant,debug,-f,D:\Proyectos\Trialtea\Proyecto 31 - Aplicaciones HTML5\05. Aplicaciones Google Play\phoneg
ap_projects\InglesEn100DiasTurbo\platforms\android\build.xml,-Dout.dir=ant-build,-Dgen.absolute.dir=ant-gen
Error: cmd: Command failed with exit code 2
    at ChildProcess.whenDone (C:\Users\Albert\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\src\cordova\superspawn.js:135:23)
    at ChildProcess.EventEmitter.emit (events.js:98:17)
    at maybeClose (child_process.js:743:16)
    at Process.ChildProcess._handle.onexit (child_process.js:810:5)

There's an error on line 15 about Error: Float types not allowed (at 'versionCode' with value 'NaN', which I don't know why it happens. I have in my project's root the config.xml file with version code set to 3, but for some reason, when I build the project, the AndroidManifest.xml is set with versionCode="NaN".

The error shown at the end I have no idea what it means or if it's related to the error above.

Could anyone help me figure this out?

Oh, after updating Cordova via npm I also updated the Android platform in the projects folder using cordova platform update android.

Cardew answered 15/7, 2014 at 17:33 Comment(0)
V
17

I have solved this changing the "version" attribute in www/config.xml (even if it seems unrelated because the problem is with versionCode).

Just add a third minor version number, for instance I changed from 0.6 to 0.6.3

Viscose answered 21/7, 2014 at 11:58 Comment(0)
T
7

With cordova 3.5 the property in your config.xml should be android-versionCode="??" instead of versionCode="??"

Trinitrobenzene answered 17/7, 2014 at 21:13 Comment(0)
K
1

I had the same problem just now. The solution for cordova version 3.5.0-0.2.6 are as below:

  1. Open your app config.xml.

  2. Edit as follow:

** Change your android-versionCode value and version value accordingly.

Kedron answered 20/7, 2014 at 5:10 Comment(0)
L
0

Manually change the versionCode

Go to yourProject->platforms->android->AndroidManifest.xml

In 2nd line find this android:versionCode set it to "1"

Then try building it again

Logwood answered 15/7, 2014 at 18:40 Comment(3)
thanks for the reply, I tried that, but after doing it and building, I get the same error described in my question, and when I check the AndroidManifest.xml again, it shows android:versionCode="NaN"...Cardew
suggestion: declare both version and version code in yourProject->config.xml like <widget id="com.XXXX.XXXX" version="1.0.1" versionCode = "6" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0"> @CardewLogwood
yeah that's the first thing I did, it's like the build process ignores it and sets versionCode to NaNCardew
E
0

As several have already suggested, with v3.5 the versionCode must be set in the config.xml within the <widget/> tag. Since each platform is specific, they recommend the platform name in front. version="0.0.1" android-versionCode="2" ios-bundleVersion="0.0.1" wp-projectVersion="0.0.1.0" Details can be found at: https://issues.apache.org/jira/browse/CB-5093

The Google Play store will not allow duplicates of the versionCode, so that always has to incremented. The version does not, so that can remain the same if you're doing quick fixes during alpha. Of course when you go to Production, you'd want to be more careful to keep your users properly informed.

Efflux answered 3/10, 2014 at 12:41 Comment(0)
R
-1

You need to run the following command in node.js:

cordova platform update [email protected]
Rota answered 21/1, 2016 at 9:19 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.