Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-27801] Android: Building the SDK should auto-download NDK if not installed

GitHub Issuen/a
TypeImprovement
PriorityLow
StatusClosed
ResolutionFixed
Resolution Date2021-06-22T15:29:33.000+0000
Affected Version/sn/a
Fix Version/sRelease 10.0.1
ComponentsAndroid
Labelsandroid, build, ndk, sdk
ReporterJoshua Quick
AssigneeJoshua Quick
Created2020-03-10T23:50:31.000+0000
Updated2021-06-22T15:29:53.000+0000

Description

*Summary:* Google's gradle tool supports downloading the Android NDK for C/C++ builds. We should let it do so if the Titanium SDK is unable to find the NDK. *Note:* Currently, the SDK's node scons build scripts will fail the build if it can't find the NDK directory. Instead, it should generate a local.properties file without the ndk.dir property. [createLocalPropertiesFile ()](https://github.com/appcelerator/titanium_mobile/blob/9a3e46dbea8083bce98dbae5c3795f669a2b7928/build/lib/android/index.js#L285)

Comments

  1. Joshua Quick 2020-03-11

    PR (master): https://github.com/appcelerator/titanium_mobile/pull/11531 PR (9.0.x): https://github.com/appcelerator/titanium_mobile/pull/11532
  2. Sohail Saddique 2020-03-19

    *FR Passed* NDK auto installs if it isn't already installed. Verified with the test case listed on the PR.
  3. Satyam Sekhri 2020-04-08

    The builds fails if NDK not installed
       [INFO]  [GRADLE] WARNING: Compatible side by side NDK version was not found. Default is 20.0.5594570.
       [INFO]  [GRADLE] Compatible side by side NDK version was not found. Default is 20.0.5594570.
       [ERROR] [GRADLE] 
       [ERROR] [GRADLE] FAILURE: Build failed with an exception.
       [ERROR] [GRADLE] 
       [ERROR] [GRADLE] * What went wrong:
       [ERROR] [GRADLE] A problem occurred configuring project ':module'.
       [ERROR] [GRADLE] > Failed to notify project evaluation listener.
       [ERROR] [GRADLE]    > NDK not configured. Download it with SDK manager. Preferred NDK version is '20.0.5594570'. Log: /Users/satyamsekhri/Documents/GitRepos/ti.imagefactory-stable/android/build/module/.cxx/ndk_locator_record.json
       [ERROR] [GRADLE]    > Could not get unknown property 'externalNativeBuildDebug' for project ':module' of type org.gradle.api.Project.
       [ERROR] [GRADLE] 
       [ERROR] [GRADLE] * Try:
       [ERROR] [GRADLE] Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
       [ERROR] [GRADLE] 
       [ERROR] [GRADLE] * Get more help at https://help.gradle.org
       [ERROR] [GRADLE] 
       [ERROR] [GRADLE] BUILD FAILED in 897ms
       [ERROR] "gradlew" tool returned exit code: 1
       [ERROR] An error occurred during build after 2s 441ms
       [ERROR] "gradlew" tool returned exit code: 1
       
    Verified on: Mac OS: 10.15.1 SDK: 9.0.1.v20200408050151, 9.1.0.v20200406120646 Appc CLI: 8.0.0 JDK: 11.0.4 Node: 10.17.0
  4. Joshua Quick 2020-04-08

    This started happening when we updated Android gradle tool to 3.6.0 via [TIMOB-27778]. This appears to be a bug in Android gradle tool 3.6.0, 3.6.1, and 3.6.2. If an ndk.dir is not provided via a "local.properties" file, then the Android gradle tool defaults to NDK version 20.0.5594570 which is an *unstable* release. The gradle tools only supports downloading *stable* releases listed by the links below, which is why it fails. https://developer.android.com/ndk/downloads https://developer.android.com/ndk/downloads/older_releases I'll have to find a work-around.
  5. Joshua Quick 2020-04-10

    I'm removing this ticket from the release. There doesn't appear to be a reliable way of doing this until Google makes this work better in their Android gradle tool. Although it's less of an issue here since you would normally work on the SDK code via Android Studio and you can easily add the NDK from the IDE.
  6. Joshua Quick 2021-04-10

    PR (master): https://github.com/appcelerator/titanium_mobile/pull/12711
  7. Ewan Harris 2021-06-22

    master and 10_0_X backport merged

JSON Source