Description:
1. On a clean machine setup appcelerator studio.
2. Studio will download java 1.7.0_XX, node js & appc CLI.
3. Login to studio & download android SDK from with in studio.
4. Create an app & run it on android device/emulator.
Actual Results:
1. The build fails as it looks for java 1.6 & errors as it can't find it with the errors below:
[INFO] Encrypting JavaScript files: /Users/qetester/Library/Application Support/Titanium/mobilesdk/osx/4.0.0.GA/android/titanium_prep.macos "com.app.test1" "/Users/qetester/Documents/Appcelerator_Studio_Workspace/test1/build/android/assets" "alloy/CFG.js" "app.js" "alloy/backbone.js" "alloy/constants.js" "alloy/controllers/BaseController.js" "alloy/controllers/index.js" "alloy/styles/index.js" "alloy/sync/localStorage.js" "alloy/sync/properties.js" "alloy/sync/sql.js" "alloy/underscore.js" "alloy/widget.js" "alloy.js" "ti.cloud.js" "_app_props_.json"
[ERROR] Failed to encrypt JavaScript files
[ERROR] No Java runtime present, requesting install.
TRACE | titanium exited with exit code 1
ERROR | Error: ti run exited with error code 1
at ChildProcess.<anonymous> (/Users/qetester/.appcelerator/install/4.0.2/package/node_modules/appc-cli-titanium/plugins/run.js:84:66)
at ChildProcess.emit (events.js:98:17)
at Process.ChildProcess._handle.onexit (child_process.js:820:12)
2. We also get a dialog saying "This application needs java 6" & clicking on more info button on the dialog it takes us to the java 1.6 download page on apple's website.
*NOTE* - Attached screenshot for reference.
Expected Result:
1. The build should succeed with java 1.7.0_X.
I'm running into this issue as well. I recently upgraded to El Capitan DP5. Previously, I just installed the second version of Java (which is pretty lame to have 2 versions on your system). But El Cap doesn't have Java 1.6. I even tried the --skip-js-minify, but that doesn't help either.
Just realized I didn't add the actual error:
node-appc PR: https://github.com/appcelerator/node-appc/pull/111
node-appc PR 2: https://github.com/appcelerator/node-appc/pull/112
tisdk PR: https://github.com/appcelerator/titanium_mobile/pull/7102
After a bunch of testing and research, I've concluded that titanium_prep uses certain JNI APIs that are only available in JDK 1.6. They do not exist in 1.7 or 1.8. I tried changing how titanium_prep links with the JDK, but the result was always the same. So, I've greatly improved node-appc's JDK detection code to find all JDKs, then implemented a check in the Android build to ensure JDK 1.6 is installed when building on OS X. About as good as it gets.
I'm not sure this is a proper solution. It's my understanding that JDK 1.6 will not be supported going forward. It's not available from Oracle and Apple is discontinuing support in El Cap. So checking to ensure it is installed won't do us any good if there is no way to get it installed in the (near) future.
We can't replace these APIs with alternates?
[~killroyboy] I know. This is not ideal. We have a replacement for titanium_prep which will be remove this dependency on JDK 1.6, however it currently requires the Appcelerator CLI and it requires that all users of your app have an Internet connection when the app is first launch. You can read more about this here: https://docs.appcelerator.com/platform/latest/#!/guide/tiapp.xml_and_timodule.xml_Reference (search for "appc-sourcecode-encryption-policy"). [~ingo] Nope. The JNI APIs we need have been deprecated. No idea when they'll be removed, but they are still present in Java 1.8's headers. There's nothing that we can easily do aside from a major rewrite of titanium_prep... or I suppose we could distribute the JDK 1.6 with Titanium. Probably a bad idea. I think the correct solution here is to rewrite titanium_prep using a combination of Node.js and C++. The overall architecture would be essentially the same.
node-appc PR 3: https://github.com/appcelerator/node-appc/pull/113
TiSDK master PR 2: https://github.com/appcelerator/titanium_mobile/pull/7122 TiSDK 5_0_X PR: https://github.com/appcelerator/titanium_mobile/pull/7123
Verified the fix on a clean machine. If you don't have java 1.6 the build fails & the error logs has the link to download java 1.6. Installing java 1.6 from the link fixes the issue & the android build are successfull. Closing. Environment: Appc studio : 4.1.1.201507141126 Ti SDK : 5.0.0.v20150910052019 Appc NPM : 4.1.1 Appc Core : 4.1.3 Mac Yosemite : 10.10.4 Android Device : Nexus 5.1.1 Node : 0.10.37
[~cwilliams] On OS X, we do not
dlopen()
the jvm library. It's dynamically linked at compile time. I converted titanium_prep to use the same code path as Linux and Windows so that it useddlopen()
to dynamically link at runtime and had the exact same results.