Android Support Library with Android Works

On the feature list for Android Works (https://developer.nvidia.com/AndroidWorks), the Android Support Library is included. however, I cannot figure out how to link it. Most likely, I need to put com.android.support:appcompat-v7:22.2.1 or something similar somewhere in visual studio’s build settings. I know that it is not active, because import android.support.v7.app.ActionBarActivity; fails with “package does not exist.”

I was able to figure it out.

Create the following file: C:\ProjectName\ProjectName\nsight_tegra_build_overrides.xml

<?xml version="1.0" encoding="utf-8"?>
<project name="ProjectName" Basedir="C:\ProjectName\ProjectName\">
   <property name="android.library.reference.1" value = "../../NVPACK/android-sdk-windows/extras/android/support/v7/appcompat"  />
</project>

The overrides file adds this line to nsight_tegra_build.xml when it is generated. The path for android.library.reference.1 must be a relative path. See http://stackoverflow.com/questions/18209041/how-to-define-v7-appcompat-dependency-correctly. Run:

c:\NVPACK\apache-ant-1.8.2\bin>android update project -p c:\NVPACK\android-sdk-windows\extras\android\support\v7\appcompat\

Change ‘target=android-19’ to ‘target=android-21’ in C:\NVPACK\android-sdk-windows\extras\android\support\v7\appcompat\project.properties. After that, it should be buildable from within Visual Studio.

With the new version “NVIDIA CodeWorks for Android 1R3” I got a new error after completing the earlier steps. Yay.

1>       [aapt] C:\NVPACK\android-sdk-windows\extras\android\support\v7\appcompat\res\values-v23\styles_base.xml:20: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Button.Colored'.
1>       [aapt] 
1>       [aapt] C:\NVPACK\android-sdk-windows\extras\android\support\v7\appcompat\res\values-v23\styles_base_text.xml:19: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Inverse'.
1>       [aapt]

I was able to “fix” this by deleting the C:\NVPACK\android-sdk-windows\extras\android\support\v7\appcompat\res\values-v23\ folder. I’m not yet supporting version 23, so this is okay, for now.