Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-25920] Android: Build fails if SDK with JDK 9/10 fix is not selected in CLI & tiapp.xml (only if ran from CLI)

GitHub Issuen/a
TypeBug
PriorityNone
StatusClosed
ResolutionInvalid
Resolution Date2018-04-02T17:15:44.000+0000
Affected Version/sn/a
Fix Version/sRelease 7.1.1
ComponentsAndroid
Labelsn/a
ReporterLokesh Choudhary
AssigneeChris Barber
Created2018-03-30T19:00:50.000+0000
Updated2018-04-03T22:03:13.000+0000

Description

I am not sure if this is an issue or its just to be like this due to the architecture of CLI & SDK. What I am seeing is if I do not have an SDK with the new JDK 9/10 detection fix in both the CLI & tiapp.xml the build fails.

Steps to reproduce:

*A. SDK with jdk 9/10 fix selected in the CLI & 7.1.0.GA in tiapp.xml:* 1. Make sure you have CLI core 7.0.3-master.24 installed which has the jdk 9/10 fix. 2. Create an app with SDK 7.1.0.GA (this will have sdk 7.1.0.GA in the tiapp.xml). 3. Make sure you have the SDK with the jdk 9/10 selected in the CLI. 4. Build for android. 5. Build fails with:
[INFO]  tiapp.xml <sdk-version> set to 7.1.0.GA, but current Titanium SDK set to 7.2.0.v20180328162916
[INFO]  Forking correct SDK command: "/usr/local/bin/node" "/Users/lchoudhary/.appcelerator/install/7.0.3-master.24/package/node_modules/titanium/lib/titanium.js" "build" "--sdk" "7.1.0.GA" "--no-banner" "--config-file" "/var/folders/pk/k370szc955l_9w7hsb9nfvg00000gq/T/build-1522435392553.json" "--platform" "android" "--project-dir" "/Users/lchoudhary/Desktop/lokitest" "--log-level" "trace" "--android-sdk" "/Users/lchoudhary/Desktop/android-sdk-macosx" "--target" "emulator"

[ERROR] JDK (Java Development Kit) not found.
[ERROR] If you already have installed the JDK, verify your JAVA_HOME environment variable is correctly set.
[ERROR] The JDK can be downloaded and installed from http://appcelerator.com/jdk.
*B. 7.1.0.GA in selected in CLI & SDK with jdk 9/10 fix in the tiapp.xml:* 1. Make sure you have CLI core 7.0.3-master.24 installed which has the jdk 9/10 fix. 2. Select 7.1.0.GA in CLI & have sdk with jdk9/10 fix in tiapp.xml. 3. Build for android. 4. Build fails with:
[ERROR] JDK (Java Development Kit) not found.
[ERROR] If you already have installed the JDK, verify your JAVA_HOME environment variable is correctly set.
[ERROR] The JDK can be downloaded and installed from http://appcelerator.com/jdk.
Expected result: For A : Probably fail For B : Probably should not fail with JDK not found error.

Comments

  1. Chris Barber 2018-03-30

    The fix is in node-appc@0.2.44, though the latest version is node-appc@0.2.45. Both the master and 7_1_X branch of titanium_mobile reference node-appc@0.2.43. Someone needs to update the node-appc version and then this will be fixed.
  2. Chris Barber 2018-03-30

    Ti SDK master PR: https://github.com/appcelerator/titanium_mobile/pull/9975 Ti SDK 7_1_X PR: https://github.com/appcelerator/titanium_mobile/pull/9976
  3. Lokesh Choudhary 2018-03-30

    [~cbarber], I think master & 7_1_X are not referencing node-appc@0.2.45 because https://github.com/appcelerator/titanium_mobile/pull/9964 & https://github.com/appcelerator/titanium_mobile/pull/9965 are not merged yet. When I tested I manually copied node-appc@0.2.45 in to the node modules & I am still seeing this failure.
  4. Chris Barber 2018-03-31

    [~lchoudhary] Apparently my PR's are void as https://github.com/appcelerator/titanium_mobile/pull/9964 solves it. I was assigned as the reviewer for 9964, but I'm not certain I'm in a place to test it properly.
  5. Chris Barber 2018-04-02

    This should be resolved by https://github.com/appcelerator/titanium_mobile/pull/9964 and https://github.com/appcelerator/titanium_mobile/pull/9965.
  6. Chris Barber 2018-04-02

    Scenario A is unsupported. If the tiapp references a Titanium SDK that doesn't support JDK 9/10, then an error is expected. Scenario B is basically a dupe of TIMOB-25799 and will be fixed once it's merged. Resolving this ticket as not valid.
  7. Lokesh Choudhary 2018-04-02

  8. Chris Barber 2018-04-02

    [~lchoudhary] How can this be? You tested and merged https://github.com/appcelerator/titanium_mobile/pull/9965 which would require you to do scenario B. Are you sure you're testing with the correct 7_1_X CI build?
  9. Lokesh Choudhary 2018-04-02

    [~cbarber], I tested the PR https://github.com/appcelerator/titanium_mobile/pull/9965 for the detection & build failure issue due to dexer, with having the SDK with the fix at both places CLI as well as tiapp.xml. But with scenario B it is still failing. It looks more like the CLI forking not working properly?(I might be wrong though).
  10. Chris Barber 2018-04-02

    I can't build the SDK for whatever reason and so I cannot reproduce the problem. Try running a build by explicitly passing in \-\-sdk 7.1.1.
  11. Lokesh Choudhary 2018-04-02

    Ok so on further testing, I see the failure only if I build using the CLI. If from studio then scenario B works fine.
  12. Lokesh Choudhary 2018-04-02

    [~cbarber], I checked & passing the --sdk actually works. Studio also passed the flag when the build runs from studio. So would it mean something goofy with the CLI ?
  13. Lokesh Choudhary 2018-04-03

    Did get things cleared here. Thanks [~fmiao]. We need to use an SDK with JDK 9 support if we only have JDK 9.0.4 installed. If we have JDK 8 & 9 installed the it takes JDK 8 & builds fine. CLI uses the active (selected) SDK in CLI to start the build process (before fork) & if the active SDK does not support JDK 9 then the build is expected to fail.

JSON Source