Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-23801] Titanium Android module build fails with Titanium SDK 6.1.0

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionFixed
Resolution Date2016-09-02T20:30:49.000+0000
Affected Version/sRelease 6.0.0, Release 6.1.0
Fix Version/sRelease 6.0.0
ComponentsAndroid, Tooling
Labelsn/a
ReporterChris Barber
AssigneeChristopher Williams
Created2016-08-22T19:22:28.000+0000
Updated2016-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

Comments

  1. Ashraf Abu 2016-08-24

    Able to reproduce. Looks like a CLI or Tooling issue? Using
     ant 
    works and compiles the android module.
  2. Feon Sua Xin Miao 2016-08-31

    ant fails for me too. Ti SDK 6.0.0.v20160830110225.
       process.annotations:
           [javac] Compiling 2 source files to /Users/feonsua/work/testapps/abc123/android/build/classes
           [javac] warning: [options] bootstrap class path not set in conjunction with -source 1.6
           [javac] Note: [KrollBindingGen] Running Kroll binding generator.
           [javac] Note: [KrollBindingGen] Succesfully loaded existing binding data: /Users/feonsua/work/testapps/abc123/android/build/generated/json/org/appcelerator/titanium/bindings/abc123.json
           [javac] Note: [KrollBindingGen] Found binding for module Abc123
           [javac] Note: [KrollBindingGen] Found binding for proxy Example
           [javac] /Users/feonsua/work/testapps/abc123/android/src/com/test/app/ExampleProxy.java:15: error: cannot find symbol
           [javac] import org.appcelerator.titanium.util.Log;
           [javac]                                      ^
           [javac]   symbol:   class Log
           [javac]   location: package org.appcelerator.titanium.util
           [javac] /Users/feonsua/work/testapps/abc123/android/src/com/test/app/ExampleProxy.java:16: error: cannot find symbol
           [javac] import org.appcelerator.titanium.util.TiConfig;
           [javac]                                      ^
           [javac]   symbol:   class TiConfig
           [javac]   location: package org.appcelerator.titanium.util
           [javac] Note: [KrollBindingGen] Generating JSON: file:/Users/feonsua/work/testapps/abc123/android/build/generated/json/org/appcelerator/titanium/bindings/abc123.json
           [javac] 2 errors
       
       BUILD FAILED
       
       
  3. Ashraf Abu 2016-09-01

    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.
  4. Ashraf Abu 2016-09-01

    This would also mean default module creation in SDK 6.0.0 is broken with this same issue.
  5. Ashraf Abu 2016-09-01

    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
  6. Ashraf Abu 2016-09-01

    [~fmiao] To make ant work, please edit the ExampleProxy.java in this manner:

    Change line 15 : import org.appcelerator.titanium.util.Log; to import org.appcelerator.kroll.common.Log;

    Comment line 16: import org.appcelerator.titanium.util.TiConfig; to import org.appcelerator.kroll.common.TiConfig;

    In the mean time, I'm doing a PR to update the template.
  7. Ashraf Abu 2016-09-01

    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.
  8. Chris Barber 2016-09-01

    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:
       [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/../MymoduleBootstrap.cpp:17:0:
       [ERROR] /Users/chris/appc/workspace/mymodule/android/build/generated/KrollGeneratedBindings.gperf:14:28: warning: declaration 'struct titanium::bindings::BindEntry' does not declare anything
       [ERROR]  struct titanium::bindings::BindEntry;
       [ERROR]                             ^
       [ERROR] jni/../MymoduleBootstrap.cpp: In function 'v8::Local<v8::Value> Mymodule_getBinding(const v8::FunctionCallbackInfo<v8::Value>&)':
       [ERROR] jni/../MymoduleBootstrap.cpp:31:126: error: invalid conversion from 'const char*' to 'const uint8_t* {aka const unsigned char*}' [-fpermissive]
       [ERROR]    isolate->ThrowException(Exception::Error(String::NewFromOneByte(isolate, "Mymodule.getBinding requires 1 argument: binding")));
       [ERROR]                                                                                                                               ^
       [ERROR] In file included from jni/../MymoduleBootstrap.cpp:10:0:
       [ERROR] /Users/chris/Library/Application Support/Titanium/mobilesdk/osx/6.1.0/android/native/include/v8.h:2332:24: note: initializing argument 2 of 'static v8::Local<v8::String> v8::String::NewFromOneByte(v8::Isolate*, const uint8_t*, v8::String::NewStringType, int)'
       [ERROR]    static V8_DEPRECATED(
       [ERROR]                         ^
       [ERROR] jni/../MymoduleBootstrap.cpp:32:3: error: return-statement with no value, in function returning 'v8::Local<v8::Value>' [-fpermissive]
       [ERROR]    return;
       [ERROR]    ^
       [ERROR] jni/../MymoduleBootstrap.cpp:57:33: error: too few arguments to function 'v8::Local<v8::Primitive> v8::Undefined(v8::Isolate*)'
       [ERROR]    return scope.Escape(Undefined());
       [ERROR]                                  ^
       [ERROR] In file included from jni/../MymoduleBootstrap.cpp:10:0:
       [ERROR] /Users/chris/Library/Application Support/Titanium/mobilesdk/osx/6.1.0/android/native/include/v8.h:324:27: note: declared here
       [ERROR]    friend Local<Primitive> Undefined(Isolate* isolate);
       [ERROR]                            ^
       [ERROR] jni/../MymoduleBootstrap.cpp:61:36: error: request for member 'GetCurrentContext' in 'isolate', which is of pointer type 'v8::Isolate*' (maybe you meant to use '->' ?)
       [ERROR]   extBinding->bind(exports, isolate.GetCurrentContext());
       [ERROR]                                     ^
       [ERROR] jni/../MymoduleBootstrap.cpp: In function 'void Mymodule_init(v8::Local<v8::Object>, v8::Local<v8::Context>)':
       [ERROR] jni/../MymoduleBootstrap.cpp:73:81: error: invalid conversion from 'const char*' to 'const uint8_t* {aka const unsigned char*}' [-fpermissive]
       [ERROR]    Local<String> name = String::NewFromOneByte(isolate, titanium::natives[i].name);
       [ERROR]                                                                                  ^
       [ERROR] In file included from jni/../MymoduleBootstrap.cpp:10:0:
       [ERROR] /Users/chris/Library/Application Support/Titanium/mobilesdk/osx/6.1.0/android/native/include/v8.h:2332:24: note: initializing argument 2 of 'static v8::Local<v8::String> v8::String::NewFromOneByte(v8::Isolate*, const uint8_t*, v8::String::NewStringType, int)'
       [ERROR]    static V8_DEPRECATED(
       [ERROR]                         ^
       [ERROR] jni/../MymoduleBootstrap.cpp:80:59: error: invalid conversion from 'const char*' to 'const uint8_t* {aka const unsigned char*}' [-fpermissive]
       [ERROR]   exports->Set(String::NewFromOneByte(isolate, "getBinding"), FunctionTemplate::New(isolate, Mymodule_getBinding)->GetFunction(context).ToLocalChecked());
       [ERROR]                                                            ^
       [ERROR] In file included from jni/../MymoduleBootstrap.cpp:10:0:
       [ERROR] /Users/chris/Library/Application Support/Titanium/mobilesdk/osx/6.1.0/android/native/include/v8.h:2332:24: note: initializing argument 2 of 'static v8::Local<v8::String> v8::String::NewFromOneByte(v8::Isolate*, const uint8_t*, v8::String::NewStringType, int)'
       [ERROR]    static V8_DEPRECATED(
       [ERROR]                         ^
       [ERROR] jni/../MymoduleBootstrap.cpp:80:112: error: invalid conversion from 'v8::Local<v8::Value> (*)(const v8::FunctionCallbackInfo<v8::Value>&)' to 'v8::FunctionCallback {aka void (*)(const v8::FunctionCallbackInfo<v8::Value>&)}' [-fpermissive]
       [ERROR]   exports->Set(String::NewFromOneByte(isolate, "getBinding"), FunctionTemplate::New(isolate, Mymodule_getBinding)->GetFunction(context).ToLocalChecked());
       [ERROR]                                                                                                                 ^
       [ERROR] In file included from jni/../MymoduleBootstrap.cpp:10:0:
       [ERROR] /Users/chris/Library/Application Support/Titanium/mobilesdk/osx/6.1.0/android/native/include/v8.h:4477:34: note: initializing argument 2 of 'static v8::Local<v8::FunctionTemplate> v8::FunctionTemplate::New(v8::Isolate*, v8::FunctionCallback, v8::Local<v8::Value>, v8::Local<v8::Signature>, int)'
       [ERROR]    static Local<FunctionTemplate> New(
       [ERROR]                                   ^
       [ERROR] make: *** [/Users/chris/appc/workspace/mymodule/android/build/generated/obj/local/armeabi-v7a/objs/com.appc.mymodule/__/MymoduleBootstrap.o] Error 1
       
  9. Ashraf Abu 2016-09-02

    This seems V8 related. [~cwilliams] Can you help?
  10. Christopher Williams 2016-09-02

    Master/6.1.X: https://github.com/appcelerator/titanium_mobile/pull/8306 6.0.X: https://github.com/appcelerator/titanium_mobile/pull/8307
  11. Christopher Williams 2016-09-02

    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).
  12. Lokesh Choudhary 2016-09-15

    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

JSON Source