[TIMOB-14992] CLI: Python error (TypeError: not all arguments converted during string formatting) when building package for App Store
| GitHub Issue | n/a |
|---|---|
| Type | Bug |
| Priority | Medium |
| Status | Closed |
| Resolution | Won't Fix |
| Resolution Date | 2014-04-02T05:39:35.000+0000 |
| Affected Version/s | Release 3.2.0 |
| Fix Version/s | 2014 Sprint 07, 2014 Sprint 07 Tooling |
| Components | CLI |
| Labels | n/a |
| Reporter | Tijs Zwinkels |
| Assignee | Chris Barber |
| Created | 2013-08-26T05:20:40.000+0000 |
| Updated | 2017-03-20T16:49:23.000+0000 |
Description
*Problem*
Some .js files seem to trigger an error in the build-system when building for production:
*Note*
I've seen this bug more often lately. Most of my app is build in coffeescript, which might produce unusual (but legal) javascript patterns.
I think the bug is similar to #TC-1838, but I can reproduce it!
*Error*
[ERROR] Exception occured while building Android project:
[ERROR] Traceback (most recent call last):
[ERROR] File "/Users/tijs/Library/Application Support/Titanium/mobilesdk/osx/3.2.0/android/builder.py", line 2630, in <module>
[ERROR] builder.build_and_run(True, None, key, password, alias, output_dir)
[ERROR] File "/Users/tijs/Library/Application Support/Titanium/mobilesdk/osx/3.2.0/android/builder.py", line 2293, in build_and_run
[ERROR] compiler.compile(compile_bytecode=self.compile_js, external_modules=self.modules)
[ERROR] File "/Users/tijs/Library/Application Support/Titanium/mobilesdk/osx/3.2.0/android/compiler.py", line 287, in compile
[ERROR] self.compile_into_bytecode(self.js_files)
[ERROR] File "/Users/tijs/Library/Application Support/Titanium/mobilesdk/osx/3.2.0/android/compiler.py", line 202, in compile_into_bytecode
[ERROR] self.compile_javascript(fullpath)
[ERROR] File "/Users/tijs/Library/Application Support/Titanium/mobilesdk/osx/3.2.0/android/compiler.py", line 192, in compile_javascript
[ERROR] sys.stderr.write("[ERROR] unrecognized error encountered: " % se)
[ERROR] TypeError: not all arguments converted during string formatting
[ERROR] : Build process exited with code 1
[ERROR] : Project failed to build after 52s 350ms
*Steps to reproduce*
1. Include the attached file in a project
2. Build for 'Distribute - Android App store'
3. The error will appear.
Attachments
| File | Date | Size |
|---|---|---|
| demonstrateCrash.js | 2013-08-26T05:20:40.000+0000 | 3887 |
After modifying the compiler.py script to show the error (as explained here: http://developer.appcelerator.com/question/137414/titanium-appcelerator-android-fails-to-build-with-exception-for-tiandroidcompilejs), it became clear that the closure-compiler would crash on the .js file:
Updating the closure-compiler fixes this problem. See pull request: https://github.com/appcelerator/titanium_mobile/pull/4602[INFO] so se java.lang.RuntimeException: java.lang.RuntimeException: INTERNAL COMPILER ERROR. Please report this problem. index (1) must be less than size (1) Node(BLOCK): /Users/tijs/Dropbox/Titanium_Studio_Workspace/compass_git/appcelerator/compass/build/android/bin/assets/Resources/model/uitgaand_model.js:87:51 UitgaandTableData.prototype.reset = function() { Parent(FUNCTION ): /Users/tijs/Dropbox/Titanium_Studio_Workspace/compass_git/appcelerator/compass/build/android/bin/assets/Resources/model/uitgaand_model.js:87:48 UitgaandTableData.prototype.reset = function() { at com.google.javascript.jscomp.Compiler.runCallable(Compiler.java:629) at com.google.javascript.jscomp.Compiler.runInCompilerThread(Compiler.java:574) at com.google.javascript.jscomp.Compiler.compile(Compiler.java:556) at com.google.javascript.jscomp.Compiler.compile(Compiler.java:515) at com.google.javascript.jscomp.AbstractCommandLineRunner.doRun(AbstractCommandLineRunner.java:662) at com.google.javascript.jscomp.AbstractCommandLineRunner.run(AbstractCommandLineRunner.java:295) at com.google.javascript.jscomp.CommandLineRunner.main(CommandLineRunner.java:758) Caused by: java.lang.RuntimeException: INTERNAL COMPILER ERROR. Please report this problem. index (1) must be less than size (1) Node(BLOCK): /Users/tijs/Dropbox/Titanium_Studio_Workspace/compass_git/appcelerator/compass/build/android/bin/assets/Resources/model/uitgaand_model.js:87:51 UitgaandTableData.prototype.reset = function() { Parent(FUNCTION ): /Users/tijs/Dropbox/Titanium_Studio_Workspace/compass_git/appcelerator/compass/build/android/bin/assets/Resources/model/uitgaand_model.js:87:48 UitgaandTableData.prototype.reset = function() { at com.google.common.base.Preconditions.checkElementIndex(Preconditions.java:301) at com.google.common.base.Preconditions.checkElementIndex(Preconditions.java:280) at com.google.common.collect.Lists$ReverseList.reverseIndex(Lists.java:743) at com.google.common.collect.Lists$ReverseList.get(Lists.java:774) at com.google.javascript.jscomp.InlineObjectLiterals$InliningBehavior.replaceAssignmentExpression(InlineObjectLiterals.java:348) at com.google.javascript.jscomp.InlineObjectLiterals$InliningBehavior.splitObject(InlineObjectLiterals.java:411) at com.google.javascript.jscomp.InlineObjectLiterals$InliningBehavior.afterExitScope(InlineObjectLiterals.java:103) at com.google.javascript.jscomp.ReferenceCollectingCallback.exitScope(ReferenceCollectingCallback.java:187) at com.google.javascript.jscomp.NodeTraversal.popScope(NodeTraversal.java:560) at com.google.javascript.jscomp.NodeTraversal.traverseFunction(NodeTraversal.java:520) at com.google.javascript.jscomp.NodeTraversal.traverseBranch(NodeTraversal.java:465) <..>Here's [~tinkertank]'s 3.1.x pull request: https://github.com/appcelerator/titanium_mobile/pull/4604
Thanks for the pull request, however we rewrote the Android build scripts to be more awesome and now we use UglifyJS.
Closing ticket as the issue will not fix.