Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-27755] Android: Add NDK side-by-side support

GitHub Issuen/a
TypeImprovement
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2020-04-15T18:03:17.000+0000
Affected Version/sn/a
Fix Version/sRelease 9.0.1
ComponentsAndroid, CLI
Labelsandroid, build, ndk, sdk
ReporterJoshua Quick
AssigneeJoshua Quick
Created2020-02-08T04:45:57.000+0000
Updated2020-04-15T18:03:17.000+0000

Description

*Summary:* As of 2019, Google introduced a new NDK "side-by-side" feature which allows you to install multiple NDK versions under the Android SDK directory. All new NDK versions are downloaded to the side-by-side directory and it replaces the old "ndk-bundle" directory. *Example:* The folder structure appear as follows on macOS... ~/Library/Android/sdk/ndk/19.2.5345600 ~/Library/Android/sdk/ndk/20.1.5948922 ~/Library/Android/sdk/ndk/21.0.5935234 ~/Library/Android/sdk/ndk/21.0.6113669 There will be an "ndk" directory under the "Android/sdk" directory. Each subdirectory under "ndk" will be the version number of the installed NDK. *Old Behavior:* Before the NDK side-by-side feature existed, Android Studio used to install the NDK under the Android SDK directory as shown below. Updating the NDK version used to replace the old version. Android Studio no longer installs to this directory. ~/Library/Android/sdk/ndk-bundle *To be done:* The CLI should search for the installed NDK directory in the following order.

The "ANDROID_NDK" environment variable, if set.

The newest NDK side-by-side version subdirectory, if available.

The "ndk-bundle" directory.

We will need to update the code here... https://github.com/appcelerator/node-titanium-sdk/blob/master/lib/android.js *Note:* This is important for macOS Catalina. Google does not currently digitally sign the NDK tools. So, downloading/installing the NDK zip from Google's website will cause macOS Catalina to request the end-user's permission to execute the NDK tools. However, if you download the NDK via Android Studio (which is digitally signed), the installed NDK will inherit its permissions and you will not have this issue.

Comments

  1. Joshua Quick 2020-02-22

    PR: https://github.com/appcelerator/node-titanium-sdk/pull/143 PR: https://github.com/appcelerator/node-titanium-sdk/pull/186
  2. Joshua Quick 2020-04-09

    In our current 9_0_X branch, after the 9.0.0.GA release, app builds will fail if you do the following.

    Uninstall NDK if currently installed.

    Open Android Studio's preferences window.

    Go to: Appearances & Behavior -> System Settings -> Android SDK

    Click on the "SDK Tools" tab.

    Check the "NDK (Side by side)" option.

    Click the OK button.

    Attempt to build a Titanium app.

       [ERROR] [GRADLE] FAILURE: Build failed with an exception.
       [ERROR] [GRADLE] 
       [ERROR] [GRADLE] * What went wrong:
       [ERROR] [GRADLE] Execution failed for task ':app:stripDebugDebugSymbols'.
       [ERROR] [GRADLE] > No version of NDK matched the requested version 20.0.5594570. Versions available locally: 20.1.5948944, 21.0.5935234
       
    This ticket solves this issue because Titanium will correctly find the Android Studio installed NDK and provide it to the app build. *Notes:* - The app will build successfully if you do not have the NDK installed. You will get a warning about the NDK being missing instead. - Google requires the NDK because the app includes C/C++ libraries and wants to strip debug symbols from them. This is something they changed as of Android gradle tool v3.5.0.
  3. Joshua Quick 2020-04-13

    PR (master): https://github.com/appcelerator/titanium_mobile/pull/11627 PR (9.0.x): https://github.com/appcelerator/titanium_mobile/pull/11626
  4. Satyam Sekhri 2020-04-14

    FR Passed. Waiting for Jenkins build on master.
  5. Lokesh Choudhary 2020-04-14

    PR's Merged.
  6. Satyam Sekhri 2020-04-15

    Verified on: Mac OS: 10.15.4 SDK: 9.0.1.v20200415071927, 9.1.0.v20200415075143 Appc CLI: 8.0.0 JDK: 11.0.4 Node: 10.17.0 Studio: 6.0.0.202003181504 Device: Pixel3(v10.0) emulator,

JSON Source