Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-25932] Android: Cannot build SDK with JDK 10 (missing javah tool)

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2018-08-20T15:59:49.000+0000
Affected Version/sn/a
Fix Version/sRelease 7.5.0
ComponentsAndroid
Labelsandroid, ant, build, jdk, sdk
ReporterChris Barber
AssigneeJoshua Quick
Created2018-04-04T19:04:55.000+0000
Updated2018-10-15T20:25:33.000+0000

Description

*Summary:* If you attempt to build the Titanium SDK (ie: titanium_mobile) with JDK 10 installed, the build will fail due to a missing "javah" tool. This tool has been removed in JDK 10. *Steps to reproduce:*

Instal JDK 10 if not done already.

Open the terminal.

cd to the titanium_mobile/build directory.

Enter: node scons.js build android

*Result:* Build fails due to missing "javah" tool. *Work-Around:* Build with JDK 8 or 9. *Recommended Solution:* Remove Titanium's usage of the "javah" tool and the #include's to the generated headers files. They're not needed. The generated header files and function prototypes are useless by themselves. We have to create the function implementation ourselves, which we've already done and they're already publicly exported via JNIEXPORT in their respective C++ files. Since the implementation side already exports the functions, the function prototypes are not needed. https://github.com/appcelerator/titanium_mobile/blob/master/android/runtime/v8/src/native/JSDebugger.cpp https://github.com/appcelerator/titanium_mobile/blob/master/android/runtime/v8/src/native/V8Object.cpp https://github.com/appcelerator/titanium_mobile/blob/master/android/runtime/v8/src/native/V8Runtime.cpp ---- *Original Description:* JDK 10 has dropped the javah tool (http://openjdk.java.net/jeps/313) which is required by our tooling when building the Android platform. We need to use javac's -h flag instead. javah generated the header files from the compiled .class files in the jars, however javac -h used the original .java files. We'll likely have to move the header generation out of the native compile step and into the Java compile step. We can do this by specifying the nativeheaderdir attribute in the javac task in the common.xml file. However, the nativeheaderdir attribute is only supported in ant 1.9.8+ (https://ant.apache.org/manual/Tasks/javac.html) and we ship ant 1.8.0 with Titanium. The Android build also depends on ant-contrib and ant-nodeps which may not be compatible with ant 1.9.8 or newer. In the meantime, we'll have to use JDK 9 to build the Titanium SDK.

Comments

  1. Joshua Quick 2018-08-15

    PR (master): https://github.com/appcelerator/titanium_mobile/pull/10257
  2. Keerthi Mahalingam 2018-10-15

    Verified the fix on master 7.5 version. build successfully built and run on android in Mac as well as windows. Closing.
       Mac configuration:
         Name                        = Mac OS X
         Version                     = 10.13.6
         Architecture                = 64bit
       Node.js
         Node.js Version             = 8.9.1
         npm Version                 = 5.5.1
       Titanium CLI
         CLI Version                 = 5.1.1
       Titanium SDK
         SDK Version                 =master 7.5
       Device				=Pixel 2 xl android 8 emulator
       
       Windows configurations
          Name                        = Microsoft Windows 10 Pro 
         Version                     = 10.0.17134 
         Architecture                = 64bit 
         Node.js 
         Node.js Version             = 8.9.1 
         npm Version                 = 5.5.1 
       Titanium CLI 
         CLI Version                 = 5.1.1 
       Titanium SDK 
         SDK Version                 = master 7.5 
       Device 
       Samsung s5 android 6 device
       

JSON Source