[ 
https://issues.apache.org/jira/browse/CB-8976?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15166717#comment-15166717
 ] 

Nick Fenwick edited comment on CB-8976 at 2/25/16 8:42 AM:
-----------------------------------------------------------

Thanks Chris, I have now added that script and it works well in a local 
'phonegap run android' situation, but damn, it looks like hooks are not 
supported on the Phonegap Build platform, so we cannot use this approach to 
make builds work when uploaded to Phonegap Build  
http://community.phonegap.com/nitobi/topics/phonegap-hooks-folder-scripts-are-ignored-on-remote-build

A solution, that we really should have thought of days ago, is simply to 
override the versionCode in the config.xml file:

<widget id="ourapp"
  version="1.2.1602250425"
  android-versionCode="160225042" 
  versionCode="160225042"
  versionName="1.0.0.11"
  xmlns="http://www.w3.org/ns/widgets"; xmlns:gap="http://phonegap.com/ns/1.0";>

Note the missing '5' on the end of the versionCode and android-versionCode.  
Our build process will have to generate a timestamp for use in 'version' (and 
thus the iOS build) but chop the last digit off for Android version numbers.  
These are then used in build.gradle and have a zero appended and no fireworks 
ensue.


was (Author: neekfenwick):
Thanks Chris, I have now added that script but am having trouble making 
Phonegap Build use it.  I tried two directory structures:
1 - everything inside 'www' folder
www/config.xml - has <hook type="after_prepare" 
src="scripts/appAfterPrepare.js" />
www/scripts/appAfterPrepare.js
www/index.html - and other app content
This does build find locally (great!) but fails on Phonegap Build, see below.

2 - config.xml and hooks in root, with www in root too
/config.xml
/scripts/appAfterPrepare.js
/www/index.html - and other app content

Both approaches produce this output in the Log:
* What went wrong:
A problem occurred evaluating root project 'project'.
> For input string: "16022503480"

I can't see any sign in the Log of Phonegap Build attempting to run my hook, 
despite it definitely being mentioned in the config.xml.  I will keep trying.

*Edit* - damn, it looks like hooks are not supported on the Phonegap Build 
platform, so we cannot actually build our app on phonegap build any more.  
http://community.phonegap.com/nitobi/topics/phonegap-hooks-folder-scripts-are-ignored-on-remote-build

> platforms/android/build.gradle modifies android versionCode
> -----------------------------------------------------------
>
>                 Key: CB-8976
>                 URL: https://issues.apache.org/jira/browse/CB-8976
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: Android
>         Environment: Android
>            Reporter: zack dykes
>
> cordova 5.0.0
> platforms/android/build.gradle modifies android versionCode at ln 178
> as I understand it max size for versionCode is (2^31)-1 
> http://stackoverflow.com/a/24246191/126600
> in my config.xml: 
> {code}
> android-versionCode="1385039613"
> {code}
> when I run {{cordova build android}}, I get:
> {code}
> FAILURE: Build failed with an exception.
> * Where:
> Build file 
> '/Users/zackd/dev/code/cordova/cordova-ansr-fat-client/ondeviceresearch/platforms/android/build.gradle'
>  line: 178
> * What went wrong:
> A problem occurred evaluating root project 'android'.
> > For input string: "13850396130"
> {code}
> and build.gradle, ln 178
> {code}
> versionCode cdvVersionCode ?: Integer.parseInt("" + 
> privateHelpers.extractIntFromManifest("versionCode") + "0")
> {code}
> looks like this is appending "0" to my versionCode, producing 13850396130 
> which is larger than max size for android versionCode
> if I mod ln 178 as follows, build succeeds
> {code}
> versionCode cdvVersionCode ?: Integer.parseInt("" + 
> privateHelpers.extractIntFromManifest("versionCode"))
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to