Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-13107

Android NDK support not present for auto-dependency download

      The dependency download is very nice, but doesn't include the NDK, only the SDK. NDK support would be a big help.

          [JENKINS-13107] Android NDK support not present for auto-dependency download

          Yeah, I haven't really used the NDK, but this should be possible.

          Would it be sufficient for the plugin to export an environment variable (e.g. "ANDROID_NDK_HOME") during a build, pointing to the directory where the plugin extracted the NDK installation?

          Christopher Orr added a comment - Yeah, I haven't really used the NDK, but this should be possible. Would it be sufficient for the plugin to export an environment variable (e.g. "ANDROID_NDK_HOME") during a build, pointing to the directory where the plugin extracted the NDK installation?

          Amy Winarske added a comment -

          It should be fine for the most recent NDK on linux.

          The NDK is dependent on the SDK, 1.5 or later. Depending on which sections of the NDK documentation you read, and which version of the NDK you are using, there are also dependencies on the following:

          gmake (name varies by platform) - env variable GNUMAKE
          nawk or gnu awk
          windows: cygwin 1.7 or later

          While most linux installations won't have a problem with these dependencies, mac and windows will, as always, require special handling.

          Amy Winarske added a comment - It should be fine for the most recent NDK on linux. The NDK is dependent on the SDK, 1.5 or later. Depending on which sections of the NDK documentation you read, and which version of the NDK you are using, there are also dependencies on the following: gmake (name varies by platform) - env variable GNUMAKE nawk or gnu awk windows: cygwin 1.7 or later While most linux installations won't have a problem with these dependencies, mac and windows will, as always, require special handling.

          Ok.

          Would you expect this to be automatically downloaded and installed at the same time as the SDK?
          Or, since you mention automated download of dependencies, would you want the NDK only to be installed when required. If so, how can we detect that a given Android project requires the NDK to build?

          Christopher Orr added a comment - Ok. Would you expect this to be automatically downloaded and installed at the same time as the SDK? Or, since you mention automated download of dependencies, would you want the NDK only to be installed when required. If so, how can we detect that a given Android project requires the NDK to build?

          Amy Winarske added a comment -

          You'd only want the NDK if required. It's easy to detect - you look for the jni subdirectory in your Android project directory and see whether it contains an Android.mk file.

          The NDK is used to create a jar file that is then used in the regular Android SDK build, so the NDK build is just a step that comes before the rest of the usual Android build.

          See http://developer.android.com/sdk/ndk/index.html.

          In the event that Google changes their doc without notice, here's the info directly from today's NDK Getting Started:
          Getting Started with the NDK

          Once you've installed the NDK successfully, take a few minutes to read the documentation included in the NDK. You can find the documentation in the <ndk>/docs/ directory. In particular, please read the OVERVIEW.HTML document completely, so that you understand the intent of the NDK and how to use it.

          If you used a previous version of the NDK, take a moment to review the list of NDK changes in the CHANGES.HTML document.

          Here's the general outline of how you work with the NDK tools:

          Place your native sources under <project>/jni/...
          Create <project>/jni/Android.mk to describe your native sources to the NDK build system
          Optional: Create <project>/jni/Application.mk.
          Build your native code by running the 'ndk-build' script from your project's directory. It is located in the top-level NDK directory:

          cd <project>
          <ndk>/ndk-build

          The build tools copy the stripped, shared libraries needed by your application to the proper location in the application's project directory.
          Finally, compile your application using the SDK tools in the usual way. The SDK build tools will package the shared libraries in the application's deployable .apk file.

          For complete information on all of the steps listed above, please see the documentation included with the NDK package.

          Amy Winarske added a comment - You'd only want the NDK if required. It's easy to detect - you look for the jni subdirectory in your Android project directory and see whether it contains an Android.mk file. The NDK is used to create a jar file that is then used in the regular Android SDK build, so the NDK build is just a step that comes before the rest of the usual Android build. See http://developer.android.com/sdk/ndk/index.html . In the event that Google changes their doc without notice, here's the info directly from today's NDK Getting Started: Getting Started with the NDK Once you've installed the NDK successfully, take a few minutes to read the documentation included in the NDK. You can find the documentation in the <ndk>/docs/ directory. In particular, please read the OVERVIEW.HTML document completely, so that you understand the intent of the NDK and how to use it. If you used a previous version of the NDK, take a moment to review the list of NDK changes in the CHANGES.HTML document. Here's the general outline of how you work with the NDK tools: Place your native sources under <project>/jni/... Create <project>/jni/Android.mk to describe your native sources to the NDK build system Optional: Create <project>/jni/Application.mk. Build your native code by running the 'ndk-build' script from your project's directory. It is located in the top-level NDK directory: cd <project> <ndk>/ndk-build The build tools copy the stripped, shared libraries needed by your application to the proper location in the application's project directory. Finally, compile your application using the SDK tools in the usual way. The SDK build tools will package the shared libraries in the application's deployable .apk file. For complete information on all of the steps listed above, please see the documentation included with the NDK package.

          Amy Winarske added a comment -

          The NDK does contain sample applications.
          http://developer.android.com/sdk/ndk/overview.html#samples

          Again, please note there are dependencies on gmake and awk. This is not usually an issue on linux systems, but can require extra work on Mac and Windows. I would note it in the plugin documentation and warn the users to configure their systems appropriately if they want the NDK to work properly.

          Required development tools

          For all development platforms, GNU Make 3.81 or later is required. Earlier versions of GNU Make might work but have not been tested.
          A recent version of awk (either GNU Awk or Nawk) is also required.
          For Windows, Cygwin 1.7 or higher is required. The NDK will not work with Cygwin 1.5 installations.

          Amy Winarske added a comment - The NDK does contain sample applications. http://developer.android.com/sdk/ndk/overview.html#samples Again, please note there are dependencies on gmake and awk. This is not usually an issue on linux systems, but can require extra work on Mac and Windows. I would note it in the plugin documentation and warn the users to configure their systems appropriately if they want the NDK to work properly. Required development tools For all development platforms, GNU Make 3.81 or later is required. Earlier versions of GNU Make might work but have not been tested. A recent version of awk (either GNU Awk or Nawk) is also required. For Windows, Cygwin 1.7 or higher is required. The NDK will not work with Cygwin 1.5 installations.

          Charles Chan added a comment -

          Would it be make sense to have the ability to perform "adb push" and "adb shell" as additional Build steps? This would greatly simplify the case where we have compile some NDK code and want to transferred over to the emulator. Conceptually, I think this would be similar to the "Install Android package".

          (Currently have to write scripts to do these steps manually.)

          Charles Chan added a comment - Would it be make sense to have the ability to perform "adb push" and "adb shell" as additional Build steps? This would greatly simplify the case where we have compile some NDK code and want to transferred over to the emulator. Conceptually, I think this would be similar to the "Install Android package". (Currently have to write scripts to do these steps manually.)

          Hi, any news on this issue?

          Jorge Figueira added a comment - Hi, any news on this issue?

          I haven't done any work on this, though I see now that the new sdkmanager command-line tool does provide a way to install the NDK automatically.

          The plugin will need to be updated to migrate away from the deprecated android tool anyway, so we can use this tool, but it's not clear when it should be called.

          Nowadays, the Android Gradle plugin automatically installs the required build tools, platform and support library dependencies for you, so the functionality in this plugin isn't required (and it only works with Ant builds).  But I imagine that the NDK isn't automatically installed by the plugin.  So, assuming that's the case, going back to my previous question: what do you expect the workflow to look like?  At what point should the NDK be installed, in which circumstances, and how?

          Christopher Orr added a comment - I haven't done any work on this, though I see now that the new sdkmanager command-line tool does provide a way to install the NDK automatically. The plugin will need to be updated to migrate away from the deprecated android tool anyway, so we can use this tool, but it's not clear when it should be called. Nowadays, the Android Gradle plugin automatically installs the required build tools, platform and support library dependencies for you, so the functionality in this plugin isn't required (and it only works with Ant builds).  But I imagine that the NDK isn't automatically installed by the plugin.  So, assuming that's the case, going back to my previous question: what do you expect the workflow to look like?  At what point should the NDK be installed, in which circumstances, and how?

            Unassigned Unassigned
            awinarske Amy Winarske
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: