[TIMOB-23801] Titanium Android module build fails with Titanium SDK 6.1.0
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Critical |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2016-09-02T20:30:49.000+0000 |
Affected Version/s | Release 6.0.0, Release 6.1.0 |
Fix Version/s | Release 6.0.0 |
Components | Android, Tooling |
Labels | n/a |
Reporter | Chris Barber |
Assignee | Christopher Williams |
Created | 2016-08-22T19:22:28.000+0000 |
Updated | 2016-09-15T22:02:12.000+0000 |
Description
When building an Android module, the build fails:
[ERROR] Failed to run ndk-build
[ERROR]
[ERROR] jni/Android.mk:35: warning: overriding commands for target /Users/chris/appc/workspace/mymodule/android/build/generated/KrollGeneratedBindings.cpp'
[ERROR] jni/Android.mk:35: warning: ignoring old commands for target
/Users/chris/appc/workspace/mymodule/android/build/generated/KrollGeneratedBindings.cpp'
[ERROR] In file included from jni/com.appcelerator.mymodule.ExampleProxy.h:12:0,
[ERROR] from jni/com.appcelerator.mymodule.ExampleProxy.cpp:10:
[ERROR] /Users/chris/Library/Application Support/Titanium/mobilesdk/osx/6.1.0/android/native/include/Proxy.h:11:16: fatal error: v8.h: No such file or directory
[ERROR] #include <v8.h>
[ERROR] ^
[ERROR] compilation terminated.
[ERROR] make: *** [/Users/chris/appc/workspace/mymodule/android/build/generated/obj/local/armeabi-v7a/objs/com.appcelerator.mymodule/com.appcelerator.mymodule.ExampleProxy.o] Error 1
To reproduce:
ti create -t module -n mymodule --id com.appc.mymodule -p all -d .
cd mymodule/android
ti build -p android --build-only
We're also seeing:
[ERROR] Failed to compile Java source files:
[ERROR]
[ERROR] warning: [options] bootstrap class path not set in conjunction with -source 1.6
[ERROR] Note: [KrollBindingGen] Running Kroll binding generator.
[ERROR] Note: [KrollBindingGen] No binding data found, creating new data file: org.appcelerator.titanium.bindings/123abc.json
[ERROR] Note: [KrollBindingGen] Found binding for proxy Example
[ERROR] Note: [KrollBindingGen] Found binding for module my123abc
[ERROR] Note: [KrollBindingGen] Generating JSON: file:/Users/chris/appc/workspace/123abc/android/build/generated/json/org/appcelerator/titanium/bindings/123abc.json
[ERROR] /Users/chris/appc/workspace/123abc/android/src/com/test/app/ExampleProxy.java:32: error: cannot find symbol
[ERROR] private static final boolean DBG = TiConfig.LOGD;
[ERROR] ^
[ERROR] symbol: variable TiConfig
[ERROR] location: class ExampleProxy
[ERROR] /Users/chris/appc/workspace/123abc/android/src/com/test/app/ExampleProxy.java:81: error: cannot find symbol
[ERROR] Log.d(LCAT, "example created with message: " + options.get("message"));
[ERROR] ^
[ERROR] symbol: variable Log
[ERROR] location: class ExampleProxy
[ERROR] /Users/chris/appc/workspace/123abc/android/src/com/test/app/ExampleProxy.java:89: error: cannot find symbol
[ERROR] Log.d(LCAT, "printing message: " + message);
[ERROR] ^
[ERROR] symbol: variable Log
[ERROR] location: class ExampleProxy
[ERROR] /Users/chris/appc/workspace/123abc/android/src/com/test/app/ExampleProxy.java:102: error: cannot find symbol
[ERROR] Log.d(LCAT, "Tried setting module message to: " + message);
[ERROR] ^
[ERROR] symbol: variable Log
[ERROR] location: class ExampleProxy
[ERROR] 4 errors
Able to reproduce. Looks like a CLI or Tooling issue? Using
works and compiles the android module.
ant
fails for me too. Ti SDK 6.0.0.v20160830110225.The error faced by you is a different error. The classes created eg,
android/titanium/src/java/org/appcelerator/titanium/util/Log.java
were removed in https://github.com/appcelerator/titanium_mobile/pull/8101 TIMOB-20221 Meaning, the default module that is created needs to be updated. (cc: [~cwilliams]) (We would need to create a ticket to address this issue). If you remove the classes in the code that the error is talking about, it will work.This would also mean default module creation in SDK 6.0.0 is broken with this same issue.
I believe I need to update https://github.com/appcelerator/titanium_mobile/blob/415bd6c66dcc55b1a59a59574f3babd3c3a84ede/android/templates/module/default/template/android/src/%7B%7BModuleIdAsFolder%7D%7D/ExampleProxy.java.ejs
[~fmiao] To make
ant
work, please edit the ExampleProxy.java in this manner:Change line 15 :
import org.appcelerator.titanium.util.Log;
toimport org.appcelerator.kroll.common.Log;
Comment line 16:
In the mean time, I'm doing a PR to update the template.import org.appcelerator.titanium.util.TiConfig;
toimport org.appcelerator.kroll.common.TiConfig;
Master PR: https://github.com/appcelerator/titanium_mobile/pull/8303 6_0_X PR: https://github.com/appcelerator/titanium_mobile/pull/8304 [~cbarber] for your review. This fixes the compilation issue. Ant will compile. After this is merged and Ant working again, the main issue of this ticket can then be looked into for investigation.
Usage of Ant has been deprecated and replaced by a fantastic Node.js-based build command. Upon applying your patch, I create a new module, then build it by running
ti build -p android --build-only
. The build fails with the following error:This seems V8 related. [~cwilliams] Can you help?
Master/6.1.X: https://github.com/appcelerator/titanium_mobile/pull/8306 6.0.X: https://github.com/appcelerator/titanium_mobile/pull/8307
When I updated V8, I had updated the templates used by the ant/python module build system. There's a parallel set used by the node-based system, which this PR now updates (to effectively match the ones I updated for ant/python).
Verified the fix. Android module build does not fail. Closing. Environment: Appc Studio : 4.8.0.201609061702 Ti SDK : 6.0.0.v20160913184210, 6.1.0.v20160915135333 Ti CLI : 5.0.9 Alloy : 1.9.1 MAC El Capitan : 10.11.6 Appc NPM : 4.2.8-6 Appc CLI : 6.0.0-38 Node: 4.4.4 Nexus 6 - Android 6.0.1