How to use the Renderscript Support Library with Gradle

Janusz picture Janusz · Oct 29, 2013 · Viewed 34.7k times · Source

Is it possible to use the Support Renderscript Library with Gradle? If so, how do you include it in your project?

Answer

Austyn Mahoney picture Austyn Mahoney · Apr 10, 2014

Using Android Studio:

Add the following values to build.gradle for android gradle plugin v0.14+

android {
    ...
    defaultConfig {
        ...
        renderscriptTargetApi 19
        renderscriptSupportModeEnabled true
    }
    ...
}

For older versions of the android gradle plugin v0.13.3 and below

android {
        ...
        defaultConfig {
            ...
            renderscriptTargetApi 19
            renderscriptSupportMode true
        }
        ...
    }

Once that is done, use android.support.v8.renderscript. anywhere in your app. The library jar and binaries are included automatically.