Skip to content

gradle "versionCode" overflows #1843

Closed
Closed
@SomberNight

Description

@SomberNight

I am trying to build Electrum with p4a master, and due to #1720 / abb4703 I am getting an error.

Electrum uses x.y.z version numbers in general; but for the android apk there is an extra digit, so it is x.y.z.a.
For example, 3.3.6.0

The corresponding versionCode using older p4a would be 3030600
but since referenced change, it is now 7213030600

defaultConfig {
minSdkVersion {{ args.min_sdk_version }}
targetSdkVersion {{ android_api }}
versionCode {{ args.numeric_version }}
versionName '{{ args.version }}'
}

Build log excerpt:

[DEBUG]:   	Download https://jcenter.bintray.com/com/sun/xml/fastinfoset/FastInfoset/1.2.13/FastInfoset-1.2.13.jar
[DEBUG]:   	Download https://jcenter.bintray.com/com/sun/istack/istack-commons-runtime/2.21/istack-commons-runtime-2.21.jar
[DEBUG]:   	Download https://jcenter.bintray.com/org/glassfish/jaxb/txw2/2.2.11/txw2-2.2.11.jar
[DEBUG]:   	Download https://dl.google.com/dl/android/maven2/com/android/tools/lint/lint-gradle-api/26.1.4/lint-gradle-api-26.1.4.jar2.2.11.jar > 927 KB/1007 KB downloaded
[DEBUG]:   	
[DEBUG]:   	FAILURE: Build failed with an exception.
[DEBUG]:   	
[DEBUG]:   	* Where:
[DEBUG]:   	Build file '/home/user/wspace/electrum/.buildozer/android/platform/build/dists/Electrum/build.gradle' line: 30LE
[DEBUG]:   	
[DEBUG]:   	* What went wrong:
[DEBUG]:   	A problem occurred evaluating root project 'Electrum'.
[DEBUG]:   	> Could not find method versionCode() for arguments [7213030600] on DefaultConfig_Decorated{name=main, dimension=null, minSdkVersion=DefaultApiVersion{mApiLevel=21, mCodename='null'}, targetSdkVersion=DefaultApiVersion{mApiLevel=28, mCodename='null'}, renderscriptTargetApi=null, renderscriptSupportModeEnabled=null, renderscriptSupportModeBlasEnabled=null, renderscriptNdkModeEnabled=null, versionCode=null, versionName=null, applicationId=null, testApplicationId=null, testInstrumentationRunner=null, testInstrumentationRunnerArguments={}, testHandleProfiling=null, testFunctionalTest=null, signingConfig=null, resConfig=null, mBuildConfigFields={}, mResValues={}, mProguardFiles=[], mConsumerProguardFiles=[], mManifestPlaceholders={}, mWearAppUnbundled=null} of type com.android.build.gradle.internal.dsl.DefaultConfig.
[DEBUG]:   	
[DEBUG]:   	* Try:
[DEBUG]:   	Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
[DEBUG]:   	
[DEBUG]:   	* Get more help at https://help.gradle.org
[DEBUG]:   	
[DEBUG]:   	BUILD FAILED in 44s

Exception in thread background thread for pid 6317:
Traceback (most recent call last):
  File "/usr/lib/python3.6/threading.py", line 916, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.6/threading.py", line 864, in run
    self._target(*self._args, **self._kwargs)
  File "/home/user/.local/lib/python3.6/site-packages/sh.py", line 1540, in wrap
    fn(*args, **kwargs)
  File "/home/user/.local/lib/python3.6/site-packages/sh.py", line 2459, in background_thread
    handle_exit_code(exit_code)
  File "/home/user/.local/lib/python3.6/site-packages/sh.py", line 2157, in fn
    return self.command.handle_command_exit_code(exit_code)
  File "/home/user/.local/lib/python3.6/site-packages/sh.py", line 815, in handle_command_exit_code
    raise exc
sh.ErrorReturnCode_1: 

  RAN: /home/user/wspace/electrum/.buildozer/android/platform/build/dists/Electrum/gradlew assembleDebug

I can only guess that the error is due to 32 bit integer overflow.
If I manually patch p4a to produce a smaller versioncode int, then the build succeeds.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions