Titanium JIRA Archive
Appcelerator Community (AC)

[AC-3296] Enable --multi-dex for android builds

GitHub Issuen/a
TypeImprovement
Priorityn/a
StatusClosed
ResolutionInvalid
Resolution Date2014-11-22T00:01:14.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsAppcelerator CLI
Labelsandroid
ReporterStephen Feather
AssigneeChris Barber
Created2014-11-21T21:11:47.000+0000
Updated2016-03-08T07:57:43.000+0000

Description

Problem

Titanium tooling will not build a project that has more than 65536 total method calls Currently android has a limit on the number of methods permitted (65536) As an example, the latest google-play-services.jar from 3.4.1 has 23600. For basic S3 support from aws 2.0, a module uses 26800. By the time you build an empty titanium app you are left with:
[ERROR] trouble writing output: Too many method references: 68927; max is 65536.

Solution

The solution is to use the --multi-dex option in calling dexer. The problem will be that --multi-dex cant just be dropped in as it requires a different output. A decision will need to be made on how to modify this.buildBinClassesDex. Example
dexArgs = [
			'-Xmx' + this.dxMaxMemory,
			'-XX:-UseGCOverheadLimit',
			'-Djava.ext.dirs=' + this.androidInfo.sdk.platformTools.path,
			'-jar', this.androidInfo.sdk.dx,
			'--dex', '--multi-dex',
			'--output=' + this.buildBinClassesDex,
			this.buildBinClassesDir,
			path.join(this.platformPath, 'lib', 'titanium-verify.jar')

Comments

  1. Chris Barber 2014-11-22

    This ticket was magically created by error. Thanks Jira.

JSON Source