Linking compiled Android Library, using Gradle

I am trying to get NSight Tegra plugin for Visual Studio to add a dependency on an AndroidLibrary project I have previously built. On Mac & Linux, my build configuration works sensibly. The process is just,

  1. build the Android Library project first.
  2. Add an entry to to my consumer application's build.gradle allproject's repository to include my libs directory (so the dependency can be found)
    repositories {
            flatDir {
                dirs 'libs'
  3. Add a block like the following to my consumer application's build.gradle
    android {
        dependencies {
            compile(name:'Helpers', ext: 'aar')

Again, this is working & fully tested on Mac & Linux. By including that simple addition to the build.gradle project, I can utilize classes & styles found inside the .aar file no problem.

My problem is, how do I get Tegra plugin to respect anything to do with .aar? The only “Dependencies” that they allow are native lib dependencies and JAR dependencies… which seems weird as .aar is the recommended method to get an Android library.

The next step in figuring this all out would be to get CMake to generate the project with this dependency listed in the generated project… but that’s a slightly later problem. If I can figure out how to do it manually, I will patch the CMake source myself to support generating the necessary vcxproj… but as far as I can tell, nothing in Tegra respects any project property setting for including android library files.

In fact, in the documentation, the only reference to using Android libraries seems to be indicating using a ‘,’ which I believe is a strictly Ant thing. No mention of how to do it for using Gradle… which is an option in the Plugin, but seems tacked on at the end. Even the generated vcxproj (by manually tweaking the “Gradle Build” project options, label gradle settings as AntBuild settings…

Any help would be greatly appreciated.

If anyone is curious, I finally figured (most) of this out.

There is a largely non-mentioned overrides file. By placing ‘nsight_tegra_build_overrides.gradle’ into my consumer application’s root directory, and specifying the properties that I needed to override (the flatDir repository, and the android { dependencies {) it works.

Now, to just find out how to coerce CMake to force the project to use a Gradle build instead of Ant build by default…

Finally able to default to Gradle build system through CMake, by using a workaround.

Basically at configure time, copy a ${target_name}.vcxproj.user file that overrides the Property. This works fine for that property, but some properties are unable to be set in this manner, so use at your own risk.